Topics
Version Control

Version Control

Writing application programs is an iterative process. After writing a program and compiling it must be tested by running it on a computer. Even though compilation may have been successful, indicating there were no syntax errors when it runs on a computer. There may be errors in the logic, which the compiler will not catch, or it is possible that after observing the output, the requirements may change.

The programs then have to be modified, recompiled, and tested again, and this process is repeated until everything works as expected.

With a small set of simple programs, the developer can keep track of these changes. But when the applications are complex and comprise many programs, all working together, it is not easy to keep track of all changes manually. Changes to one program in the set may cause another program to fail. Or multiple developers may be working on the same program and may overwrite each other's code.

Version control is a general approach to track changes in any digital data that changes over time. For example, when authoring documents, such as manuals or forms, each updated document is assigned a version number, so you know which is the latest or can refer back to prior versions.

Version control in software development is a lot more complex since the impact of using incorrect versions is high and can cause applications to fail. There are dedicated programs, known as version control systems that help developers maintain control of their program versions.

A version control system helps a software development team manage changes to source code over time by keeping track of every modification to the code. If an error is made while coding is hard to fix; however, developers can retrieve and compare the current version of the code to earlier versions of the code to solve the error. Sometimes, the changes cause the application to work incorrectly, but also enable developers to "roll back" to the last working version and start freshly rather than wasting essential time in fixing the errors.

While maintaining versions is a valuable feature for an individual developer, a version control system adds even more value to a development team. In a team, multiple developers may make changes to the same code file. Version control software alerts the developers of such conflicts. In some cases, it also prevents or automatically resolves the conflicts.

Software teams that do not use any form of version control often run into problems, like not knowing which changes that have been made are available for users or the creation of incompatible changes between two unrelated workpieces that must then be painstakingly untangled and reworked.

Version control generally follows the steps:

  • Check-In:
    Developers upload or push completed versions of their code into the version control system. It is referred to as a check-in. A project or a related set of files is pushed onto the repository for that project.

  • Check Out:
    Developers download or pull a file for editing from the repository. It is referred to as a check-out. When one developer checks out a file, it is locked so that other developers cannot check it out relatively and make changes that may conflict with the other developer's changes. Only when the first developer checks the file back in, while other developers check it out for editing.

  • Label:
    Every check-in can be labeled with a description - usually a summary of the changes checked in. At a later stage, developers know which check-in was for what reason.

  • Branch and Merge:
    This is a complex approach where two streams of development on the same set of code can proceed in parallel (in what are known as branches), and then at a logical point both branches are merged (generally manually). Conflict Resolution: Despite check-in and check-out controls, multiple developers may make changes to the same file. When uploading them to the version control system, it can alert the developers and even highlight the changes allowing them to choose changes to keep.

While it is possible to develop software without using other version control, doing so subjects the project to a huge risk that no professional team would be advised to accept. So, the question is not whether to use version control but which version control system to use. Git is a very popular version control tool, and GitHub is a cloud-based platform built around Git that needs no installation or configuration and can be used from your web browser.

A simplified view of the basic steps in a version control process is shown below:

Version Control Process