Drupal and Object Oriented Programming

What would the advantages be of (theoretically, of course) having Drupal as an object-oriented content management system? So I answered myself:

I'm not saying that this will be easy to achieve. In fact, this will be incredibly hard to achieve, and would require an almost complete rewrite of Drupal. However, it is the way to go: hopefully we'll see some changes towards object-oriented programming as we move into Drupal 7 and Drupal 8.

Comments

We want more than programmers

I am a math teacher by graduation. I know a certain former physics professor who is quite high on the ladder. Someone else went to a film school. If you make Drupal fully OOP then it will be much harder for non-programmers to use.

Agreed

Agreed, this is a wild idea that would have absolutely no application in the real world. Still, it's interesting to contemplate.

Drupal itself is

Drupal itself is object-oriented in a way. The reason Drupal isn't using classes is more historical rather than strategical. But I personally think the problem for "newcomers" is more syntactical than anything, because Drupal's pretty much object-oriented under the disguise of a procedural syntax.
Looking at Drupal's JavaScript code reveals how "object-oriented" Drupal can be; JavaScript is a stable, "frozen" language that supports many object-oriented concepts and patterns. For example, it's trivially easy to implement / emulate a class-based object-oriented system, even though JavaScript itself is prototype-based. PHP, on the other hand, does not have a homogenous distribution; a lot of hosting companies are still sticking to PHP 4, which is weak in terms of object-oriented support, whose support is ending in 38 days. That's why we have GoPHP5, because, as we all have experienced, PHP 4 is now a burden that makes developers' lives harder, and it's pretty much what held Drupal back into not using classes.

Another problem which is

Another problem which is obvious with inheritance theory is that you are required to have a deeper understanding of the system. With hooks, its easier to extend the functionality. Though it can be limited at times but there are always work around.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

You must answer the above question correctly to be able to submit a comment. This measure is designed to protect this site against spambots, which seem able to circumvent even the toughest image captchas. Hint: try googling for the question answer if you really don't know it. The theory behind this is that if this website is running its own completely custom captcha, it will not be in anyone's economic advantage to rewrite their spam bot's code to handle this website's questions. Powered by CwgordonCaptcha.