Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best Way to Handle Key Fields in Custom Class
Message
From
30/11/2001 08:31:15
 
 
To
30/11/2001 08:06:05
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00587672
Message ID:
00587923
Views:
24
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform