Continuous integration (CI) has stood as one of the core pillars of the movement to agile software development best practices during the past decade.

The many benefits of continuous integration include master software builds, shortened integration periods, superior code quality and the delivery of more dynamic ways of collaboration. This article covers the advancement of new technology to run the CI process and what improvements have led the way to a more agile software development trend in modern coding.

A Lean Overview of Continuous Integration

CI was created with the goal of eliminating the old “big bang integration” practices in which software modules are developed in isolation and integration is postponed until the end of the project - and quite frequently the timing and project cost of the final integration work is deeply underestimated. In order to eradicate this hindrance, many agile development experts have now converted integration into a continuous process. When integrations are performed on a daily basis, the final, uncontrolled big-bang integration will vanish from the modern development process.

The CI process is now a daily practice of software developers worldwide, and an important reason why other best practices such us automated testing have become mainstream throughout the software industry. Figure 1 shows a visual summary of continuous integration.

![Figure 1: A step-by-step visual of continuous integration and how it prevents broken builds.](https://codemag.com/Article/Image/1301111/Fig 1.png)

Here are just a few of the benefits of transitioning to CI:

  •     Builds are now                   real                 artifacts: A new build is created each time new code is added to the mainline and passes all tests; not solely when the developer manually checks in. This process allows new builds to flow until the project is ready to be delivered.
    
  •     Testing automation enters the scene: Automated testing is the best way to check the quality of a build; however proving test automation is worthwhile has always been a challenge for development teams, especially those working on a project basis. Test Driven Development practices result in improved code quality and reduced testing times.
    
  •     Improved team collaboration: With the responsibility of testing and writing test units put in the hands of the software team, code testers and developers are able to work together in collaborative teams instead of against each other.
    
  •     Better reporting tools: Developers can easily identify which tests passed or failed in a given build with CI tools, rather than rely on other reporting mechanisms such as conversations around the water cooler.
    
  •     Version control comes standard: Every CI server relies on version control in order to build and run tests, providing both small and large companies and development teams access to a tool once limited to only large companies or teams. Teams not using version control were easy to find at the end of the last century, but nowadays, even the smallest teams rely on some version control for their daily operations.
    

Continuous Integration Reshaped

Traditional CI was a breakthrough, but it also had several shortcomings:

  • It was reactive: Builds were broken, and then fixed, with a big impact on the delivery of software coding projects that are on time and on budget.
  • Because changes had to be checked in every 30 minutes, software developers were forced to keep larger, more complex tasks (those taking more than 30 minutes) outside the version control platform. With code checked out for days or even weeks, code was often lost and mini big bangs were common during merges.

There have been definite improvements in the underlying technologies of CI since its original introduction, especially in version control. Version control has been through two key evolutionary steps that have impacted the CI process: branching/merging and distributed development.

These two improved features enable the new CI workflow depicted in Figure 2, which solves the shortcomings mentioned above:

![Figure 2: Branching and merging, and distributed development, make the CI workflow possible.](https://codemag.com/Article/Image/1301111/Fig 2.png)

Branches were approached with caution 10 years ago due to the limitations of the old mainstream version control systems. Now, branch creation takes seconds, and merging is a safe, controlled and predictable operation due to improvements in merge-tracking. Of course, a version control with modern merge-tracking and branching is required to implement the workflow depicted above.

Today, branches are the key to enable a more flexible workflow:

  • Each branch is built and tested before it gets merged back into the mainline, reducing or completely eliminating broken builds. Now issues are discovered before the code hits the mainline, keeping it clean and free of errors.
  • Developers have branches designated for individual tasks, also known as “feature branches,” freeing them from the constraints of a single and fully working checkins. With the freedom to check in as often as needed, developers can take full advantage of the version control functionalities in their daily workflow. The old days of taking code outside the version control platform to avoid breaking the build are now over.

Modern Continuous Integration servers, like Atlassian's Bamboo, are able to monitor feature branches - older versions only checked for new commits on the mainline. Once branches are marked as “finished” or arrive to a central server (if distributed version control is involved), the CI server automatically queues the branches to build, test and, if all tests are passed, merge the code. Bamboo, for example, will automatically put feature branches together on an integration branch as long as there are no manual conflicts.

“Branched Continuous Integration” takes advantage of the new generation of CI servers and version control tools (especially DVCSs) to implement a more flexible and effective workflow.

The Impact of Distributed Version Control

Distributed Version Control is an evolution of traditional SCM that lets developers run their own repositories locally, without any connection to the central server. Developers are no longer hindered by slow connection or VPNs and this speeds up the development process.

The move to DVCS has revolutionized the SCM landscape. Since its inception during the last decade, developers have been introduced to an entirely new set of tools and pushed branching and merging to a new level that lets developers - for the first time - work in a more agile way despite disconnected environments.

No longer tied to a single server, teams can structure their development work using many repositories, which pull and push changes and help automate workflow.

The CI workflow takes advantage of DVCS, adding the feature-branch oriented development and the underlying distributed nature of the version control. As the graphic depicts, it is now possible to easily “push” changes to an integration server which will detect and test new branches.

Conclusion

Continuous Integration continues to evolve at a fast pace thanks to the evolution of integration servers and the underlying version control systems, greatly improving the release frequency and overall project stability.

Teams need to adapt to the new development workflows and tools to get the best out of a trend that has shaped the software development industry during the last fifteen years.