Archive for April, 2007
It’s not a joke if you can choke on the thought of it
I was trying to explain to a friend some of the gripes that I had with PHP’s gung-ho approach to object-orientation and launched into an extended description of my biggest bugbear: class inheritance. At the time I was slightly less than sober (as is so often the case with important discussions and me) so in the aftermath I began questioning what I had said, especially as it was a while ago I last tried to push past the “bug”.
First, an explanation. If you have an abstract class you can define abstract methods which must be beefed out in any non-abstract subclasses but you can also define some standard methods (with bodies) which any subclasses will happily take with them. The easiest way to explain this is to just dump the code and go from there: (more…)