— Software Engineering, Version Control System — 4 min read
Okay, here's a question and you need to answer it honestly!
Have you ever created multiple folders like v1
, v2
, v3
, v4-final
, v5-final-final
, v7-last-final
, v7-updated-last-final
for your project and ended up deleting and updating wrong files every other time?
Well, I have, and it was seriously horrible.
But what were we trying to do in the first place?
Trying to mess up? Come On, No!
We were trying to keep track of different versions of our project, with utmost honesty and creativity.
And if this interests you, Version Control Systems would be good to know about.
VERSION CONTROL is nothing but CONTROLLING THE VERSIONS of something.
Okay, imagine playing a game of chess with your friend. You both are in the middle of a game, but due to some reasons, you need to leave. Now, what's something you would do to continue the game in the future?
Take a picture right?
You would just capture the chessboard, come back later, set up the pieces, and continue with the game again, with no hassle.
So, what did you just do by capturing that image?
Made sure your friend doesn't cheat? Well yes, why not!
But you also ensured that your game was safe and you could come back to it later, whenever needed.
And that's what a VCS does too, it records the changes in your files over time so you can recall previous versions later on.
Every change is recorded by VCS, along with the metadata, such as who changed it, why they changed it, what was the issue, etc. Just like that chessboard image on your phone, it has all the metadata too, like when the picture taken, what's the size of the image, etc.
Now, the files need not be Source Code files only, they can vary from graphic design images, web design layouts, text documents, or any piece of information.
A VCS gives you the independence of going back to a file, see who did the change and why, the exact timestamp of when the change was made, to easily recover if you messed up with the current version.
We will learn about 3 kinds of VCS -
In earlier times, when there were no systems such as Git, developers used to track versions by copying files into multiple directories. Yes, just like v1
, v2
, v3
, and so on.
Whenever they wanted to make a change, they used to copy all the old files in a new directory, update the files there, and updated the version number accordingly.
The advantage is that it is really simple.
But the disadvantages are
Centralized VCS was introduced to make developers work in a collaborative way.
Two actions are required to make your changes visible to others
Some famous Centralized VCS are Subversion and Perforce.
The advantages of CVCS
However, the biggest disadvantages of CVCS is
This disadvantage was the reason that Distributed VCS was developed.
In DVCS, the client doesn't just pull/checkout the latest version of the code but mirrors the entire repository, including its full history.
This prevents the fear of SPOF since anytime the server dies, any of the client's repositories could be used to recover it.
Actions required to make your changes visible to others
Some famous Distributed VCS are Git and Mercurial.
Advantages of DVCS
There aren't any disadvantages to using a DVCS as compared to CVCS honestly. But in general
If you liked the write-up, leave your feedback and suggestions :)