Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Business object and OOP
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00832637
Message ID:
00839754
Views:
27
Hi,
Tahnk for reply.

>>This is an issue. I would put it on BizItem, but the name of the method itself suggests a specific internal structure. At some point your business objects have to know about each other and there will be coupling.

What do you meant by "name of the method itself suggests a specific internal structure"?? Any example?


>3. Similar question as above, If I wan to add new price for ItemA at Outlet B, should I create a method of AddPriceByOutlet(ItemCode, OutletID) or BizItem.oMOutlet(1).oMPPU.New()?
>

>>>The Law of Demeter does not say you can never drill down into a collection. Just realize that when you do that, you are coding to a specific implementation and your code may break in the future. Just try to make sure your data structure is aligned well with the real world.

Any real world example?

>>Let me ask you this: Are you going to do any databinding to the data stored in these collections? If you are going to just manipulate these collections programatically then it is fine to use collections. However, if you are going to present these collections to the user for editing, I don't think collections will work very well in FoxPro. Is VFP8 able to databind directly to a collection? I don't know. I don't want to lead you down the wrong path. Sometime you have to sacrifice pure object-oriented programming because the tools you are working with do not allow it. You may find out later that you should be using Dataenvironments and cursors instead of collections.

At this moment, I am not using data binding, instead, I will loop thru the colection to show list of records, and then loop thru control like listbox, listview to update my collection. Then, my BO will update table accordingly using the data stored in collection. Is it the way?

Additionally, I am abit confusing here..

As I see few BO design of commercial framework, once BO.Load(), it usually load all child BO records as well such as Inv.Load, ListItem records will be loaded either.

In my current bIzItem design, once BizItem.Load(), it will load child accordingly such as oMOUtlet in my previous msg. Then oMOutlet will also load all relevant Pricess. This "automated" simplify presenting/editing data in maintenance form. However, what if module like price checking want to get basic info and price list of a particular item? Should I use BizItem.Load()? Since BizItem.Load() may load something not necessary for this module, it will decrease the performance. What is better design, create a new method and just return price list? Should I populate the result of this method to BizItem.oMOutlet.oMPPU collection???


Thank you for help.
I am not the most powerful man in this world.
I am not the worst man in this world either.
I just as same as all of you.
I still need to learn from my mistakes...
Previous
Reply
Map
View

Click here to load this message in the networking platform