Sign in to follow this  
Alpha_ProgDes

Having a hard time adding abstract classes to my 3-tier website

Recommended Posts

Alpha_ProgDes    6921
I'm only using asp.net, ado.net in .net 3.5. No webservices, asmx, wcf, or anything of the sort.

I'm going to give quick details now, and put more detail later. Just to avoid tl;dr.

Now I currently have a pretty good setup, (IMO). I have my Presentation Layer as my aspx and aspx.vb, my Business Layer as BL.vb, and my Data Access Layer as DAL.vb. And as it should be a method from the PL calls a method from the BL which in turn calls a method from the DAL. However, I would like to have my BL and DAL, both, have a base class (ie. abstract/base class for each) and still keep the 3-tier model. What is the best way to go about doing this?





Now, more detail.

I have webforms that are form-based and does some calculations. Ex. A form which gathers information about widgets, its construction, and its delivery. Now each widget has its own webform (that's a requirement). But the widgets-forms all have common functionality (ex: input weight of widget, calculate velocity of widget cylinders, input number of parts of failures during test, etc). So of course all the widget-forms are going to have base methods for calculations, validation, and data access. So the PLs will differ from another but the validations, data access will be mostly same across them all. Hopefully I haven't lost anyone.

I was thinking of having the BL inherits from an abstract base class and the DAL inherit from a abstract base class. Then having the BL call the DAL as usual. But I think that if the BL inherits from an abstract base class then my DAL goes away (ie. the abstract BL will call the abstract DAL). Am I thinking about this.... near correctly?

If this is a confused mess, my apologies.

Share this post


Link to post
Share on other sites
Ashaman73    13715
When using a multi-tier architecture I would take a careful look at the tasks of a single layer and be careful about a clean interface definition. From what I understand (btw. I'm living in the java world, not .net [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] ), I would buildup your layers like this:


[code]
PLForms
|
| access
|
BLInterface
|
| realized by
|
| inherits
BLImpl ----------------------> BLAbstractBase
|
------------------------------------- access
|
DALInterface
|
| realized by
|
| inherits
DALImpl -------------------> DALAbstractBase
[/code]
This seems ok to me, I only would add interfaces to atleast the BL and DAL layer.

Share this post


Link to post
Share on other sites
Telastyn    3777
[quote name='Alpha_ProgDes' timestamp='1328214699' post='4908831']
However, I would like to have my BL and DAL, both, have a base class
[/quote]

That defeats the purpose of keeping them seperate.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this