Every time I look at the code that comprises the mega-widespread blogging app, Wordpress, I can't help but wonder; if "code is poetry" (Auttomatic's slogan), then the Wordpress developers' must be a group of pre-pubescent emo girls, searching for themselves through poetry with barely a passing grade in English. Perhaps with bulimia and maybe a drug abuse problem.
And AIDS.
Now, before I get into examples, I need to point out that I don't have a single problem with the Wordpress developers themselves. They're obviously great people; their software is all open source, including their multi-user branch which powers the popular wordpress.com. That's GREAT; the only thing I could ask would be for more companies to follow in suit.
Wordpress is a web application that is built using PHP, MySQL (no SQLite or PostgreSQL) and Apache. It seems to work on any operating system that has, at minimum, those components. As for the app itself: the interface design is decent and the installation is easy. The code is horrible, though. Let me try to communicate how agonizing it is for someone who's used to beautifully architected programming languages and their frameworks to work with this code.
- It's standard fare to see three (sometimes a lot more) global variables accessed at the top of any given function definition.
- Use of object-orientation is out of place and inconsistent. classes.php
- Code duplication is insane. template-loader.php
- There is absolutely no separation of data and logic.
- Theming, while supported, is inaccessible to anyone without a, at minimum, a passing knowledge of PHP unless you can accomplish your theme with simply modifying the CSS. Just take a look at this mess: comments.php or even, what should be the easiest to modify template, index.php.
All of these flaws compound into a pile of code that exemplifies why "serious" developers have a difficult time taking PHP as a language seriously. I've only scratched the surface and haven't even compared it to other apps. It seems that when the Wordpress developers started out, they were fairly new to programming and therefore are afforded many design flaws. I understand this because I still make these errors (everyone does!). Except, in Wordpress' case, they never reviewed, re-factored or even asked themselves, "does this make sense?" and kept using and building upon their first lines of code (kind of like Windows XP). It would do them good to pick up a design patterns book or take a CS course and re-write the entire thing.
The fact of the matter, though, is that Wordpress, for lazy people like me, is that it is simple and it is easy to use. It isn't easy to extend and isn't simple to theme. But who cares about that? I venture to guess that most people using a "one-click" install on their web host or who'r using wordpress.com don't really give a damn. And why should they? It works. Same goes for PHPbb or many other stale open source code-bases. Still, if I had enough motivation to write a competing blogging app using PHP 5 with excellent separation of logic, presentation and data, with a templating language, plugin support… the whole 10 (yes, 10) yards, I don't see it gaining any ground. Wordpress is here to stay, whether we like it or not.
-Sam