Information générale
Catégorie:
Programmation Orientée Object
>>How can any object resize itself with out taking ALL the other objects on the form and the form it's self into account.
There are two things here:
1. Resizing objects
2. Making sure that resized objects are compatible with other objects
The first, resizing of an object, should be done by the object itself. The object should not care about other objects. When you tell the object to go resize itself, it should, regardless of the context, which gets to the second thing, the context...
In this scenario, you really need to have a delegator, which tells all the objects to resize themselves. The delegator is aware of the context. The context in this case is the population of objects and how they relate to one another. It is the delegator's responsibility to know what message to send each object. It is the object's responsibility to deal with the message, regardless of the consequences. Doing anything else, will place too much implementation specific code in the specific classes. Or worse yet, require the need to write implementation specific code all of the time. With a delegator, you write the code once, in one place.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement