Lightweight vs Heavyweight

January 2, 2008 · Posted in Opinion, Tech · 3 Comments 

Nik Silver has a thought-provoking piece on Heavyweight vs Lightweight content management. As the (former) architect of what you might call a middleweight CMS, I find his argument almost totally wrong. As far as I can tell, it amounts to a false syllogism that goes like this:

  • WordPress is a lightweight CMS
  • The Guardian use a heavyweight CMS
  • WordPress cannot do everything needed for the the Guardian website
  • Therefore, a heavyweight CMS is better than a lightweight CMS

I think the argument he’s trying to make is that a well-designed system with a judicious amount of abstraction is better than one without the abstraction. But I don’t follow his argument that any changes to WordPress would necessarily result in unmaintainable code. In fact, there are numerous newspapers who use WordPress, and several very high traffic sites that use it too. His argument is basically a retread of the tired old-skool IT dirge “but this isn’t enterprise software”. I find this surprising given that Nik is an eloquent advocate of agile methodologies and should, in theory, be sceptical of the idea that software needs to be big to be effective.

He says:

Lightweight is often good, but it must have its tradeoffs, otherwise other technologies wouldn’t exist.

Really? He seems dangerously close to the ‘one true language’ trap here – an El Dorado of a language that would be perfect for every job and everyone would agree on. This is absurd. Heavyweight software will continue to exist for a long time in my view, mainly because of the vested interests of the corporations that sell it. And not all heavyweight software is bad of course.

Every single decision you make when designing a software system is about compromise – manageability vs performance, explicitness vs extensibility, productivity vs complexity and so on. Every system you ever use has tradeoffs: not every system needs to be extensible, and not every system needs to be optimised to the limit. I prefer the Pragmatic Programmers’ advice: “do the simplest thing that could possibly work.”

To suggest that WordPress is, out of the box, a viable alternative to an existing bespoke system is faintly silly. Is WordPress the cleanest abstraction possible for a CMS? No – it’s targeted pretty much exclusively at blogging. But to suggest that there’s something difficult about getting ads into a page is a bit weird – check out TechCrunch if you don’t believe me.

Lightweight languages and frameworks (for example, Ruby or Python) are all the rage because they make developers very productive. There are downsides, performance being the most often raised one. Many of these downsides are FUD though. Everything I see at the moment leads me to think that the days of Java and C# are numbered as the ‘enterprise way’. The productivity you can get out of things like Ruby on Rails is so great that people are going to be forced to re-evaluate the ‘heavyweight’ options. The (perceived) performance problems of scripting languages are sure to go away. Remember the days when people hand-wrote assembler because they didn’t trust the C compiler to optimise their code properly?

In 2007 I failed to learn a new programming language, although I dabbled with Objective-C and Cocoa. 2008 will be the year of Python (with a smattering of PHP) for me. There are many places to read more about extending your language knowledge, but I recommend Martin Fowler’s One Language and Improvement Ravine.

Getting WordPress, mod_rewrite and Leopard to work together

December 25, 2007 · Posted in Tech · 3 Comments 

I’ve been trying to get Leopard, Apache 2 and WordPress working together for a while now. I want to use the WordPress friendly URL feature, and this requires the Apache mod_rewrite module to work too. There are various places around the web that have partial solutions to these problems. Here’s the procedure I followed – YMMV

First off, WordPress is installed in /Users/jameshiggs/Sites/blog. Leopard comes with Apache 2.2 installed, but has PHP disabled by default. To correct this, go to the console and change directory to /etc/apache2 and open httpd.conf in your favourite editor. For me this means typing:

sudo mate httpd.conf

You’ll probably have to enter your admin password. Find the line that reads:

#LoadModule php5_module libexec/apache2/libphp5.so

and uncomment it so that it looks like this:

LoadModule php5_module libexec/apache2/libphp5.so

Next, we need to make sure that your user directory allows .htaccess rules. To do this, create a file called jameshiggs.conf (obviously, you’ll need to replace my user name with yours) in /etc/apache2/users. The contents of that file should read:

<Directory "/Users/jameshiggs/Sites">
	Options Indexes MultiViews
	AllowOverride All
	Order allow,deny
	Allow from all
</Directory>

Again, you’ll need to replace my user name with yours.

The final piece of the jigsaw is to configure WordPress to use friendly URLs – which you do from the Options > Permalinks page. I’ve selected the second option which makes URLs look like this: http://localhost/~jameshiggs/blog/2007/12/25/sample-post/. If WordPress can write to the site root then it will automatically create the .htaccess file. If not, you’ll need to create it yourself in the root of your blog site. On my machine, the file should look like this:

<IfModule mod_rewrite.c>
	Options +FollowSymLinks
	RewriteEngine On
	RewriteBase /~jameshiggs/blog/
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule . /~jameshiggs/blog/index.php [L]
</IfModule>

Finally, you need to restart Apache – the easiest way to do that is to go to System Preferences > Sharing panel and untick Web Sharing. Once Apache has stopped, tick it again and Apache should start up. And that’s it.

Let me know if you have any variants to this procedure.

Thanks to Bagelturf and Ariadoss for hints that helped me get this running.