Geeks With Blogs
BlogOfBob Read:Learn:Contribute:Repeat

This is not a new topic for most of us, however there are aspects of using Virtual Machines that are applicable to us as developers and consultants that are not often discussed. As a consultant, when I begin a new project I want to be able to turn over my work and an established proven development environment to the client at the end of the project. With a VM I can give them the exact system I used, with all of the configuration and tooling intact. (Licensing can be a tricky issue so be sure you acquire and use any necessary OS or application licenses from the client up front.)

When I start a new project, especially one of significant size or duration, I usually create a virtual machine to host my development environment and the tools associated with it. I have a number of “base” images that I use to start from, my current crop consists of a Windows XP system, a Vista Business edition (soon to be replaced with a Windows 7 version), a Server 2003 R2 Standard edition system, and a Server 2008 Standard edition system.

I typically keep these systems ‘virgin’ except for updates. The two server VM’s I have provisioned with Application Server roles which installs IIS and all of the supporting files and features since I am primarily a Web developer.

About once a week I start each VM and apply any outstanding OS patches so that the base system is as up to date as possible. I have also created a separate virtual hard drive that I can attach to any of the VM’s in which I keep my current favorite crop of developer tools and addins, my current code snippet library, handy trouble shooting tools and so forth.

These tools are not in an installed state, I keep the installers here, and when one is updated I refresh the installer with the current version. The reason I do this is that sometimes at a client site, I don’t have access to the internet, or I have a very slow connection. Either way, I don’t have to wait to download the tools I need, they are right there.

Development Environment Fail Avoidance

FailboatBy working entirely within a virtual environment I can avoid a lot of the typical gotcha’s that arise from working on multiple technologies. I can keep my development environment clean and focused on just the technologies I am working with on the current project. I don’t have to wonder if an odd behavior or error I am experiencing is related to the fact that my current copy of Visual Studio is crammed full of 3 versions of Silverlight, two versions of Ajax, and several beta’s of the 4.0 framework!

Application Server Environment Fail Avoidance

My server application environment is similarly focused, instead of turning services on and off, changing database logins and settings, and managing ports on IIS to accommodate multiple projects, I can install a nice, clean server environment. Again, since I am turning this environment over to the client at the end of the development effort, I make sure and acquire licenses from the client for everything used.

Bouncing Domain Memberships

One of the hidden benefits of this approach is domain membership. If you have ever joined your own system to a ‘foreign’ domain you know the baggage and issues that can cause. In one case I know a developer that subsequent to joining his system to his clients domain lost administrative access to the system as the default policies applied rebuilt the local administrators group. It’s just cleaner and more straightforward to keep your personal machine separate from your clients network.

Why Not Use a Client Machine?

So why not just get the client to give you a machine to use? Actually I resist that suggestion like the plague and insist on using VM’s unless the client is totally differencingopposed. The benefits you get from using a virtual machine, for both you and the client, far outweigh any objection I have ever heard from a client.

Recover From ‘Oh No’ Moments

The foremost benefit I have seen from experience is the ability to recover the environment to a known point in time. Once I have established a VM base system for a particular project I enable differencing hard disks, or snapshots. All VM systems have some form of this feature. What it allows me to do is take a “picture” of my environment at a specific point in time. So if after installing the latest update to a tool, or a service pack, the environment becomes unstable or unusable, I can “roll back” to a point prior to that event. It takes minutes, not the hours or days rebuilding an environment usually takes. I usually take a snapshot at each major milestone or prior to each major change.

Experiment With Freedom

This gives me a huge advantage in being able to experiment with less fear as I know I have a quick easy way to recover from a failed “science experiment” if I need to do so. I can try that service pack or hotfix without worrying if I can recover from a bad result. You can also try that registry hack you read about in a blog post without worrying about never seeing your login screen again! In short you can experiment with relative impunity in a virtual environment.

A side note here, is you can create virtual environments to experiment with beta tools. At this writing I have a virtual environment setup to allow me to experiment with Visual Studio 2010 and SharePoint 2010. I don’t take a chance at corrupting or compromising my primary productivity environment with beta tools and buggy code.

Collaboration

Another benefit that is less than obvious is that if I need to, I can give another developer a complete copy of the environment for them to work on or to help me resolve a problem. Collaboration becomes more effective when all parties are working in the exact same environment. If you encounter a massive issue that is on your critical path it is nice to know that you can get other developers and resources involved, either by sending them a copy of the VM, or enabling remote access to your VM and let others in to assist.

Avoid Vendor Finger Pointing

On at least one occasion I have sent a VM to a vendor to help them diagnose an issue. Their response was that without the VM they would have spent 100’s of hours trying to duplicate the issue. With the VM, their engineers were able to see and experience the issue exactly as I was describing it without having to attempt to reproduce it. They were able to instrument the VM environment with their own test tools and quickly identify and correct the issue. This avoids every developers nightmare of each vendor pointing at another as the source of the issue. You can provide each vendor a copy to work with and take away excuses before they arise. (Be sure your vendor supports their product in a virtual environment first, not all do, and some will use the fact that you are running their product in a virtual machine as the cause of all issues.)

Stay A Step Ahead of Your Client

On several projects, I use my virtual environment to stay a step or two ahead of the actual project. I can experiment with approaches in my own sandbox, get the approach honed to the one I like, and then present that approach cleanly and with less trial and error in front of the client. Which helps minimize confusion and lets you maintain a more professional appearance. If you are a typical developer, you tend to “think with your fingers” meaning you tend to write trial chunks of code to prove out an idea, usually with plenty of failures or not quite right attempts.

Preserve For Posterity

dvd The final advantage I am going to discuss in this post is the ability to cleanly preserve your final result and environment for posterity. You can back a VM up to DVD, or copy it to an external hard drive that is then achieved with a 3rd party or otherwise secured. If 6 months after your project ends, you are called upon to rework or expand on it, or questioned about it, you can produce an exact copy of things as you left them. This avoids the whole issue of who did what, who made what change etc.

You can now approach any issue or question about what you did or did not due with full confidence. You have the evidence and the ability to demonstrate the technical aspects of your project with 100% clarity and conviction.

Having an achieved copy can also help you when you are trying to remember how exactly you solved or approached a specific issue later. I usually archive all deliverable content on the VM image as well. My notes, emails, documents, presentations, diagrams, graphics etc, get placed in a folder on the systems hard drive image. I even keep copies of timesheets, and contracts, statements of work, everything related to the project, all in one place.

On another DVD I keep a copy of the virtual machine software itself, that way I have a better chance of recovering the environment farther down the road if I need to. We all know that software keeps being updated and backwards compatibility is not always as good as we would like.

Typically after 5 years, it is no longer necessary to go back and look, by that time everything will have moved far enough from where you were that there is little to no value to retaining copies in an accessible manner like this. At that point I would discard the backups after retrieving anything I still valued from them.

In conclusion, Virtual Machines are a great way to keep your environment focused on the task at hand. They are not the solution for everything however. Complicated projects may require multiple systems, web servers, application servers, and other systems. They are an effective solution for single purpose development efforts. And of course, not every application is certified to work in a virtual environment. But where possible I strongly advocate the use of this approach to development. It has made my life considerably easier than it would be otherwise.

Posted on Saturday, February 20, 2010 11:50 AM | Back to top


Comments on this post: Virtual Machines for Consultants and Developers

# re: Virtual Machines for Consultants and Developers
Requesting Gravatar...
With VMware Update Manager, you can patch those machines up automagically without having to worry about bringing them up. VUM takes care of it for you...

Great blog post!
Left by Matt kenigson on Feb 23, 2010 5:41 PM

# re: Virtual Machines for Consultants and Developers
Requesting Gravatar...
That is a feature I have recently become familiar with, and to really appreciate. One of my clients recently implemented VMWare to replace almost all of their physical servers. Including the SharePoint farms I am now working on.

They are very happy with the results! My confusion, as a consultant, is I can never figure out from the VMWare website, what version of which product I can download to accomplish the same things I do with Virtual Box. I can also never seem to understand what the licensing requirements are, e.g. which license can I use for "free" and what are the limits to that license as a developer etc.

But I love the product! For true enterprise wide deployments it stands alone!

Thanks for the comment!

Cheers,

Bob Porter
Left by Robert Porter on Feb 23, 2010 6:44 PM

# re: Virtual Machines for Consultants and Developers
Requesting Gravatar...
Very good explanation, I've been doing this for quite a few years, except there are some inherit issues with virtual machines as well. No matter what, they are a little slower than their physical counter parts. You have to be very careful with snapshots too as accidentally deleting the wrong can cause havoc and no simple restore like "previous version". Also, if you work on desktop and laptop, syncing files becomes harder as syncing the entire vm is very cumbersome, unless you do all your work on a laptop.

But otherwise, I wouldn't trade working any other way. Although I do not like working on laptops full time and have had many problems trying to copy VM's from one PC to another.
Left by Aleksey Malishkin on Jan 16, 2011 4:30 AM

Your comment:
 (will show your gravatar)


Copyright © Bob Porter | Powered by: GeeksWithBlogs.net