What Does "Continous Integration" Mean?
Tags: devops, agile
Published: 2022-06-27 08:16:42

Have you ever heard of "Continuous Integration" but wondering what it means?

This article is for you.

Continuous Integration is one of the top [technical terms](https://techwithmaddy.com/top-10-technical-terms-every-software-engineer-should-know#heading-10-ci-cd) that (in my humble opinion) a software engineer should know.

I'll explain in simple terms what Continuous Integration means. Hopefully, by the end of the article, you'll clearly understand why we need Continuous integration in software engineering.

Let's start.

#### WHAT IS CONTINUOUS INTEGRATION?

Let's take the following scenario:

> We have three software engineers in a medium-sized company, all working and contributing towards one big project, each implementing different features. They initially work on a local branch and commit their changes at least daily. 


![three-software-engineers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c8bye2835n2cwmasacjs.jpg)

What happens when they push their code?

Here is where Continuous Integration comes into play.

> Continuous integration is a DevOps software development practice where developers regularly merge their code changes into a central repository, after which automated builds and tests are run. [Amazon Web Services](https://aws.amazon.com/devops/continuous-integration/)


![continuous-integration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/854h5bwzxgnd6vqh7i7k.jpg)

Before you push your changes to the remote repository, run your tests locally. If any tests fail, address the failing tests before pushing your changes remotely.

Once all tests pass on your local machine, you're ready to push your changes remotely.

When you push your changes remotely:

1. A CI Server detects any changes made by the engineers.
2. If there are any changes, the CI Server looks for the most recent source code version and starts executing the build script.
3. Once the build is generated, the CI Server validates all the test cases and assesses the quality of the code.
4. Then, the CI Server gives you feedback via email. 
5. If the build fails, the CI Server informs the team. Team members read the message to understand where the issue is, fix the problem and integrate the changes back to the remote repository.
6. Then we start again from step 1 until the build shows that the changes integrate successfully and tests all pass.

Continuous integration helps engineers reduce risks by giving them feedback about their code. The purpose of Continuous Integration is to help identify and fix any errors faster.

Continuous integration promotes collaboration among team members and more efficient problem-solving. It also improves the process of delivering a project.

Continuous integration requires the team to:

1. Fix all problems and avoid checking in broken code.
2. Ensure enough tests cover happy and unhappy paths and that they're all passing.
3. Avoid checking in code when the build fails.
4. Be more responsible and accountable for their code.

#### WHAT HAPPENS WHEN THE BUILD IS SUCCESSFUL?

If the build is successful, the code can be released to production (meaning that the changes will be released to the end-users). The practice of moving code to production is known as [Continuous Delivery](https://continuousdelivery.com/).

#### WHAT ARE THE BENEFITS OF CONTINUOUS INTEGRATION?

1. It's easier to detect and address bugs.
2. Reduce merge conflicts.
3. You can release software more frequently.
4. Better code quality.
5. Rapid feedback, thanks to the CI Server.

![aws-benefits-of-continuous-integration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e531erolxct9xqew6fm8.jpg)
[***Amazon Web Services - What Is Continuous Integration***](https://aws.amazon.com/devops/continuous-integration/#:~:text=The%20key%20goals%20of%20continuous,and%20release%20new%20software%20updates.)

#### WHY DO WE NEED CONTINUOUS INTEGRATION?

We need Continuous integration because it allows software teams to catch bugs more rapidly. Since the CI Server checks the code's quality, the software released to production will be of higher quality. Continuous integration makes it easier to release more features to the end-users.

**CONCLUSION**

In this article, you've learned about Continuous Integration, what it means and why it's important to know as a software engineer.

I hope you've found this article helpful.

Do you practice Continuous Integration in your workplace? Do you use any Continuous Integration tools? Let me know in the comments.

Until next time!

**FURTHER READING:**

- [Software Engineering Series](https://techwithmaddy.com/series/software-engineering)

**ADDITIONAL RESOURCES:**
- [Martin Fowler: Continuous Integration](https://www.martinfowler.com/articles/continuousIntegration.html#BenefitsOfContinuousIntegration)

- [JetBrains: What Are The Benefits of CI/CD?](https://www.jetbrains.com/teamcity/ci-cd-guide/benefits-of-ci-cd/)