Jump to content
  • Advertisement
Sign in to follow this  
Alpha_ProgDes

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

This topic is 2503 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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 biggrin.png ), I would buildup your layers like this:



PLForms
|
| access
|
BLInterface
|
| realized by
|
| inherits
BLImpl ----------------------> BLAbstractBase
|
------------------------------------- access
|
DALInterface
|
| realized by
|
| inherits
DALImpl -------------------> DALAbstractBase

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

However, I would like to have my BL and DAL, both, have a base class


That defeats the purpose of keeping them seperate.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!