You should try working on coding projects inside of a virtual machine (VM). It's a practice I started a few months ago when a text editor I liked was only available in Windows. What I found was running a VM for code gave me a kind of "playground" for my projects where I could try some things I may not want bogging down or messing up my main system.
The coding projects I start tend to make a mess on my desktop and documents folder throughout the course of the day. My workflow generally consists of the following:
- Working on an actual, production project involving coding
- Studying / experimenting with new programming methods and languages
- Non-code related work tasks that require the use of my regular Mac apps (Mail, Outlook, Word, etc.)
What started happening was the files for these projects were spilling over to each other and things started haphazardly landing on my desktop, which is a big no-no for me.
Now I keep two separate VMs- one for testing out code and one for actual projects. So now if I start cluttering a desktop, it's not my actual desktop.
Pause the Madness!
This is kind of an OCD thing, but when I shut my computer down at the end of a work day, I must close out all of my applications first. I don't want to boot-up the next morning only to find yesterday's chaos. The exception to this, however, is my code projects.
Here you can see I have quite a few things going on- there's my editing platform, Chrome developer window, file explorer, and Firefox running for standard browsing. But because they're inside of a VM, I can simply pause the whole session before I shut down my machine and resume exactly where I left off.
This is perfect. And it also frees up my main OS apps for other tasks. Since coding can quickly become a creative endeavor, it's important to compartmentalize your workflow. When I get on a roll with a great idea and have to pause for other work, the ability to dive right back in where I left off is paramount.
Too much power?
So now that I shared this amazing secret with you, we'll take a look at the technical aspects of running it all. Here's a breakdown of my rig and how I allocate everything:
13" MacBook Air : Core i7, 8GB of RAM and 512 GB SSD - this is my main workhorse. At my desk, it connects to a 27" 2560x1440 Dell ultrasharp display. The 8GB of RAM is what makes time travel possible... oh wait, that's the flux capacitor. The 8GB of RAM allows me to comfortably run more than one VM at the same time.
Parallels Desktop 11- for running the VMs. I started running Windows XP on a Macbook Pro with VMware Fusion in 2006. After that I moved to Parallels and then back to Fusion and have bounced back and forth almost every year since. They're both great products for running VMs and have such a similar feature set that it pretty much doesn't matter what you use. I'm using Parallels this time around simply because I'm running an early release of Mac OS X and the new version of Parallels that supports it came out first.
Windows 7- still my favorite version of Windows. I use this VM for most coding projects. I edit with Notepad++ which is one of my favorite text editors available. The fact that it's only available on Windows is what got me started down this route in the first place.
Windows 8 (soon to be upgraded to 10)- my secondary VM. I really only boot this guy up when I need to begin a second coding project and I don't want to disturb anything in Windows 7 land. It's also where I get to play around with some Visual Studio projects and tinker with the modern Windows UI.
In both cases above, I allocate 2GB of RAM to each machine. Because I usually only run one at a time, the Mac OS is still left with plenty of RAM for other tasks. And if I do need both at the same time, then that means 4GB goes to VMs and Mac still gets 4GB. I can live with that. I also use Chrome in both systems to compile and debug.
When I first showed this workflow to one of my colleagues, he was puzzled, not understanding why I'd go through the trouble of a VM for essentially what is a text editor. And he's not wrong. If you have a modest system (Windows or Mac) and feel it doesn't need the extra weight of a VM then skip it. There's no reason you can't code without it. But if you find yourself in situations where your projects are quickly becoming overwhelming, it might not hurt to try putting them in their own little sandbox.