In past blogs we have discussed architectural frameworks and techniques to help improve the reliability and maintainability of our solutions such as the Onion Architecture, Data persistence frameworks, Inversion of Control with Dependency Injection and many other software engineering techniques which help us build and design robust, maintainable and efficient solutions. Today we're going to discuss another aspect of our project life cycle which is equally important to the tools we use to build the actual project itself; Version Control Systems also known as Revision Control Systems. A version control system tracks changes to a file or folder and allows the retrieval of any particular revision of the file at a later stage sometimes known as a 'rollback'. In simple terms a Revision Control Systems stores a number of versions of the same file/folder allowing us to retrieve any required version at any point in time. Useful don't you think? There are mainly three types of Version Control Systems which are commonly used in the industry, each with their own benefits. In this blog we're going to discuss the three different types including their respective advantages and disadvantages.
Local Version Control Systems
In a local version control system, files are simply copied into a separate directory locally. Versions of the same file are stored so as to allow the easy retrieval of any particular version at any point in time. This system is commonly used for small personal projects or files as it provides the facility of versioning your project in an easy manner locally.
Advantages:
- Easy to set up
- Cheap to run
Disadvantages:
- Error prone
- Unsafe (stored locally)
- Not suitable for team projects
Centralized Version Control Systems (CVCS)
If you're working within a team and 2 or more members are working on the same project then you will most likely want the most recent changes committed to the project by other team members to be reflected in your version of the project whenever you wish. A Centralized Version Control system allows for the 'main' version of the project to be stored in one centralized location where each team member can 'check-out' any specific version of the project. After updating the required changes on the project, each member can the 'check-in' the changes back to the centralized repository and the new updates are made available to the rest of the team as explained in the diagram below:
Advantages:
- Reasonably easy to set up
- Various options (proprietary and open source)
- Allows for file sharings amongst team members
- Project is stored on a more reliable server (possibly cloud)
- Admin can control the use and structure of the repository
Disadvantages:
- Single point of failure (if server fails then changes will not be available)
- File conflicts due to updates from different people
Some available popular tools include SubVersion, Team Foundation Server, Perforce and Clear Case.
Distributed Version Control Systems (DVCS)
Distributed Version Control Systems aim at solving one of the disadvantages present in the Centralized VCS systems by allowing each and every 'check-out' version to act as a repository source to all other members working on the same project. Whilst this may be more complex to organise as a process, it has the advantage of being more reliable and less dependent on a single central repository. In a distributed VCS, user's don't just check out a version of the file but fully mirror the repository and take a back-up of all the versions available for all the files.
Advantages:
- Reliable (everyone has a copy of all versions)
- Allows for file share amongst team members
- Various Options available
Disadvantages
- More complex to use/set up
- Heavy on Local Storage
Some available popular Distributed Version Control Systems include GIT, Mercurial and Bazaar.
That's all from me for today. I hope I gave you a clearer idea of which version control system does what and how does it do it. Understanding the three main types of Version Control Systems and how they work might help you or your team make a decision on which system suits you best. In future blogs I will explain in more detail some of the most popular free version control systems out there and how you can easily start versioning your code in a few simple steps.
Thank you for reading.
Shaun