I just bought a new computer. For the first time in ages I didn’t feel like spending hours deciding which parts I wanted, so I went for a big brand PC. Of course it came with Windows 7 installed.
Like any self-respecting geek, the first thing I did was… to install Starcraft. No problem there.
The second thing was to install Ubuntu. Then things started to get hairy. I could reboot to Windows once. Then the Master Boot Record. In case you don’t know, the MBR is a very important part of your disk that tells it what to boot. I was stuck.
Time for google. Fortunately I came across this page. It basically says “Some programs write to the MBR, overriding Grub 2’s boot code”. It then goes on to explain how booting from another drive (not an option for me), using LILO or reverting to Legacy Grub. The last one worked for me.
The Point of the Story
Anyway that got me thinking about a golden rule of software development : keep your code where it belongs! (Most likely, it does not belong to the boot sector.)
I can’t remember how many times I saw software fail because someone decided it seems to be a good idea to modify the internals of a framework/platform and commit it. Then the day comes when you want to use a new feature – and all hell breaks loose.
There is always a better option. If you think your project is different, think again. 99.9% of the time you’re wrong. If you think you’re in the .1% – so does everybody else. Otherwise you end up with an unbootable PC, a Tomcat that cannot render .jsp (yeah I saw that) or an application that is stuck with an obsolete, unmaintained version of a library that you can’t get rid of.
Keep your code out of the framework. You’ll stay sane a lot longer.