Everything You Need To Know About Source Code Management

Source code management is an important concept for software developers. There is a lot to know about it, from the basics and what it is, to more advanced topics like branching. Learn all you need to know about source code management here.

What Is Source Code Management?

Source code management is the concept of storing the source code for your software applications in a centralised, managed place. It’s used by software development teams, who are the ones that gain the most benefit from it due to the multiple developers they have. Freelance or solo software developers should also use some form of source code management.

The main people involved in source code management are the developers or programmers. They are the ones that are working on the code, making changes, adding features and requirements. The source code is a product of their work and it needs to be managed in some way.

Testers are also main users of source code. When they are required to test applications or features, they benefit from a source code management system and process, as it ensures they are working with accurate code and helps the team run better.

Benefits Of Source Code Management

There are several reasons why we should manage the source code that we write:

  • Work together in teams. A source code management system allows multiple developers to access and change different areas of the code, without interfering with each other’s work. This is a big benefit for large teams of developers.
  • Version history. The system will keep a history of all saved changes to the code. This not only allows you to see what has changed in a file, but allows you to go back to a previous version if needed.
  • Generate release notes. Code can be linked to a release, and as a result, release notes can be generated. This means time is saved in generating it manually and searching for the changes.
  • Backup of code. A centralised place on a server where the source code is stored ensures there is a main location for the code (other than the developer’s machine). It also allows for easy backup of the code, depending on your server setup.

How Does Source Code Management Work?

The process works by a development team or company having a centralised server that stores all of the required code. This server is called the repository – the storage place for code. It can run various source code management systems, which are used to manage changes and different projects.

The system stores a copy of the source code as individual files, just like the developers have written it. When you want to make changes to some code, you perform what’s called a “check out” on the file. You get your own copy of the file in your environment. It also creates a “lock” on the file on the server, which means others can’t check out the same piece of code. This is to minimise the chances of someone overwriting your work.

Once you’ve made the changes, and tested them, you can save them onto the server using a process called “commit” or “check in”. This saves your code onto the server, replacing the existing file, and incrementing the version. It also removes the lock that was placed previously. You can usually add comments to this process, which allows you to specify what was changed.

This can all be done by different developers on different files. The source code management system will store this code and manage the changes that have been made.

What Terminology Is Used?

Some of the key terms used in this process include:

  • Check out – gets a writeable copy of the code for a single developer
  • Check in – saves the code that has been checked out back into the system, removing any locks placed on it.
  • Commit – same as “check in”, just a different term.
  • Branch – a different version of some code, created from an earlier release, separate to the main version. Similar to a “tree branch” metaphor – branches out from a certain point to form its own line.
  • Merge – combining two or more sets of code together, perhaps as a result of a branch. This process is performed by the source control management system when you need it to.
  • Repository – the server and system used to store the source code.

Tools and Systems

There are many different options for source code management tools and systems. I’ve listed a few of them here:

  • Subversion – an open source system run by Apache. Also known as “SVN”, it’s one of the most popular source code management tools available.
  • Git – created by the founder of Linux, Linus Torvalds, Git is a distributed source control system and is relatively new to the industry. It’s fast, efficient, and becoming quite popular.
  • Mercurial – similar system to Git, and has also been built with performance in mind. It is designed for larger software systems, and is considered easier to use than Git.
  • TFS (Team Foundation Server) – TFS is a Microsoft product that is used as a source code management system. It’s an alternative to tools such as Subversion, and has good integration with other Microsoft products such as SQL Server.
  • VSS (Visual Source Safe) – VSS is another Microsoft-developed product, and is suited to smaller software projects. It has been widely criticised for many issues, including corruption of files and stability.
  • CVS (Concurrent Versions System) – CVS is one of the oldest source code management systems. It’s still widely used in many IT departments, but the general belief is that the competition is better and there is no use for CVS in modern development environments.

What’s The Best Source Code Management System?

This is a tough question to ask, as it depends on your requirements for features and personal preference.