2020.09.08

Wordpress

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.

 

DrupalFrom 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.

 

Wordpress CodeActual 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.

Get my RSS Feed!

Comments

Mark Northrop on (9.8.2010 5:25 am) says

Excellent article, but I'd just like to point out that the next version of CakePHP that will be released (CakePHP 2.0) will not support PHP4.

See http://cakephp.lighthouseapp.com/projects/42648/home for more details.

 

Jerrac on (9.8.2010 3:42 pm) says

Interesting article. Just so you know, Drupal 7 is moving to PHP5. http://drupal.org/gophp5 

 

Joseph Scott on (9.8.2010 4:36 pm) says

A few things to note:

WordPress already has plans to retire PHP4 support - http://wpdevel.wordpress.com/2010/07/09/suggest-topics-for-the-july-15-2010-dev/#comment-8489

Many (most?) plugins already make use of PHP5 specific items.

Your argument was lacking in specifics and seems to come down that you were upset they were using the very latest version of PHP.  Figuring out the minimum version to support is driven by the numbers we had available ( current numbers at http://wordpress.org/about/stats/ ).  Matt Mullenweg stated that he was looking for PHP4 usage to drop below 10%.  Even at 10% that is still more than a million sites, small percentages can be deceiving when dealing with large numbers.

Other aspects that I've seen come into play is the rejection of features in PHP that would have been very beneficial to WordPress developers and accelerated their planned move to PHP5 as a minimum requirement (named parameters is one that comes to mind).

On security and stability, yep, WordPress has had its share of problems.  The best way to stay secure is to stay up to date, which is why making it easy to update has had lots of attention.

I'm not sure what exactly you were looking for on the stability side of things.  WordPress.com runs a single install of WordPress and is one of most visited sites in the world ( Quantcast stats - http://www.quantcast.com/p-18-mFEk4J448M ).

 

Gobezu on (9.9.2010 6:46 am) says

although your points might be valid your research is as for cmss is unfortunately incomplete, but maybe that was not your idea either. this is not meant to be joomla vs others rather i am trying to underline the actual alternatives with the topic of the post in mind, namely how well adept the various cmss are to sound development practices

so allow me to mention joomla, which i would say is the most popular cms because of its ease of use. never before had i heard that drupal is known for ease of use

joomla since version 1.5, ie about 3 years now; 1.6 around the corner, is based on its framework which not only is object oriented it also is tauting various best practices within the domain of development, such as various development patterns, which is even further developed by the new groundbreaking framework called nooku (http://www.nooku.org/)

nevertheless thanks for bringing up the ever aching issue i and probably many developers have looking at drupal and wordpress

 

Laci on (9.10.2010 11:43 am) says

If you're looking for a true Enterprise class CMS that is written in modern object oriented PHP code then you might consider TYPO3. Obviously TYPO3 is not as easy to use at first as some of the alternatives mentioned but once learned is the swiss army knife of web development. Also TYPO3 is the PHP based CMS that is being used in quite a few Enterprise environments. 

 
* Name
* Email (Will not be displayed)
Website