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:

    Won’t this whole instinct matter bear revision?
    Won’t almost any theory bear revision?
    To err is human, not to, animal.
    Robert Frost (1874–1963)

    every subjective phenomenon is essentially connected with a single point of view, and it seems inevitable that an objective, physical theory will abandon that point of view.
    Thomas Nagel (b. 1938)

    The weakness of the man who, when his theory works out into a flagrant contradiction of the facts, concludes “So much the worse for the facts: let them be altered,” instead of “So much the worse for my theory.”
    George Bernard Shaw (1856–1950)