Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best Way to Handle Key Fields in Custom Class
Message
De
30/11/2001 08:31:15
 
 
À
30/11/2001 08:06:05
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00587672
Message ID:
00587923
Vues:
25
This message has been marked as a message which has helped to the initial question of the thread.
>>If you have multiple methods which behave differently for the different views, then subclassing the class to handle the separate views would simplify code all around. You could then use an abstract factory to determine which subclass to instantiate to handle the specific view.
>
>Jay
>
>What is an abstract factory?
>
>Renoir

An "abstract factory" is a design pattern. The concept of a design pattern was developed by a group of OO developers (the gang of 4), and explained under a book of the same name.

A design pattern is an economical solution to a common programming problem. I'm still getting a handle on it. Using design patterns provides flexibility within the sometimes overly hierarchical structuring of OO.

For further info on design patterns, Steve Black has lots of good stuff on his WIKI as one of the major proponents of patterns in the VFP world:

http://fox.wikis.com/wc.dll?Wiki~DesignPatterns

Actually, the design pattern appropriate for your use would be the "Strategy" pattern -- which determines which subclass in a class to instantiate given certain conditions.

For the Strategy pattern specifically:
http://fox.wikis.com/wc.dll?Wiki~StrategyPattern

Enjoy!

Jay
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform