Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best Way to Handle Key Fields in Custom Class
Message
From
29/11/2001 17:10:32
 
 
To
29/11/2001 14:38:59
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00587672
Message ID:
00587759
Views:
23
This message has been marked as the solution to the initial question of the thread.
>I have a class that handles updates/adds/deletes for a passed view. Everything works fine, but I have a methodology question. One of the methods (UpdateKeyFields) is used to handle populating key fields and the control field with required data when adding a record. I use a case statement that has specific criteria depending on the view passed. I would like to have the class perform entirely independently and having this conditional method bothers me. It's no big deal to modify it for different views within the application - I just feel it should be done differently. Any ideas? Thanks!
>
>Regards, Renoir

If this is the only location in the class where you have a conditional to address the different views, then Pamela's suggestion is a solid one. On the other hand, an appropriate question is how will that benefit the application in a practical way? The more data-driven the rest of the application, the more that this would fit the pattern. But, otherwise, it may not have a lot of benefit.

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.

Or, do nothing...<g>

Jay
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform