I have an abstract base class (call it genericServiceHandler).

I have concrete classes (FaxService, EmailService).

The genericServiceHandler is watching for commands from an external
source. The commands will always be one of a fixed set, no matter what
the concrete service is. They are Pause, Continue, Start, Stop,
Shutdown, PreShutdown.

The genericServiceHandler has no need to process the commands. It only
receives them and maybe dispatches them to the concrete class.

The concrete class doesn't have to implement handlers for all of the
commands, though, at a minimum, onStart() would be pretty much

My question relates to how should I code this.

Should the base class have empty protected stubs to allowing the
concrete class to override them via inheritance?

Should I use __call() to capture the non-existing methods and use LSB
to allow the concrete class to get the commands?

I need to document this (phpdoc) to allow those designing the actual
services know what to implement.

The empty stubs certainly seems the easiest as I can block the scope
to protected and include a full reasoning on when the method will be
called (not all commands are applicable at all times).

Using __call() can be documented using @method, but pretty much only a
single line of description.

What would you all do?


Richard Quadling.
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to