in reply to Best way to 'add modules' to web app?
Keep in mind I know nothing about the specifics, but let's say, for example, you have a Forum::Format module. This module has the methods:
You can also define the abstract or stub methods:$f->formatPost() $f->outputPost()
If some other class is calling the $f->formatPost() method, make sure it calls $f->preFormatPost() before and $f->postFormatPost() after. Even if the abstract versions of these classes do nothing, future module writers can have their classes inherit from Forum::Format and override these methods or even rewrite your Forum::Format module without changing a thing except for these two methods. I realize your system may be a bit more complex than this and having future writers rewrite one of your base classes is a bad idea, but the idea of leaving "hooks" for pre/post formatting (or other actions) is still sound.$f->preFormatPost() $f->postFormatPost() $f->preOutputPost() $f->postOutputPost()
Additionally, anything you do inside the Format method could call other methods that can be overridden. So if, within Format, you call $f->modifyHTML($text) or something similar, that method can be overridden to modify HTML differently in a child of the Forum::Format class.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Best way to 'add modules' to web app?
by BUU (Prior) on Jul 05, 2003 at 15:51 UTC | |
by chunlou (Curate) on Jul 05, 2003 at 16:19 UTC | |
by The Mad Hatter (Priest) on Jul 05, 2003 at 16:01 UTC | |
by adrianh (Chancellor) on Jul 05, 2003 at 21:31 UTC |