1. Overview
In this tutorial, we’ll learn about the KISS software design principle.
2. Definition
KISS stands for Keep It Simple, Stupid. This software design principle states that designs, solutions, systems, and products work best if they’re kept simple.
It means we should favor simplicity over complexity and avoid complexity as much as possible.
3. Why Use KISS?
The reasons to follow the KISS principle in our code include the following:
- It makes our code easier to change and maintain in the future
- It makes code easier to read and understand by other developers
- Simple code is easier to test when doing automated testing (like unit testing, integration testing, and so on)
Now that we know why we should follow the KISS principle, let’s find out how to apply it to our programs.
4. How to Apply KISS?
To keep our program as simple as possible, we should:
- Write smaller programs
- Remove the methods and instances in our code that are never used
- Write readable and transparent programs
- Use composition, which helps us reuse existing code
- Use modular programming
We can remember that each class in our code should have only one responsibility. For new jobs, we should create new classes. This is also called the Single Responsibility Principle, one of the SOLID principles of object-oriented design.
5. Summary
In this short article, we learned about the KISS software principle, why we should use it, and how to apply it to our programs.