Subclass to alter or add behavior.
scrottie recently said that delegation was an alternative to subclassing... I would really like some references on why delegation is a viable/better option.
That seems all fine and dandy. Now, imagine that you have that in 20 places in your code, but in the manager class, someone changes name to full_name. Because the code using the office object was forced to walk through the object heirarchy to get at the data it actually needs, you've created fragile code. Now the manager class must support a name method to be backwards compatible (and we get to start on our big ball of mud), or every reference to it must be changed -- but we've created far too many.
Not too many for :
perl -i.bak -p -e 's/manager->name/manager_fullname/';
also, you might bring up the concept of a
Facade: you might not go changing the object's interface: you could keep the hold and delegate of the old to the new method.
PApp::SQL and
CGI::Application rock the house