3 Lessons Learned From The Drupal 1 and 3 Codebases

A recent challenge from a co-worker lead a few of us to get working versions of both Drupal 1 and 3 under modern MySQL and PHP 5.2. While we poked around inside the codebase trying to make it work and see what we could do with it, 3 things jumped out at me I felt were worth sharing. Since most of us were not around for these versions of Drupal there is a lot we probably don’t know that we don’t know.

Partial OOP

What if I told you themes were Object Oriented in early versions of Drupal? Would you think I was crazy? Lets take a look at the first code line of the yaroon theme from Drupal 3 for the answer:
class Theme extends BaseTheme {

While this is not pretty, there was OOP going back to the roots of Drupal. Not just OOP but, OOP mixed with procedural code.

There have been several posts talking about the good, bad, and ugly of OOP in Drupal. And, there was a time where most of the OOP was stripped out of Drupal. But, if you go back further you see something different. Something I was not aware of until a few days ago. Drupal has its roots with some OOP. In fact Drupal had OOP before there were hooks.

The style of mixing OOP and procedural is one I’ve seen quite often. There are a lot of projects that are straight OOP and thats great. But, I have seen a lot of code that mixed OOP and procedural. This is something that worked in Drupals past and could still work today.

Code Documentation

In the early versions of Drupal code documentation was terrible. Though, terrible may not be the right word. In most cases it just didn't exist. Trying to figure out what was going on was not all that easy. This is a stark contrast to the Drupal 7 core getting ready to be released where I sometimes find the code comments to be too verbose.

But, in contrib the module documentation is often just as bad as early versions of core. For new people to contrib projects it can be very difficult to understand what’s going on inside the modules. This is something we can and should remedy.

The Drop Is Moving Fast

Drupal verions 1 and 3 look quite a bit different from each other and from later versions when I became involved in the project. We already talked about themes being OOP and the first release not having hooks (something considered a cornerstone of modern Drupal). But even the hook system has changed a great deal. For example, the only hook from Drupal 3 that still exists today is hook_help().

The Drop is always moving” has been a slogan in Drupal since before I knew Drupal existed. This philosophy has served the Drupal community well in a fantastic ability to adapt. But, the Drop is not just moving. It is moving fast. Faster than many people are comfortable with.

In this world where Drupal is as popular as it is we need to start to think of more and better ways to continue to move the community along with this fast moving Drupal. When a released Drupal 7 lands there are going to be a lot of people blown away at the amount that has changed. People who considered themselves experts will feel like novices (even if they really aren’t).

Taking a trip into the history of Drupal was fun. It helped me understand a little more about it and how it got to where it is today.