I had the opportunity to sit down with a good friend a few weeks ago (yea, I'm slow on blogging this) and catch up on work and life.  He's a busy guy so at most I might talk to him once every couple weeks on his drive home from work or we'll chat briefly via IM (or using the in-game WoW chat), but that's about it.  We must have sat and talked for almost 4 hours, covering a wide range of topics including outsourcing/offshoring, training, the community, product development along with a few other things.  One item we discussed is the idea of using virtual machines for every day work.  He and I are both surprised when we talk to developers who have either never heard of using virtual machines for development, or those who have heard of it but for whatever reason, choose not to take advantage of it.

Reasons why

Anyone that's ever built up their own development machine knows that it takes forever (or at least feels like it).  Between installing and configuring the OS, Office, developer tools and all the little utilities that make our lives easier, it can easily take a day or more to get a new computer to a point at which we can be productive.  As a consultant, I deal with a variety of clients, each with their own environment. Some are still on .NET 1.1, some are on 2.0, some don’t care (which means whatever is newest), one even has me doing some maintenance work on an old VB6 application and I had a client last year that wanted me to work with a 3rd party CMS product that I'd never heard of.  Since I also like to keep up with some of the cool betas coming out of Microsoft, trying to keep a stable development environment would be next to impossible without the heavy use of virtual machines.

For the last couple of years, instead of cluttering up my primary development machine (my laptop) with various versions of my dev tools, I’ve been using virtual machines to do all of my software development work. When my laptop died in January, I was able to continue working from my desktop machine without having to do anything other than fire up a remote desktop session to connect to one of my many VMs and I was good-to-go.

How I do it

While I know some people love VMWare, I’ve been a big fan of Microsoft Virtual PC and Virtual Server for a few years. Virtual PC is nice for those times when I need to take a VM with me such as speaking at an event or user group, but for the most part, I have a nice beefy server that runs Virtual Server. I currently have seven virtual machines on my server with four running at any given time. My laptop is nothing more than a tool to run Office 2007, my IM client, my twitter client, connect to my VMs using remote desktop and of course, play World of Warcraft. ;-) 

In the whole scheme of things, my server isn't anything special.  In fact, it's a home-built AMD Athlon 64 X2 3800+ with 4GB of RAM running Windows 2003 server.  It's currently got something like 500GB of drive space.  Not only do I run Virtual Server on that system, but I also run Sharepoint, my internal subversion repositories and it's where all our mp3s and pictures live.  To be honest though, up until recently, the mp3s all lived on an old Shuttle box I had laying around.  Even with all of that running on the server, the performance of my VMs isn't bad at all.  In fact, my biggest complaint about working this way is that sometimes the display can suck - for example, if I'm working on a Silverlight app, but that's easy enough to get around.

When I made the decision to start using VMs, I started out with a single Windows XP/sp2 installation that I created using Virtual PC. Before backing that VM up, I made sure all my common utilities were installed including BGInfo from sysinternals, a decent zip utility, FileZilla, GViM and Reflector.  Once I had that base image working, I backed it up. Using a copy of that base VM, I created my first "working" VM.  I installed Visual Studio, SQL Express and tortoisesvn.  Once I had the specific version of those tools I needed installed, I backed that VM up as well.  Keep in mind, going this route requires a lot of disk space, but hey, disk space is cheap, right?  Most virtualization software allows you to reduce the amount of disk space by using "differencing" disks.  This means you start with a base image and new VMs based on that image are only the differences between the base.  I've heard good and bad things about this approach.  The bad includes breaking all your images IF you happen to make a change to the base image *after* you've created new images based on it.

When a new client comes on-board, it's easy enough to copy one of my "base" VMs, rename it and fire it up.  I love being able to work on a client project without affecting any other work I'm doing.  I can easily copy a VM to my laptop if I need to go onsite and I can easily blow away a VM if it becomes unstable.

I know of a few other developers who have gone the virtual route and are from what I've heard, they love it.  What do you think?  Do you have experience developing in VMs?  Do you love it or hate it?  Let me know!