CVS Starter Guide: Why?
Why Use Version Control?
Before I explain the ins and outs of version control, permit me to tell you a little story about Joe.
Joe is a MUF programmer. On one particularly beautiful morning, the birds are chirping, the sun is shining, and Joe sits down at the keyboard and sees in the request queue:
"When I forage, it says 'You see some berries GREEN^growing here."
Joe says to himself: "Ah, that seems like a quick and easy fix, just a little typo where the ^ is missing on the color tag. I'll just go change that real quick."
Joe edits the program and while he's in the file, he notices that with a little adjustment, he could make the program a little better. So after changing GREEN^ to ^GREEN^, he dives into to make the improvement he thought of while looking for the typo.
An hour later, he's done with his changes, and he goes outside to enjoy the beautiful weather.
Except...Joe missed something. The programs are complex, they cover many different situations, and its easy to miss a case or two. Not too long after Joe goes outside, everyone starts discovering that they can't forage any more. Narnians are starving, mothers are wringing their hands, the planets are falling out of the orbit...okay maybe that last is an exaggeration--but not to the players.
Now it happens that Alice is on, and knows her stuff, so she looks at the forage program. Unfortunately, she can't tell easily from the program where things are going wrong--and spends the next couple of hours narrowing down where the problem is. Eventually, Alice is able to fix the program, but not without wasting a great deal of her time.
That's a developer's life without version control. Now consider a second version of the story, this time with version control:
Joe is a MUF programmer. On one particularly beautiful morning, the birds are chirping, the sun is shining, and Joe sits down at the keyboard and sees in the request queue:
"When I forage, it says 'You see some berries GREEN^growing here."
Joe says to himself: "Ah, that seems like a quick and easy fix, just a little typo where the ^ is missing on the color tag. I'll just go change that real quick."
First, Joe "checks out" a copy of the program from the repository. Or if he happens to have a copy, he first performs an "update" to make sure he has the latest version of the file.
Joe edits the program and while he's in the file, he notices that with a little adjustment, he could make the program a little better. So after changing GREEN^ to ^GREEN^, he "commits" his change to the repository--saving his change to the repository.
Then he dives into to make the improvement he thought of while looking for the typo.
An hour later, he's done with his changes, he commits them, and he goes outside to enjoy the beautiful weather.
Except...Joe missed something. The programs are complex, they cover many different situations, and its easy to miss a case or two. Not too long after Joe goes outside, everyone starts discovering that they can't forage any more. Narnians are starving, mothers are wringing their hands, the planets are falling out of the orbit...okay maybe that last is an exaggeration--but not to the players.
Now it happens that Alice is on, and knows her stuff, so she looks at the forage program. Unfortunately, she can't tell easily from the program where things are going wrong. But the version control system comes to her rescue. Each time Joe did a "commit" the system made note of the changes. Alice asks the system to compare the current version to the earlier version. She can clearly see what Joe changed. She spends perhaps thirty minutes examining it and covering the situation that Joe missed. Narnians are relieved that the drought was so brief and all is well again.
One might argue there'd be no problem at all if Joe anticipated the situation he missed. But the very nature of programming is that there's going to be stuff we don't anticipate. Programs will have to debugged and corrected. Its just the way it goes. So we employ tools that make that process easier--version control is one of those tools.
In case you're not sold on the idea yet, here's another brief scenario:
That same day, after Alice fixed the problem, Feaelin gets up and decides to clean up some old database items that are of no value. He determines that A Cow(#2669) should be recycled. He merrily types: @rec #2669 and presses 'y' almost automatically out of habit.
Except...Feaelin had actually typed: @rec #2996. and press y without really looking. And it just so happens the forage program's reference is #2996...
In the scenario without version control, Joe spent an hour working on the program, Alice spent two debugging it afterwards...and Feaelin just deleted it entirely. Their three hours of work today and many others gone in an instant.
Now it might be possible that either Alice or Joe has a copy on their computer, or that it can be pulled out of backups, etc. Who knows which version of it we'll end up with. We could end up re-uploading the one with the typo in it, or maybe one from 2 years ago. Who knows.
But with version control, we simply check the program out of the repository and upload it to the server. Easy-peasy. And we'll be confident that its the very latest one. yay!
- Login to post comments