Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Commonly misused and abused VFP features
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00310951
Message ID:
00311062
Vues:
45
>
It's tough to sum up without going into a long theorethical discussion, but it's sort of like the "square peg, round hole" concept. In this case, it's more like "round peg, octagon hole". To be brief, there's one situation or problem that is similar, but in some respects very different, to another. Trying to make an existing object (or solution) fit this is what I was getting at.
>

I'm not quite sure what you are trying to say here.... Regardless, it is well worded...< bg >...

>
More than anything else, I've viewed polymorphism from the point of "extending" behaviors, more than modifying them.
>

Polymorphism is about different objects with the same named behaviors with different ways of performing the behavior.

Example 1: The click in a listbox works differently than the click of a command button.

Example 2: The Print method of a customer class can behave differently than the print method of an invoice class.

I am not sure it is so much about extending behaviors as it is that the behaviors are different. It is more about holding to a common interface and hiding the complixity of how different objects carry out the behavior. This is more about encapsulation.

Finally, how do you extend a behavior without modifying the behavior??? I think one implies the other.

>
From my POV, the key is in the definition. It doesn't take much to see that computers themselves rely heavily on this. The bit or switch is either set (opened) or it isn't (closed). The continual recursive definition of this, is what makes them work.
>

I am not sure I see the analogy here...

>
Similarly, the more tightly we define an object's behavior, the (and I hate to quantify it this way) "better". When we start to stray from that, by mis-using or in the name of polymorphism, the more we can get into problems.
>

I think this is more of a discussion on the principle of cohesion.

I think I see were you are getting at with polymorphism, changing and extending behaviors. If anything, this is were inheritance gets over-used. The fact that VB supports polymorphism is what makes it a good tool. It is one of the reasons why the folks have not had to rely on inheritance. And, it is what has saved them from over using inheritance.

In the VFP world, I am not sure how polymorphism is over used.

I think what you are trying to say is that folks violate the principles of encapsulation and cohesion. How polymorphism fits in here, I don't know. Perhaps you could shed more light on this...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform