The Evolution of WordPress 1.3

Matt writes about the WordPress 1.3 code cleanup efforts. He notes that instead of rewriting big chunks of code, we are gradually refactoring and improving the code. Rewriting is always a mistake, and Matt cites the now classic case of the consequences of rewriting, Netscape. Over the course of my career, I’ve suffered through several rewrites. These are usually instigated by engineering, typically a few overly enthusiastic engineers, who want to toss out the old and move to the current language or paradigm of the month. Several years later, we’re back to where we started.

1.3 is taking the gradual, directed evolution approach rather than the punctuated equilibrium or catastrophic extinction approaches. We’re improving the current gene stock, not creating a new species. If WordPress 1.3 and WordPress 1.2 were to hook up at a club and go home together, their efforts could result in viable offspring.

The cleanup effort has been primarly focused on better encapsulation, reduction of global variable usage, and reusability. To that end, the query code has been moved off into a WP_Query class. This class is the driving force behind the post loop and the template redirection.

Much of the post manipulation code has been consolidated into functions-post.php. Functions like wp_insert_post(), wp_update_post(), wp_delete_post(), and wp_new_comment() help eliminate the previous code duplication and improve maintainability.

A big benefit of all of this is that WordPress 1.3 will be significantly smaller than 1.2 while offering several new features and many nice improvements. Removing code is a very satisfying activity. It feels so healthy.