principles:keep_it_simple_stupid
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
principles:keep_it_simple_stupid [2013-02-06 13:54] – [Contrary Principles] -HC (rather MIMC) christian | principles:keep_it_simple_stupid [2021-09-02 14:03] – old revision restored (2021-05-19 10:25) 65.21.179.175 | ||
---|---|---|---|
Line 12: | Line 12: | ||
* [[contexts: | * [[contexts: | ||
+ | * [[contexts: | ||
+ | * [[contexts: | ||
===== Principle Statement ===== | ===== Principle Statement ===== | ||
Line 46: | Line 47: | ||
* Avoid general solutions needing parameterization. A specific solution will suffice. | * Avoid general solutions needing parameterization. A specific solution will suffice. | ||
* ... | * ... | ||
+ | |||
+ | |||
+ | ===== Caveats ===== | ||
+ | |||
+ | See section [[#contrary principles]]. | ||
Line 52: | Line 58: | ||
The principle was coined by the American engineer Kelly Johnson referring to the requirement that a military aircraft should be repairable with a limited set of tools under combat conditions ((Ben R. Rich: // | The principle was coined by the American engineer Kelly Johnson referring to the requirement that a military aircraft should be repairable with a limited set of tools under combat conditions ((Ben R. Rich: // | ||
- | The principle of striving for simple solutions sometimes is also called "(rule of) simplicity" | + | The principle of striving for simple solutions sometimes is also called "(rule of) simplicity" |
Line 58: | Line 64: | ||
/* Comment out what is not applicable and explain the rest: */ | /* Comment out what is not applicable and explain the rest: */ | ||
/* * [[wiki: | /* * [[wiki: | ||
- | /* * [[wiki:Examined]]*/ | + | /* * [[wiki:Questioned]]*/ |
- | * [[wiki: | ||
- | /* * [[wiki:Questioned]]*/ | + | [[wiki: |
+ | |||
+ | [[wiki:Examined]]: While the preference for simple solutions can be considered trivially intuitive, there has been some work relating simplicity or rather complexity and certain quality attributes. But as there is no universally applicable complexity metric and not even a commonly agreed upon clear definition of simplicity, research is bound to examine certain aspects of KISS independently. | ||
+ | |||
+ | The following hypotheses can be stated: | ||
+ | - Simpler solutions are faster to implement. | ||
+ | - Simpler solutions yield less 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 yield more reliable software, i.e. less defects show up after releasing the software. | ||
+ | |||
+ | All these hypotheses can be examined with respect to different complexity metrics. | ||
+ | |||
+ | Hypothesis 1 can be regarded true by definition. If the solution cannot be implemented fast, it is not simple. | ||
+ | |||
+ | 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//, | ||
+ | |||
+ | 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 92: | Line 115: | ||
- | ===== Example | + | ===== Examples |
- | FIXME | + | ==== Example 1: Fuzzy Simplicity ==== |
+ | Simplicity is a blurry, partly subjective measure. Sometimes it is difficult to tell what is simpler. The following example shows that: | ||
+ | |||
+ | <code java> | ||
+ | public String weekday1(int dayOfWeek) | ||
+ | { | ||
+ | switch (dayOfWeek) | ||
+ | { | ||
+ | case 1: return " | ||
+ | case 2: return " | ||
+ | case 3: return " | ||
+ | case 4: return " | ||
+ | case 5: return " | ||
+ | case 6: return " | ||
+ | case 7: return " | ||
+ | default: throw new IllegalArgumentException(" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | public String weekday2(int dayOfWeek) | ||
+ | { | ||
+ | if ((dayOfWeek < 1) || (dayOfWeek > 7)) | ||
+ | throw new IllegalArgumentException(" | ||
+ | |||
+ | final String[] weekdays = { | ||
+ | " | ||
+ | |||
+ | return weekdays[dayOfWeek-1]; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Both methods do exactly the same thing. They return a string representing the weekday. Just the implementation is different. Both versions may be seen as simpler than the other depending on the view taken. '' | ||
+ | |||
+ | On the other hand '' | ||
+ | |||
+ | So it's not objectively clear which of the two implementations KISS prefers without saying which complexity metric to apply. But this ambiguity is not a problem since principles are not meant to be unambiguous and objective. Eventually a human developer has to decide which solution to implement and the principles only give guidelines. | ||
===== Description Status ===== | ===== Description Status ===== | ||
/* Choose one of the following and comment out the rest: */ | /* Choose one of the following and comment out the rest: */ | ||
Line 109: | Line 167: | ||
* [[http:// | * [[http:// | ||
+ | ===== Discussion ===== | ||
+ | |||
+ | Discuss this wiki article and the principle on the corresponding [[talk: |
principles/keep_it_simple_stupid.txt · Last modified: 2021-10-20 21:09 by christian