Agile development is widely adopted because it’s mantra of providing quality software in less time. It’s seems to be a win-win situation, usually when you put emphasize on quality you spend more time on testing and making sure that everything is working as expected. So question is how come Agile can provide you double triumph i.e. less time and more quality?
Agile achieve this efficiency by introducing better processes and practices. Continuous Integration is one of those best practices.
What is Continuous Integration?
As name suggests “Continuous Integration” is all about integrating code to the trunk/main-line as soon as new code gets ready to be merged.
As a programmer have you ever been in a situation when you integrate your code to main line (trunk) and it failed with ton of errors? It’s a very common situation, particularly in a team where multiple programmer are working on same code and you check out code for a longer period of time and check in your code back to the main-line considering your code will not clash with other programmer’s changes. In reality project code is much inter-connected, many people using same base classes and database connections, common objects etc. When situation like these occurs you may spend hours and hours to fix the dependencies and error caused during between your check-out and check-in.
To avoid the impact of such situations, you can integrate code frequently, by committing early you find out the code differences early as well and you don’t have to spend much time to resolve the code conflicts. By integrating and building code for every single change made to the code help to improve the quality of the code and finds error as soon as it occurs.
To understand the Continuous Integration, you must know the concept of Version Control System. CI process updates the current version of Version control system, the current version is also called Trunk. To know more about version control system Click Here
How it works: Following steps show how CI works.
1- Check-in code from trunk.
2- Make the changes in your local copy.
3- Run the unit tests locally.
4- Run a local build.
5- Check if the local copy after changes matches with the Trunk? If it does not match merge the updated code from Trunk to local copy, and repeat step 3-5.
6- Commit, i.e. merge your code with the copy of mainline.
7- Build the code. It can be done on a build server.
8- Run test on the server.
9- Deploy code to the server.
In above steps you only move to next step when current step is successful.
What happen if two programmers make changes to the same code?
When multiple developers work on same code, it is not uncommon that first developer makes changes to the code and merges it to main line. After some time second developer also make changes which make the build failed. In such situations it’s responsibility of second programmer to find out the dependencies and conflict in the code and make changes to the code with consensus with other programmers to make the build successful.
Is Continuous Integration must be adopted to run an Agile project?
No. The continuous integration is one of the many best practices of Agile development, and It’s evident that it’s usage helps to reduce possibility of bigger problem which could occur if code is not integrated frequently. But it is not necessary to adopt CI to run an Agile project. Over the years we have seen many successful Agile projects where CI was not adopted.
What is integration machine?
Integration machine or integration server is a separate server which is used to run a build of the newly added code to the trunk. Code from the version control system can be copied to integration server manually and once copied a build is run.
Author: Mobeen Siddiqui, Provides Agile coaching services in Minnesota, particularly in greater Minneapolis area.