Web Development Environment

During 2008 I spent most of my time doing web development. There was some Java, PHP and Python, but most of my time was spent working in Ruby on Rails. Rails is a lot of fun and (I know this sounds cheesy, but…) it helped me to enjoy doing web development again.

When I’m working in Java I always prefer to use JetBrains’ excellent IntelliJ IDEA. However, this past year I didn’t have a license for IntelliJ. I tried every free IDE I could find and wound up choosing Eclipse. I’ve used Eclipse periodically over the last several years. I don’t really like it but I dislike it less than the other free alternatives.

My work was completely server-side and didn’t involve developing a database component. Most of my development was done on OS X but I was deploying to Ubuntu so I did work there also. I used maven to build, test and deploy. I’m not a unit-test fanatic but, in this case unit testing was invaluable.

Java Development

My setup for both PHP and Python is the same. When I’m working on Mac I use either TextMate or vim. I haven’t done a great deal of Python work but over the past several years I’ve tried to find a PHP IDE that I like… I’m still looking.

PHP Development

I started out doing my Ruby work using TextMate and Terminal.app. I didn’t have any major complaints. There are some nice plugins and various tricks that are handy. But personally, I prefer an IDE. I’ve heard some people say that IDEs make us lazy. Ok, I’m lazy. But I’m also far more productive when I have a good IDE. When JetBrains started issung beta releases of RubyMine, TextMate was history!

RubyMine’s GUI for easily stepping through code in the debugger is great. The inline code analysis is nice for quickly catching typos and the code completion can be useful too. But for me, the best part about having RubyMine is the navigation and documentation.

When I’m working with other developers (or even with frameworks that I didn’t write), I don’t always know exactly what a method does. Being able to instantly bring up documentation is awesome! If I need more information, I hate wasting time trying to hunt down a method buried in code that I am not familiar with. With one key-stroke RubyMine takes me to the code I’m looking for.

Rails Development

I am definitely a fan of JetBrains’ production. IntelliJ is awesome, RubyMine is awesome, and VisualStudio is just broken without ReSharper. There is certainly a learning curve to these tools but once you’ve memorized the key strokes, the code you need is always right in front of you. And the best part part is that the key bindings are the same across each of JetBrain’s products!

One last application that deserves to be mentioned is Navicat. Navicat is by far the best application that I’ve found for working with MySQL or PostgreSQL. Unfortunately, that’s not saying much. I have spent a lot of time using SQL Server and Microsoft’s related tools and, as far as I can tell, there is nothing for MySQL that is even in the same league.

Don’t misunderstand me. Navicat is a great tool. Allowing me to save connections to different servers with many different login credentials is a lifesaver, especially the ability to tunnel the connections over ssh. Being able to do basic server management via a GUI is nice too. But when I need to design a database, I always turn back to SQL Server Management Studio.

Managing WordPress Updates with Git

WordPress 2.7 was recently released so I started the process of updating the handful of WP instillations that I manage. Git has made this process a breeze! Here’s how I do it.

  • To start a new project, use subversion to download the latest stable release of WordPress
  • Add that entire directory, including the .svn folders, to git. To keep subversion happy, make sure that all of the svn tmp directories are in git (use an empty .gitignore file to force git to add empty directories)
  • Before you make any changes, create a new branch in git called wordpress_base. You should never do anything with this branch other than update the WordPress code from subversion.
  • Switch back to master and change whatever needs changing (e.g. add themes, plugins, etc.). To make upgrades go as smoothly as possible you shouldn’t modify the base WordPress files more than you absolutely have to but, adding themes and plugins should be no problem.
  • When everything is tested and ready to deploy, commit everything to git and push to the webserver

The command line will look something like this:

$ cd ~/Downloads
$ svn co http://svn.automattic.com/wordpress/branches/2.6/ new_blog
$ cd new_blog
$ git init
$ git add .
$ git commit -m "Import WordPress 2.6"
$ git branch wordpress_base
## Get the site completely setup, commit everything to git and
## push everything up to the server.

When you’re ready to update WordPress:

  • Checkout the wordpress_base branch
  • Either ‘svn up’ or ‘svn switch’ to get the newest code
  • Check all of the changes in to git
  • Merge wordpress_base back in to master (I generally rebase then merge)
  • After everything in git has been committed, push, pull or do whatever fits your process to get the updated code from your development machine to the server
  • Don’t forget to upgrade your blog database after the new code has been deployed by going to: http://myblog.com/wp-admin/upgrade.php
$ git checkout wordpress_base
$ svn switch http://svn.automattic.com/wordpress/branches/2.7
$ git add . && git ls-files --deleted | xargs git rm
$ git commit -m "Updated WordPress to version 2.7"
$ git checkout -b integration
$ git rebase master
$ git checkout master
$ git merge integration
$ git branch -d integration
## Make sure all conflicts have been resolved, test the new site and
## update plugins. Commit changes to git and push them to the server.