My Development Environment
For the last two years I have been developing applications by using a virtualized development server as main my development environment. This process has worked out extremely well since a virtualized environment is always accessible, easy to replicate, easy to access, and is able to mimic production down to every last detail.
Since the development server is running on my computer, it’s always available. It does not matter if I am disconnected from the Internet, or the internal network at work, I am always able to access my development server. This is especially nice when taking long flights, because I able to write and test code with no external network dependencies.
Easy to Replicate
Virtual Machines are just files on the hard drive, which means they can easily be copied and shared. The size of the files are roughly the same size as the hard drive size that was chosen during the setup. Giving the development server a smaller hard drive is going to make sharing the environment much easier.
I use an 8gb hard drive for my machines. I find this generally gives me enough space and is easy enough to share. Sharing a development environment comes in handy when the development server takes a while to configure. If the development OS requires a lot of third party software or tweaking before it is able to run any code then saving and reusing the virtual machine will save a ton of time.
I recommend setting up a virtual environment, installing the OS and all of the required services/tweaks. Before you write any code backup the the virtual machine files. This will give you a good base system (restore point) if you ever need to setup the same environment on another computer.
The development environment will running on each developers computer, so developer A can break his environment without affecting any of developer B’s work. This is really nice when it comes to experimenting with operating system and software upgrades.
Easy to Access
Virtualized environments allow you to easily share files between your computer and the virtual machine. This means you can edit your code through your favorite desktop IDE and save it right to your development environment without having to move or transfer the files. This makes accessing your project or code repositories really easy from any virtual machine installed on your computer.
You can also share folders by using Samba, SSHFS, or FTP. However, those services are generally a lot slower and require some sort of configuration.
Being able to have your development mimic your production environment is a must. It eliminates bugs, makes testing more effective, and makes coding a lot easier. Virtual machines are a great way to have your development environment be an exact replica of your production server. You can setup your development machine to have the same OS/PHP/MySQL/Apache/etc versions as production.
I have a Macbook Pro laptop, a Windows desktop, and an Ubuntu desktop that I write code from. Without virtualization I would never be able to code from all three of these machines. Some of the projects that I have worked on have deep dependencies (down to the OS version). Even with a pretty universal language like PHP you would be surprised to learn the number of functions/extensions that only work on certain operating systems. Using a virtual development environment instantly solves these problems.
One project per Machine
Aside from hard drive space, there is no limit to the number of virtual machines you can have. Most applications, especially web apps, start out as simple projects with little or no dependencies. However, over time these projects grow and start to rely on a specific database or language version. This creates the need to have each project have its own virtual machine.
I try to develop every project on a virtual machine that closely mimics that project’s production environment. This means a lot of different development environments, which really is not a problem. It’s a good rule to follow and it’s a necessary rule when dealing with complex projects.
I would recommend Oracle’s VirtualBox for running your development environment. It’s free and takes minutes to install, setup, and configure. I also wrote a guide for installing CentOs with VirtualBox.