I'm very curious: why is not Drupal more structured like a normal object-oriented desktop (Java, C++) application? I mean, the current modular design is wonderful, but could classes complement the current framework? Or could classes even be used in place of the modular design? What were the reasons Drupal avoided classes? Are they not due to compatibility issues with PHP4?
I mean, for instance, a web app could be structured something like this (each item being an object, and each indented item being a member):
$app
$menu
$content
$headerContent
$leftContent
$mainContent
$user
$modules[]
Then you could have standardized interfaces and overridable functions, like $app->getModule($moduleName), $module->addHook() (where an array of hooks is stored in the Module superclass), $module->view, $module->delete($recordId), etc.
Any thoughts out there? Just curious...
Comments
Extensive discussion
Extensive discussion of Drupal's approach to coding, including the decision to avoid PHP's class construct, is here:
http://api.drupal.org/?q=api/file/developer/topics/oop.html/4.7