Subject: Domain Object inherit from Business Entity
Posted By: case23_69 Post Date: 9/21/2006 2:49:02 PM
Hi,
Wouldn't it be easier to inherit your domain objects from your business entities so that you don't have to maintain the members/properties in 2 places?  So, Product would inherit from ProductDetails, for example.  Is there a reason you don't do this?

Thanks!

Reply By: englere Reply Date: 9/23/2006 8:10:16 PM
I don't know if you'd want to inherit between tiers, that would seem to break the objective in keeping the tiers separate. But I understand what you're saying - you want to avoid repeating the same fields. Maybe an interface would serve us better in that role.

However, typically the BLL will not have a 1:1 relationship with the DAL. It's common to flatten out the model at the BLL level, so it's often going to be very much denormalized. You might have data from 3 different tables in one BLL object.

The BLL should be a close representation of how the data is going to be used, and the DAL should be a close representation of how the data is going to be stored. In the middle of these you have to do some mapping and translation, and that's where the discussion of ORM fits in. Whether you map yourself, or use a tool to map, either way you have to mitigate the difference in data representation whenever you cross the DAL-to-BLL boundary.

It's hard to show all of this in a simple site like this, but you can imagine how a large site could be modelled ...

Eric

Reply By: case23_69 Reply Date: 9/25/2006 9:48:52 AM
Thanks - that makes sense.  I typically use the approach of a "BusinessEntities" namespace that I consider part of the business layer, so I think of the entities and the BLL as the same tier.  You mentioned: "Maybe an interface would serve us better in that role." - could you explain what you meant there?


Go to topic 50210

Return to index page 165
Return to index page 164
Return to index page 163
Return to index page 162
Return to index page 161
Return to index page 160
Return to index page 159
Return to index page 158
Return to index page 157
Return to index page 156