Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to put these objects (3-tier question, again)
Message
 
To
17/01/2003 01:04:11
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00741808
Message ID:
00742944
Views:
29
>David-
>
>>If I understand you correctly, your business object has both a collection of data rows and a property for each data field.
>
>Well, no, but I can see that my writing wasn't terribly clear on that.
>
>>My only problem with this approach is that the business object is doing double duty and it makes for some serious OOP limitations. For example, your customer object may contain serveral customer records which you expose at certain times through properties of the object.
>
>No, in the context of the current discussion, the customer business object will deal with one customer at a time. I could see a customers bizobj that would have a collection of customer business objects. The collection could have how many different sorts of custumer objects as the system needs. But I'd only have that if there was some reason for running business logic on a dataset as a whole. (And there isn't necessarily a reason to, that I can see.)
>

Exacltly my point. There is no single "business object" for customers. You have a Customers collection class and Customer single entity class. A better example would be an Order class which would have a reference to a LineItems collection class which would contain LineItem entities. The Order object would have to run through its LineItems collection to get the current order total, for example.

>> Now, what if I want to subclass Customer into CorporateCustomer and IndividualCustomer and these different subclasses have different behaviors?
>
>You'd, um, subclass customer. ;-)
>

But who decides which subclass to instantiate? Which is the "business object", the collection/container or the entity? Which has responsibility of loading and saving the data? You could say the collection has the responsibility of loading the data since it needs to determine which subclass to instantiate. But then what about saving the data? What if a CorporateCustomer has different business rules and behavior than IndividualCustomer? So you put the Save on the Customer entity. Now you have a different object doing the load than the object doing the save, encapsulation is broken.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform