Continuous Integration is the next step on our journey to a high performing organization. If you are using version control, then you most likely created a “branch” off the main trunk to make changes to the source code. Essentially you took a copy of the source code and declared that here is where all of your changes were going to be made.
And then, when you’re done, you merge your code back into the trunk so that it is available for everyone to see.
And therein lies the problem. What if you have more than one branch? What if you have five or six branches going at the same time? What is the source of truth for any piece of code? How are changes merged with other changes? The problem is easy to see, but so is the solution: continuous integration.
So, what is “continuous integration”?
Continuous integration is the idea that those branches that you have are short-lived. Very short. Days at most, but less than a day preferably. You continuously put your code back together to reduce the effort required to do it at the end.
Think of it this way. You and five friends are building something out of Lego. You have all of the red bricks while your friends have blue, white, black, yellow and green. Six people and six colours. You are all trying to build the same thing, a castle made of Lego bricks. Since you are the leader of your intrepid band, you pick up the base plate and put down all of the red bricks that you can until, at some point, there is no way to place your red bricks without another colour to help you, so you put down the base plate. Your friend with the blue bricks picks up the base plate and put down all of the blue bricks. But in order to do so he sometimes has to take things apart, put his blue bricks in place and then re-build what he took apart.
White goes next and he follows the same pattern, disassembling where necessary until he has all of the white that can be placed put on the base plate. Then black, then yellow and finally green. It then gets back to you and you can put down more red and so on and so on.
Kind of long and involved isn’t it. Now imagine a slight difference: everyone using the base plate at the same time. People put the bricks that they have, onto the base plate as soon as possible rather than waiting for “their turn”.
That is the difference between having multiple long lived branches and continuous integration: waiting for your turn or working on something at the same time. I’m sure that you can see that working together at the same time allows you to change the shape of the castle as you build it, instead of having to rip out someone else’s work and redoing a chunk of the castle.
Continuous integration fosters a more collaborative environment and allows you to change course quickly with little wasted effort. The old approach, single colour at a time, is more expensive, takes longer, and generally reduces the overall value of the final product.
Continuous Integration is a necessity in the 21st century, not a luxury. If you’re not doing it, why not?