Have you moved all your programming tools into virtual machines yet?
Your compiler (or interpreter), your editor, your source code control system and your build system are to you what a scalpel and other medical instruments are to a surgeon. They are delicate and precise tools for use in a delicate and precise profession.
Would a doctor perform surgery in the men's restroom at New York's Grand Central Station?
No. So, why should you, a software developer, perform your work in the midst of the infected chaos of your physical machine's operating system, wielding your compiler upon source files which lay along side MP3 music files and a trial installation of the latest first-person shooting game?
Instead, create a virtual machine image using VMware Workstation or Microsoft Virtual PC and install your favorite OS and tools inside it. Each virtual machine image is like a surgical operating theater for programming.
What are the benefits?
1. A sterile file system. And a sterile operating system.
I'm writing this article inside a virtual machine. There is a C: drive with four subdirectories: C:\Documents and Settings, C:\Program Files, C:\Windows and C:\www. C:\www contains my website. The other three are Windows itself. No fumbling through C++ source code or receipts for something that I bought over the Internet. That stuff is in other virtual machines.
Look at my Start menu. Macromedia Dreamweaver, a clip art collection and a zillion browsers to test against. No fumbling through money management or DVD burning software.
2. Each virtual machine customized to support a specific operation.
One virtual image has Microsoft Visual C++ 2005 with all my network client and source code client software so it is perfectly geared for me to access and work on the C++ source code for my company, SQLAware Corporation. A completely separate virtual image has Macromedia Dreamweaver with a zillion browsers for development and testing the commercial web site and Dan on Everything Else. Another image for managing the server firewall. Another image for testing server restoration. An entire team of virtual machines for testing various databases with our commercial software.
3. Totally portable. Ready anywhere.
The virtual machines, including the hard disks, are completely self-contained in a single directory. All the hard disk data, the configuration of the virtual machine and everything else. It's all in one directory.
If I buy a new PC, I simply copy that one directory to the new PC and I'm done. Going on a trip and want to take my laptop? I simply copy that directory from my desktop PC to the laptop PC.
4. Totally backup-able.
When I make a backup copy of the virtual machine directory, I'm not just saving the data. I'm saving the machine configuration and the way the development applications and environment are set up. As well as the data.
When I restore, I'm ready to run within an hour. On any hardware. Anywhere.
5. Push virtual machines to new developers.
When a new software developer joins my company, he doesn't mess around for a week, installing, accessing, compiling. He gets a virtual machine image. The image has his entire development environment, source already downloaded, compiled and working, capable of securely burrowing through our corporate firewall and attaching to our local network from anywhere in the world. Ready to work.
6. Try new things without breaking old things. Like a time machine.
I use virtual machine snapshots to allow me to return to the past when the virtual machine was in a useful state. When I want to try out a new development tool, I use a snapshot to go back to a virgin operating system install, try the tool and then return to my latest state. What if I contemplate a risky upgrade? Take a snapshot and then do the upgrade. If it works, I do nothing. If it doesn't, I restore the virtual machine to the snapshot. Nobody gets hurt.
7. Suspend at any time. While compiling. Or installing.
With a virtual machine, you can suspend it at any time. Don't want to wait for it to finish compiling? Just suspend it. In the middle of debugging? Suspend it. Tired of a long install? Suspend it. Whatever it is, you can call a timeout by suspending the machine. No need to shutdown at the end of a long day. Or get back to a “safe” state to crash in, just in case that you lose power.
There are a few caveats, though:
1. Virtual machines run somewhat slower than real machines.
VMware Inc., maker of the VMware Workstation virtual machine software, claims that virtual machines run 80% or more as fast as real machines.1
2. It can 30 seconds or more for virtual machines to fully resume after being suspended.
When you are resuming a virtual machine, it has to read the entire memory of the suspended virtual machine from disk and return the virtual machine to a running state. That takes time. Not for the “instant gratification” generation.
3. A single physical hard disk corruption can ruin your whole virtual machine.
The files and the containing directory for your virtual machine require every single byte to be correct. If a single one is corrupt, your virtual machine is damaged. You can't recover data from your virtual disk if the real disk is damaged. Everything is in those files. So, back up always and often.
The VDE, the Virtual Development Environment, is the way of the future.

Cast away your Laudanum and leeches.
E-mail Dan Howard about this article

