Further to the previous point, the only way to
avoid “ghost code” – that which only you can see
on your local machine – is to get it into VCS early and often
and don’t spare the horses. Addressing the issues from the
previous point is one thing the early and often approach achieves,
but here’ a few others which can make a significant
difference to the way you work:
Every committed revision gives you a rollback
position. If you screw up fundamentally (don’t lie, we all
do!), are you rolling back one hour of changes or one week?
The risk of a merge nightmare increases
dramatically with time. Merging is never fun. Ever. When
you’ve not committed code for days and you suddenly realise
you’ve got 50 conflicts with other people's changes,
you’re not going to be a happy camper.
It forces you to isolate features into discrete
units of work. Let’s say you’ve got a 3 man day
feature to build. Oftentimes people won’t commit until the
end of that period because they’re trying to build the whole
box and dice into one logical unit. Of course a task as large as
this is inevitably comprised of smaller, discrete functions and
committing frequently forces you to identify each of these, build
them one by one and commit them to VCS.
When you work this way, your commit history
inevitably starts to resemble a semi-regular pattern of multiple
commits each work day. Of course it’s not always going to be
a consistent pattern, there are times we stop and refactor or go
through testing phases or any other manner of perfectly legitimate
activities which interrupt the normal development cycle.
However, when I see an individual – and
particularly an entire project – where I know we should be in
a normal development cycle and there are entire days or even
multiple days where nothing is happening, I get very worried.
I’m worried because as per the previous point, no measurable
work has been done but I’m also worried because it usually
means something is wrong. Often development is happening in a very
“boil the ocean” sort of way (i.e. trying to do
everything at once) or absolutely nothing of value is happening at
all because people are stuck on a problem. Either way, something is
wrong and source control is waving a big red flag to let you
know.