This is maddening. There have been requests for multiple inheritance in PHP since I started using it in mid 1999. Of course, in mid-1999, I didn’t really care. There wasn’t much written in PHP that was any good, so I was writing little scripts of glue code to tie pieces of HTML together and the like. I wasn’t working on anything big. Now, like 8 years later, I *am* working on a big project, and I *need* multiple inheritance, and it’s *still* not there!
Here’s my dilemma: I wrote an extension for Moodle 1.5.x. Not that it’s really important, but I implemented a new assignment type geared toward Computer Science departments. The current release of Moodle is 1.8. In looking at a new built-in assignment type in 1.8, I’m noticing that it does roughly 85% of what I need it to do. Further, in looking at the code, it appears that the remaining 15% wouldn’t be difficult to implement.
“I’ll just make my assignment type inherit from this new built-in one, write a couple of new methods (the code for which can be ripped almost verbatim from my old 1.5.x code), and I’ll be on my way!”
Wrong. The shiny new built-in assignment type extends the base assignment class, and that’s the whole inheritance story in PHP. Even though 90% of what I need is in that new built-in class, I can’t base my class on it, because *it* already inherits from another class.
Now, I make no claims of *being* a computer scientist, so my question is simply this:
“Am I missing something here, or does it seem moronic to keep debating the usefulness of this particular feature instead of just implementing it?”
For the record, I don’t mean for this to be a rhetorical question. If you have an answer or comment (besides “it’s open source, just implement it yourself”), I’d love to hear it.
Technorati Tags: php, development, internet, coding, moodle, oop, multiple-inheritance, object-oriented, technology