WebObjects Tips
 
Wednesday, May 24, 2006
Base Classes are DRY
 
If you have a common base class that for all your components, pages, ajax actions, and EOF objects, you can keep from repeating yourself.
You’ll want your base component class to inherit from WOComponent, your ajax action class to inherit from that, and your page component to inherit from that.
WOComponent: BaseComponent : BasePagelet : BasePage
BaseComponent should have general utility functions useful for all components. BasePagelet should have functions so that it can pull values out of a DirectAction URL, but it should tell Session not to store the results in the backtracking cache, BasePage should tell Session that it does need to be stored in the backtracking cache.