Version control has a love-hate relationship with most developers. Regardless, it is safe to say most developers will agree with that version control is important for any complex software. There are numerous benefits to using version control that outweighs the negatives.
So you might be wondering what exactly is version control. Version control is a way to keep track of different versions of files and the source code to a software project. It coordinates the work of multiple developers to allow each developer to work on the same set of files. At its core, the goal of version control is to help manage the source code of your software project.
Anyways, now that you have an idea of what is version control, let’s get to the reasons why you might want to use it.
Mistakes Will Happen
We’re human and human makes mistake. Have you ever deleted a file or a few lines of code by mistake? Have you ever clicked on the wrong option from a computer dialog and immediately realized that you didn’t mean to do that?
In development, mistakes like such can happen and it can put your progress to a halt. Wouldn’t it be nice if you can undo the deletion of some files caused by a typo with the ‘*’ character in your command line? Guess what, with version control, you can. You can load the files back from the last state you have in version control. Disaster adverted thanks to version control.
Speeds up Development
Yes, initially using version control is going to slow you down. You need to learn and become good with version control and that takes time. The time-saving aspect comes after you become proficient with the version control of your choice.
Development in Parallel
Version control allows development of multiple features in parallel. Each developer can work on a different feature and then combine the results at the end. This even applies to a single file. This sure beats taking turn modifying a file in shared storage or passing a USB drive around.
Bug Fixing and Bug Hunting
Bug fixing is another area that benefits from version control. Suppose the new version of the software broke some existing features. With version control, you can see exactly which files were modified since the last version. This allows you to pinpoint where the issue is coming from faster.
Review History of Code
How many times have you commented out some code on the off chance that you might need it in the future? Instead, what probably end up happening is that the code is left commented out and made it to another developer. The developer sees the commented out code and uncomments it because it looks like it belongs there. Later down the line, some new issues appear and the cause turns out to be those lines of uncommented code.
The situation from above might seem silly and extreme, but it does happen to a lesser degree. Every time you leave commented out code, you are contributing to technical debt. Version control is the remedy to this problem (the commenting code out part). It keeps a history of all the changes to each file, so that means you can check the history instead of commenting out blocks of code.
Multiple Versions of Code
Have you ever gotten an idea and want to experiment with it, but afraid that you will break everything? With version control, you can carry out your experiment worry-free. If things go south, you can always revert back to the state before you began experimenting.
Here is another situation when version control comes in handy. Let’s say there was a bug in production software, but you are already working on a new feature for the next release. Then the bug for the production software gets a fix by another developer. Wouldn’t it be nice to also apply that fix to the version you are developing the new feature on? With version control, you can apply the fix without losing your progress on the new feature.
Do I Really Need Version Control? I Am a Solo Developer
Even if you are the only developer, the benefit of version control is there. Ask yourself these simple questions:
- Do you make mistakes?
- Do you write perfect bug-free code all the time?
- Did you find yourself making a copy of a code file before modifying it?
If you said “yes” to any of the questions, then that is a reason to use version control.
Software Development Is One of the Few Things That You Can Work Your Butt off to Be in a More Worst State
Depending on how much experience you have in developing software, reading the section title probably have you nodding your head or scratching your head.
Sometimes in development, you will hit a fork in a road. There are multiple routes available each with their own pros and cons. The deadline is nearing and the project is way behind, so you decide on a path without looking too in-depth into each option. As you keep developing, you realized that you made a big mistake with your choice and reached a dead end. Wouldn’t it be nice to be able to go back to that point at the fork right before you made your decision?
With version control, putting yourself back to the point right before you make a critical decision is possible. Version control brings you back to the fork in the road and you can try another route. Maybe that one might hit a dead end too — unless you have a crystal ball you can’t know for sure. But what you do know is that if you do hit another dead end, you can go back and try again.
At the end of the day, it does not matter too much which version control you choose to use. Pick one and use it and repeat until you find the right one for you.
What are your experiences with version control? What made you began using version control?
To stay in touch, follow me on Twitter, leave a comment, or send me an email at steven@brightdevelopers.com.