principles:keep_it_simple_stupid
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
principles:keep_it_simple_stupid [2021-09-02 10:43] – old revision restored (2021-05-19 10:25) 65.21.179.175 | principles:keep_it_simple_stupid [2021-10-20 21:09] (current) – +++ restored and merged +++ christian | ||
---|---|---|---|
Line 6: | Line 6: | ||
* KISS may also mean "Keep it short and simple", | * KISS may also mean "Keep it short and simple", | ||
- | **Remarks**: | + | **Remarks**: |
Line 15: | Line 15: | ||
* [[contexts: | * [[contexts: | ||
* [[contexts: | * [[contexts: | ||
+ | |||
===== Principle Statement ===== | ===== Principle Statement ===== | ||
Line 24: | Line 25: | ||
The KISS principle is about striving for simplicity. Modern programming languages, frameworks and APIs have powerful means to create sophisticated solutions for various kinds of problems. Sometimes developers might feel tempted to write " | The KISS principle is about striving for simplicity. Modern programming languages, frameworks and APIs have powerful means to create sophisticated solutions for various kinds of problems. Sometimes developers might feel tempted to write " | ||
- | A solution that follows the KISS principle might look boring or even " | + | A solution that follows the KISS principle might look boring or even " |
- | + | ||
- | This does not mean that features like inheritance and polymorphism should not be used at all. Rather they should only be used when they are necessary or there is some substantial advantage in using them. | + | |
+ | This does not mean that features like inheritance and polymorphism should not be used at all. Rather they should only be used when they are necessary or there is some substantial advantage. | ||
===== Rationale ===== | ===== Rationale ===== | ||
- | A simpler solution is better than a complex one because simple solutions are easier to maintain. This includes increased readability, | + | A simpler solution is better than a complex one because simple solutions are easier to maintain. This includes increased readability, |
+ | |||
+ | The advantage of simplicity is even more significant when the person who maintains the software is not the one who once wrote it. The maintainer might also be less familiar with sophisticated programming language features. So simple and stupid programs are easier to maintain because the maintainer needs less time to understand them and is less likely to introduce further defects. | ||
+ | |||
+ | One reason to create more complex code is to make it more flexible to accommodate further requirements. But one cannot know how to make it flexible or if that flexibility will be ever needed. | ||
+ | |||
+ | "When you make your code more flexible or sophisticated than it needs to be, you over-engineer it. Some do this because they believe they know their system' | ||
- | The advantage of simplicity | + | Another reason to create more complex code is to make optimizations. An optimized code is a more complex code. Pareto principle applies |
+ | "Three rules of optimization": | ||
===== Strategies ===== | ===== Strategies ===== | ||
- | This is a very general principle so there is a large variety of possible strategies to adhere more to this principle largely depending on the given design problem: | + | This is a very general principle, so there is a large variety of possible strategies to adhere more to this principle largely depending on the given design problem: |
* Avoid inheritance, | * Avoid inheritance, | ||
- | * Avoid low-level optimization of algorithms especially when involving Assembler, bit-operations, | + | * Avoid low-level optimization of algorithms, especially when involving Assembler, bit-operations, |
* Use simple brute-force solutions instead of complicated algorithms. Slower algorithms will work in the first place. | * Use simple brute-force solutions instead of complicated algorithms. Slower algorithms will work in the first place. | ||
* Avoid numerous classes and methods as well as large code blocks (see [[More Is More Complex]]) | * Avoid numerous classes and methods as well as large code blocks (see [[More Is More Complex]]) | ||
Line 73: | Line 80: | ||
The following hypotheses can be stated: | The following hypotheses can be stated: | ||
- Simpler solutions are faster to implement. | - Simpler solutions are faster to implement. | ||
- | - Simpler solutions yield less implementation faults (which reduces testing effort). | + | - Simpler solutions yield fewer implementation faults (which reduces testing effort). |
- Simpler solutions are easier to maintain, i.e. detecting and correcting defects is more effective and efficient. | - Simpler solutions are easier to maintain, i.e. detecting and correcting defects is more effective and efficient. | ||
- | - Simpler solutions yield more reliable software, i.e. less defects show up after releasing the software. | + | - Simpler solutions yield more reliable software, i.e. fewer defects show up after releasing the software. |
All these hypotheses can be examined with respect to different complexity metrics. | All these hypotheses can be examined with respect to different complexity metrics. | ||
- | Hypothesis 1 can be regarded | + | Hypothesis 1 is true by definition. If the solution cannot be implemented |
- | Though hypotheses 2 and 3 are not true by definition but they can be regarded intuitively clear. Nevertheless there is some research. In ((Virginia R. Gibson and James A. Senn: // | + | Though hypotheses 2 and 3 are not true by definition but they can be regarded intuitively clear. Nevertheless, there is some research. In ((Virginia R. Gibson and James A. Senn: // |
- | Furthermore software cost estimation techniques are partly based on complexity judgments((Barry W. Boehm: //Software Engineering Economics//, | + | Furthermore, software cost estimation techniques are partly based on complexity judgments((Barry W. Boehm: //Software Engineering Economics//, |
- | Lastly hypothesis 4 is likely to be false. Several studies relating complexity metrics and post-release reliability show that module size in lines of code predicts reliability at least as good as the McCabe metric (also called cyclomatic complexity) ((see Albert Endres, Dieter Rombach: //A Handbook of Software and Systems Engineering//, | + | Lastly, hypothesis 4 is likely to be false. Several studies relating complexity metrics and post-release reliability show that module size in lines of code predicts reliability at least as good as the McCabe metric (also called cyclomatic complexity) ((see Albert Endres, Dieter Rombach: //A Handbook of Software and Systems Engineering//, |
Line 103: | Line 110: | ||
Note that many principles are contrary to KISS. This means that it is worthwhile to consider KISS when considering one of those. Nevertheless this does not mean that this is true the other way around. When considering KISS, one wouldn' | Note that many principles are contrary to KISS. This means that it is worthwhile to consider KISS when considering one of those. Nevertheless this does not mean that this is true the other way around. When considering KISS, one wouldn' | ||
- | * **[[Generalization Principle]] (GP)**: This is the directly converse principle. A solution that is generally applicable typically is not simple anymore. | + | * **[[Generalization Principle]] (GP)**: This is the directly converse principle. A generally applicable |
* **[[Murphy' | * **[[Murphy' | ||
- | * [[Model Principle]] (MP): There are often simpler ways to build a software system than to model and mirror the real world behavior, which frequently means having more objects and more complicated structures. Nevertheless it is advisable to do so anyway. | + | * [[Model Principle]] (MP): There are often simpler ways to build a software system than to model and mirror the real-world behavior, which frequently means having more objects and more complicated structures. Nevertheless, it is advisable to do so anyway. |
==== Complementary Principles ==== | ==== Complementary Principles ==== |
principles/keep_it_simple_stupid.txt · Last modified: 2021-10-20 21:09 by christian