Continuous Integration
Continuous Integration (CI) in software development is a set of practices and principles that speed up delivery of software projects and increase quality of their deliverables.
Simply put, Continuous Integration takes a lot of mundane and boring things away from the process of software development, while letting developers to concentrate on more enjoyable and creative tasks.
As the name implies, Continuous Integration is about integrating changes to the development project continuously and automatically. These changes usually come in form of modifications and additions to the source code. When we keep them as small as possible and automatically run all checks available (starting from the compilation process and up to the full test routines), we can detect most breaking issues whenever they are introduced. Since the changes are small, it is much easier to isolate and fix the root cause.
Continuous integration helps to achieve this by reducing development friction involved in project integration. This is done with the help of:
- Version Control Systems that allow large and distributed teams to work together on the same project, while sending their code changes (commits) to the central server. Each commit is stored on the server and could be reviewed or reverted.
- Build Automation that is basically about build tools and scripts that allow to start the complete integration build on a local machine with a single mouse-click.
- Unit Tests ensuring that code stays stable through all the changes (this normally comes with the Test-Driven Development practices).
- Code Quality Tests that consistently enforce development guidelines accepted by the team.
- Regular Commits by developers that reduce amount of change involved in every integration.
- Integrating Every Commit (as soon as it comes) on a central server allows to detect any compilation failures or broken tests immediately. Also this is the best way to deal with "but it works on my machine" problem.
- Publishing Integration Results that get created along with the build project might simplify getting feedback from people outside of the development team. Examples of these results are: unit test results, performance metrics, install packages, code quality reports etc.
From my personal experience, Continuous Integration is a must have in any single project that has a lifespan more than 200 human hours.
Here's the most simple example of CI benefits. When you have proper CI routine at hand, updating a customer with the latest fix (if the fix is in the desktop application, for example) is a mere matter of:
- write the code;
- test the code;
- commit the changes to the server, telling it to publish install packages along the way;
- tell customer to install the latest version (or simply restart the application, if you have autoupdate routine in the application).
Behind the scenes will happen:
- backing up a copy of changes;
- running full suite of tests against the entire codebase;
- computing code metrics and performance statistics;
- publishing development reports for the team;
- updating online documentation that is generated from the code;
- building the project and creating a new version of install package;
- creating a backup of this package (along with all the libraries and PDBs);
- putting install package to the deployment server and updating manifest needed for auto-updates;
- notifying all involved parties about the build and results.
Ability to take all this "behind the scenes" routine for granted definitely reduces development friction a bit, allowing to concentrate on more interesting and creative things.
Software Stack for Continuous Integration in .NET:
-
- Subversion (Open Source)
- Git (Open Source)
Unit Testing
- NUnit (Open Source)
- MBUnit (Open Source)
- XUnit (Open Source)
Build Automation
- MSBuild
- NAnt
Continuous Integration Server
- Cruise Control .NET (Open Source)
Code Quality
- Mono Gendarme (Open Source)
- Microsoft FxCop
Related Links:
- 10 Steps To Become Better .NET Developer
- Continuous Integration by Martin Fowler
- Continuous Integration on Wikipedia
- Some integration recipes for the efficient development
- Hunger for the integration builds.
- Recommendations on software and tools for the development
- Organization of xLim solutions: development, svn and integration
- Common development principles for xLim
This article is a part of Software Development Body of Knowledge ABC series. You can subscribe to RSS feed to stay updated.