Sunday, June 23, 2013

A funny case of using the PC

Nowadays I boot into my Windows 7, check my mail and browse some web; then I click on VirtualBox and start Lubuntu to code web application (Python, Flask, Brunch, etc.), where I spent most of the time on. It's funny I spend most of my time in a VM.

Why I am using Windows for the past 10 years

10 years ago I was a desktop developer using VB6, Microsoft C++, and eventually .NET, so Windows is the obvious choice with more than 90% market share.

The the programming work started to shift to web through ASP, ASP.NET, Java and PHP. Though I am using Eclipse to code Java and PHP (Zend Studio), it never cross my mind to shift to Linux as I see no value added benefits.

There are a bunch of Windows only apps which I cannot live without, such as Microsoft Office, Visio, Photoshop, Visual Studio, etc.

Besides, Windows 7 is pretty fast and stable, and the BSOD is pretty much dead.

Why did I start using Linux

I did install a few Linux distros in the past 10 years, but I just couldn't find a compelling reason to use it on a daily basis.

I guess Python, Brunch and Node-related stuff trigger the reason to move to Linux. I started with Python and Brunch on Windows using Eclipse, though it work pretty well. These tools involve a lot of command line at times, and Windows command prompt does look and feel terrible (cygwin doesn't work really well with Python). There are some dependencies for certain libraries or tools (I forgotten which one) which could not be installed on Windows properly (or too messy), most tutorials are on Ubuntu environment, some tools ported late or second-class citizen on Windows (livereload, yeoman, pip, etc.), lack of convenience of apt-get to install various tools and libraries, etc. I guess a combination of these reasons encourage me to move to Linux, and I am actually glad it happened.

Some benefits of Linux includes similar environment as my production environment (less deployment issue), powerful command line means plenty of stuff could be automated through cron and shell, plenty of tutorials to setup various tools and services on Linux (espcially Lubuntu), apt-get and pip (and virtualenvs) allow easy update of various tools and environment.

Lubuntu consume very little resources (could run on 512MB RAM, but more practical with 2G RAM if used as Coding environment), have decent desktop applications for Development (Chrome, Eclipse, Sublime Text), stable and speedy. Though the File Explorer on Lubuntu is a bit sucky.

How did I end up in VirtualBox Linux

At first I was still skeptical about Linux, so I take the safest route of installing one in VirtualBox. I choose the least resource intensive Ubuntu flavor (Lubuntu), assigning it half of the memory (2G out of 4G) and half the processor (i5), and it run decently on most cases. I can't take away more memory from Windows as it would crawl the moment I try to open up some apps on it.

Why not Dual Boot?

I gave this option some thought, and found it too troublesome (and time consuming) to switch between OSes.

Besides, there are some surprising benefits of running a VM:
  • A share folder could be easily created to share files between Host (Windows 7) and Guest (Lubuntu); somehow drag and drop doesn't work on my setup for file transfer.
  • Host and Guest could share the same application/services, e.g. MySql still resides on Windows 7 where Lubuntu can easily connect to it, and I could easily test IE compatibility by connect to Lubuntu test server from my Windows 7
  • Whenever there is a need to run IE or use Microsoft Office, switching back to host (and vice versa) just take a second or two.
  • Easy Backup and Transfer: My Lubuntu VM is about 20G, where I could easily backup the entire environment into an external drive/cloud, or setup my coding environment on another notebook within minutes. Keep the VM small by storing large but non-essential files on the shared drive on the Host, and I put all my essential files (e.g. Code) on a separate virtual disk (the benefit is that I could start another VM if necessary and mount my "Code" virtual disk).
  • Snapshots

Why didn't I ditch Windows totally?

Though I would like to, but I can't at this stage due to a few reasons:

  • Legacy Development Support: I still need to support some application written in VB6 and .NET; sometimes, there is still a need to develop some Windows-based application.
  • Internet Explorer: In Malaysia (my country), IE is the only choice if I need to perform Online Stock Trading (every brokerage use the same ActiveX app developed by the same company), and the same goes with some Online Banking. Besides, I still need IE to testing purpose.
  • Microsoft Office: Though I use Google Apps most of the time, there are just some 100-pages existing documents which I need to edit, where even app like Libre Office would screw up the formatting badly.

Why not put Linux as the Host (and run Windows in VM)?

This sounds like a good idea, as most of the time I am using Linux and occasionally run Windows for special purpose. The downside of the VM is I only get half the memory and CPU most of the time. The downside of not running as VM is I loose the ease of backup the entire VM image and quick portability to another PC.

I don't feel like rocking the boat now on my old notebook (almost 3 years old), but I am constantly on a lookout for a decent notebook which support Linux. Somehow the feeling is Linux notebooks are quite limited in options, but will try to get one.

4G RAM seems a bit "uncomfortable" when running VM, so 8G RAM is quite essential; and SSD is preferred for faster disk IO. 

The Future of VM OS

I wonder about the future where the main OS of a notebook/PC is a VM OS (something like Xen), where we could choose to boot up multiple OSes and communication/sharing between these OS are still possible, and the VM OS doesn't consume too much memory and CPU.