Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
JVP's mid-tier inheritance challenge
Message
From
31/01/2000 09:56:54
 
 
To
30/01/2000 11:59:45
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00324138
Message ID:
00325010
Views:
30
Erik,

>I think that this 'trap' can be avoided with smart class design... I can say that I rarely run into this need, because I have tried to provide for it by implementing the correct hooks, and breaking class functionality into enough methods that makes changes easy because of the granularity of responsibility.

I appreciate your very practical comments on avoiding the inheritance trap with hooks and fine granularity of methods. This is helpful.

>If this is, then I think that you are misunderstanding the functionality of the methods in the example I gave. For example: an BizObj.Add method is not a place to add subclass code. Rather, it is a wrapper around a couple of other methods: Validate, BeforeAdd, AddRecord, AfterAdd. Only the AddRecord method has code in it from the parent class, and it knows how to behave because of properties, (which table, PK field, etc), and the rest are hooks, to be called at the appropriate time in the add process.

I'm curious about how you decided on this approach of "before" and "after" hooks. I've seen that done quite a bit in Visual Maxframe, but don't remember reading about it anywhere. Maybe this would be good material for an article.
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform