
Apologies!
This article was written over a year ago and shelved forever (or so I thought). A lot of the opinions offered are archaic and no longer apply to a lot of the projects mentioned here. If you somehow stumble upon this page, please take all this with a grain of salt.
If a young developer said to you 'I want to learn by looking at existing code from a successful PHP project. Can you point me in the right direction?' Would you ever feel comfortable sitting them down infront of Drupal or Wordpress code? What if they responded by saying: 'But they are the most well-known free, and open, products that use PHP. They're obviously doing something right, so why shouldn't I try to learn from their example?'
If you know me at all, you may have noticed my dis-taste for Drupal and Wordpress. I've received quite a few puzzled looks from fellow devs wondering what, in particular, about the two giants frustrates me. I'll try to convey my observations here.
A little perspective: Drupal is the most-popular CMS available in PHP, and for good reason. It's extremely easy to use and maintain from a users perspective. It's a snap to add new plugins/functionality and bend it to your will without losing any integrity. Drupal does what it was intended to do very well.
Wordpress, is the king of the blogging industry. If you happen to come onto a blog, there's a good chance it's running Wordpress. The UI is very polished and pretty which helps non-technical users easily get into the swing of things. Wordpress is also ridiculously easy to extend and tweak due to its plugin system. Wordpress does what it was intended to do very well.
My gripes with each solution comes from my knowledge as a developer and an advocate of PHP as a language. And, I'm not talking about some of the glaring security bugs that popup every now and then where a contributor forgot to check for login credentials on particular admin pages. No, all systems have issues like these that come up from time to time. Maybe a little too often for Wordpress but I'm willing to forgive that. My issues are a little more philosophical and long-term.
I see a lot of young developers looking to get into the web-development world turn to PHP because of how easy it is to pickup. After piddling around with the basics and writing Hello World! scripts they often turn to larger tasks/projects. More often than you might think, they turn to plugin development for established, widely-used, systems like Drupal and Wordpress. This seems like a reasonable approach to take since writing plugins for established giants would expose the young developers to enterprise-level products without getting too far over their head.
Assume for a moment that Drupal and Wordpress's codebases are both enterprise-ready in terms of security and stability. I know this isn't quite the case but I'd rather steer clear of bashing either system because of surface flaws.
From my point of view, these
developers are digging themselves a very deep hole by investing their
time with 'old-way' architecture that both Drupal and Wordpress
utilize. Since both are deeply vested in PHP4, and seemingly have no
plans to drop that 'feature', I feel that younger developers are only
hurting themselves by muddling through each codebase.
The PHP world was much different in PHP4 back in 2000 (yes, 9 years ago was when PHP4 was first released). Objects were still in it's infantile stages of support and were largely ignored. Yet, because of the popularity of both Drupal and Wordpress, young developers still perceive them as triumphs of code to model themselves after. I believe that PHP4 spawned a lot of the bashing that goes on today. It was a very excellent functional language, but not up to par with the other deeply-vetted oop giants. It got you from point A to point B without much fuss but from an appearance and architecture standpoint, it was like scratching nails on a chalkboard.
Drupal, to the best of my knowledge, uses a very complex, but solid, hook architecture for most of its functionality. Wordpress, similarly has a lesser hook system in place but also drives most of its power from global functions. While both systems obviously work and are maintainable to a point, the rest of the programming world will scoff at both implementations because they have no idea what is going on or where to begin due to its strictly functional design.
Drupal often gets criticized by newcomers who believe that object-oriented programming (OOP) is always the best way to design software architecture, and since they do not see the word "class" in the Drupal code, it must be inferior to other solutions. In fact, it is true that Drupal does not use many of the OOP features of PHP, but it is a mistake to think that the use of classes is synonymous with object-oriented design. This article will cover several of the features of Drupal from an object-oriented perspective, so programmers comfortable with that paradigm can begin to feel at home in the Drupal code base, and hopefully be able to choose the right tool for the job.[Source]
This is a comment from a Drupal Core Developer regarding why Drupal is not written using OOP methods. I am not trying to say that OOP is always the best way to go, or that it's even generally superior to functional programming. However, I will say that OOP makes pattern-recognition a snap and therefore easy to understand the purpose behind code without understanding the syntax. Drupal lacks this ability as everything is written using globals and vanilla functions.
Actual Wordpress Code
My main point is that each PHP giant implements a proprietary system of 'old-world' functional programming patterns which they have forced themselves into believing is just as good as enterprise-level patterns that almost ALL programmers are at least aware of. They key-word is proprietary. In my opinion, when a developer uses backwards-compatibility as an excuse, they are sliding down a slipper-slope to unmaintainable code. PHP5 support is rock solid, there is no reason a hosting-company should still be pushing php4 by default (only be special request). PHP5 should be the standard.
While some of the techniques used in Wordpress/Drupal are undoubtedly solid and still state-of-the-art, the majority of the frameworks are ancient in web-development terms. PHP is growing as a language, and I for one want to see it regain some of the respect its lost. I feel that because Wordpress and Drupal are literally two of the most successful implementations of the language that they have a responsibility to help it grow and mature. It seems like PHP5 is in its late-teens (human years), still striving for more mature features like what's planned from PHP6. Yet, Drupal and Wordpress are still using the adolescent/funny version of PHP which a lot of people don't take seriously. Instead of showcasing what the 'respectible' versions of PHP have to offer, they have chosen to invent their own functional framework which, once learned, can hardly be applied to other platforms or languages.
I know that I've singled out two PHP applications in this post when the fact is that there are hundreds, if not thousands, of products that make the excuse they have to support PHP4 therefore they will not be upgrading (I'm looking at you CakePHP). I chose to use Wordpress and Drupal because they are the face of PHP and instantly recognizable by any developer.



Comments
Mark Northrop on (9.8.2010 5:25 am) says
Jerrac on (9.8.2010 3:42 pm) says
Joseph Scott on (9.8.2010 4:36 pm) says
Gobezu on (9.9.2010 6:46 am) says
Laci on (9.10.2010 11:43 am) says