Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP objects talking to each other
Message
From
18/12/2002 10:31:58
 
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00729821
Message ID:
00734100
Views:
54
Glenn

In VFP, what would be the best method to create a mediator with child objects? If I have a group of custom-based objects, that require a mediator, how will these objects communicate with their mediator if they are, for example, dropped onto a form? Would the mediator have to be a container class? What if a form needs to directly address one of the child objects?

Sorry for all the questions.
Kev


>Yes, the reason and rationale for all this extra "plumbing" is to allow a more flexible structure. When sibling objects message each other there is a co-dependency established between these two objects. When an object communicates with it's container it allows extended functionality without further binding multiple siblings. Calling container methods and properties is one way of obtaining a loosely coupled structure. Broadcasting an event is another, however VFP is not very good at raising events.
>
>I am sure that after employing this methodology for a while you will find that it enables you to do far more with less re-rigging of the code. I discovered the need for loosley coupled components after doing it the wrong way and causing myself to pour over code in many objects looking for co-references. When using the parent / child type relationship there is only one place to look for functioal code relative to a certain behavior. Tightly coupled objects cause much interdependency and thus a more brittle and fragile structure which will be very difficult to modify and maintain.
>
>Glenn
>
>
>>>BINGO! Today you get a gold star. Good job!
>>>
>>>Glenn
>>
>>Still seems like unecessary work trying to accommodate all of this!
>>
>>I still have a question though, before I get a book, and that is, if you want to obtain a property value from another object, under the same mediator, do I need to call a method from the mediator, which will return the value?
>>
>>Thanks
>>Kev
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform