Having a hard time adding abstract classes to my 3-tier website
Crossbones+ - Reputation: 6495
Posted 02 February 2012 - 02:31 PM
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.
External Articulation of Concepts Materializes Innate Knowledge of One's Craft and Science
Beginner in Game Development? Read here. And read here.
Super Mario Bros clone tutorial written in XNA 4.0 [MonoGame, ANX, and MonoXNA] by Scott Haley
If you have found any of the posts helpful, please show your appreciation by clicking the up arrow on those posts
Crossbones+ - Reputation: 13445
Posted 06 February 2012 - 12:31 AM
PLForms | | access | BLInterface | | realized by | | inherits BLImpl ----------------------> BLAbstractBase | ------------------------------------- access | DALInterface | | realized by | | inherits DALImpl -------------------> DALAbstractBaseThis seems ok to me, I only would add interfaces to atleast the BL and DAL layer.