Continuous Integration - Theory

Theory

When embarking on a change, a developer takes a copy of the current code base on which to work. As other developers submit changed code to the source code repository, this copy gradually ceases to reflect the repository code. Not only can the existing code base change, but new code can be added as well as new libraries, and other resources that create dependencies, and potential conflicts.

The longer a branch of code remains checked out, the greater the risk of multiple integration conflicts and failures becomes when it is reintegrated into the main line. When developers submit code to the repository they must first update their code to reflect the changes in the repository since they took their copy. The more changes the repository contains, the more work developers must do before submitting their own changes.

Eventually, the repository may become so different from the developers' baselines that they enter what is sometimes called "integration hell", where the time it takes to integrate exceeds the time it took to make their original changes. In a worst-case scenario, developers may have to discard their changes and completely redo the work.

Continuous integration involves integrating early and often, so as to avoid the pitfalls of "integration hell". The practice aims to reduce rework and thus reduce cost and time.

A complementary practice to CI is that before submitting work, each programmer must do a complete build and run (and pass) all unit tests. Integration tests are usually run automatically on a CI server when it detects a new commit. All programmers should start the day by updating the project from the repository. That way, they will all stay up-to-date.

The rest of this article discusses best practice in how to achieve continuous integration, and how to automate this practice. Build automation is a best practice itself.

Read more about this topic:  Continuous Integration

Famous quotes containing the word theory:

    The struggle for existence holds as much in the intellectual as in the physical world. A theory is a species of thinking, and its right to exist is coextensive with its power of resisting extinction by its rivals.
    Thomas Henry Huxley (1825–95)

    Thus the theory of description matters most.
    It is the theory of the word for those
    For whom the word is the making of the world,
    The buzzing world and lisping firmament.
    Wallace Stevens (1879–1955)

    It makes no sense to say what the objects of a theory are,
    beyond saying how to interpret or reinterpret that theory in another.
    Willard Van Orman Quine (b. 1908)