Could your Source Control software be affecting the quality of your code?
Source Control software is used to store your project’s Source Code in a way in which team members can collaborate on the code, and see clearly which version is the most up to date. However, we believe there are types of Source Control software that do this in a more effective way than others.
The best way to look at the different types of Source Control software is in the style of a grid, as below:
|Source Control Software||LMU|
(Lock, Modify, Unlock)
(Copy, Modify, Merge)
(Centralised Version Control System)
|Eg. SourceSafe||Eg. Subversion|
(Distributed Version Control System)
A CVCS (Centralised Version Control System) has one central library where all the code files are stored and accessed by everyone in the team. There are two different types of CVCS:
An LMU (Lock, Modify, Unlock) System
As the name suggests, this system allows a user to access a file and ‘lock’ it so that only they are able to modify it. Then, when they are finished editing the file, they ‘unlock’ it so that it is accessible to others once again.
This seems like the most intuitive, simple solution to ensure there is one, up-to-date version of the file; therefore decreasing the risk of multiple branches of the same file. However, there are some serious downfalls with this method:
- ‘Locking’ the file blocks other team members from accessing it, which means there is no way to collaborate on the code. We believe collaboration is extremely important as it means experience and knowledge can be shared and pooled together to find a solution faster.
- There are security issues; what if someone locks a file but then goes off work sick without unlocking it? This is a huge barrier to productivity.
- There are often technical problems with this type of system, as the files are easy to corrupt.
- Quality can be compromised, as being ‘locked out’ of a file might encourage engineers to solve issues in different ways or save code to different places. They might end up settling with the second-best solution, rather than the first.
A CMM (Copy, Modify, Merge) System
This type of system will make a copy of a file, rather than lock it, which solves the issue of blocking other people from working on it. Several developers can modify a file at once, and instruct a ‘Merge’ when they are finished. This will combine all their edits into one, up-to-date version.
But what happens if two developers have edited the same line of code? Merge Conflicts. These errors take a while to fix, and can slow down productivity. It adds a whole extra step to the work.
These CVCSs, working with one centralised file library, produce another problem. We believe that, because everyone is able to view all the files and see what everyone is working on at the same time, people are less likely to get creative.
It stops developers from experimenting with different solutions, which is a key process in problem solving, as what they write can be seen by others and might interfere with other peoples’ edits.
A DVCS (Distributed Version Control System)
This creativity issue is where we believe DVCSs such as Git come in as superior. Here’s why:
- DVCSs create local libraries on each team member’s computer, where they can create their own branches and versions privately, allowing them to experiment and explore different solutions. Then, they can share their final version with the rest of the team. This encourages creativity to find the best solution.
- Operations are faster because of the repositories being stored on individual machines, rather than all running off the same server
- Again, due to having local libraries, if the internet becomes unavailable, developers can continue work
- The flexibility of having branches in tools like Git means you can accommodate any code sharing hierarchy you can imagine
With the flexibility, reliability and creativity solutions that DVCSs like Git provide, we believe it is the best type of Source Control system to use if you are serious about quality.