Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
JVP's mid-tier inheritance challenge
Message
 
To
31/01/2000 09:56:54
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00324138
Message ID:
00325620
Views:
24
>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,
the ultimate resource for this is Steve Black's white paper and the related wiki topic on his Hook Pattern. I haven't read over this info in a long time, but the following is my own method of identifying where hooks might be helpful during design and planning phases. These techniques have always paid off for me well so far.

Before and After hooks (i.e. PreSomethingHook() and PostSomethingHook()) usually come in handy when they surround a standalone action type method. Methods where you typically call them directly as opposed to being wrapped internal to the object.

So if your class designs adhere to good encapsulation (see JVP's comments on this thread about an object's interface = a contract), these directly called action type methods are ideally public methods instead of private methods.

An exception I also look for to this public method rule of thumb is any custom method I call "LoadSomething" or "RunSomething" (my own personal descriptive naming standards so your mileage may vary here).
Roxanne M. Seibert
Independent Consultant, VFP MCP

Code Monkey Like Fritos
Previous
Reply
Map
View

Click here to load this message in the networking platform