Tuesday, 3 July 2012

Source control

Source control is probably the single most important tool for developers today. Sure, modern IDEs are nice and helpful, static analysys gives you great insight, code completion saves time. But source cotrol saves lives.

I could do without ReSharper, I'd suffer but I could do it. I could (and often do) go back to notepad. And yet I can't even imagine working without source control.

Ever seen something like this?

This is what we used to do. Comment out the code but leave it in "just-in-case". So you can revert back if something goes wrong. Eh?

Not anymore you don't. There's no need. Delete the line, refactor that method, rename that file. Just keep commiting those changes and leave meaningful commit messages. But that's not even the best part!

Annexation comes in two flavors. A free, ad supported version and a paid version (trial). Now the two versions are very close but do have important differences:
  • Ad supported version has bunch of external dlls for ad controls
  • Trial version checks in with the Marketplace for status
  • Ad supported version shows ads instead of current scores
  • Trial version has some limitation and a buy button
  • ...
You could develop both versions in parallel - using two separate directories and lots of copying and pasting. But using a modern SCMS makes this easy. I use Mercurial.

You can branch your projects. There's a default branch for the free version and a trial branch for the paid version of Annexation. You can work on either one by a click of the mouse.

And what if you need to fix a bug on both versions? It's simple. You don't even need to use the command line. Fix it on either version, export the patch and import it to the other branch.

Could you ever go back to commenting out code sections and keeping underscore-prefixed versions of files again?

No comments:

Post a Comment