User Tools

Site Tools


principles:murphy_s_law

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
principles:murphy_s_law [2021-10-20 21:12] – old revision restored (2020-04-24 14:39) christianprinciples:murphy_s_law [2021-10-20 21:18] (current) – +++ restored and merged +++ christian
Line 19: Line 19:
 ===== Description ===== ===== Description =====
  
-Although often cited like that, Murphy's Law actually is not a fatalistic comment stating "that life is unfair". Rather it is (or at least can be seen as) an engineering advice to design everything in a way that avoids wrong usage. This applies to everything that is engineered in some way and in particular also to all kinds of [[glossary:modules]], (user) interfaces and systems.+Although often cited like that, Murphy's Law actually is not a fatalistic comment stating "that life is unfair". Rather it is (or at least can be seen as) engineering advice to design everything in a way that avoids wrong usage. This applies to everything that is engineered in some way and in particular also to all kinds of [[glossary:modules]], (user) interfaces and systems.
  
-Ideally an incorrect usage is strictly impossible. For example this is the case when the compiler will stop with an error if a certain mistake is made. And in case of user interface design, a design is better when the user cannot make incorrect inputs as the given controls won't let him.+Ideallyincorrect usage is strictly impossible. For examplethis is the case when the compiler will stop with an error if a certain mistake is made. And in the case of user interface design, a design is better when the user cannot make incorrect inputs as the given controls won't let him.
  
 It is not always possible to design a system in such a way. But as systems are built and used by humans, one should strive for such "fool-proof" designs. It is not always possible to design a system in such a way. But as systems are built and used by humans, one should strive for such "fool-proof" designs.
Line 37: Line 37:
  
 Note that ML does //not// claim that everything constantly fails unless there is no possibility to do so. It simply says that statistically in the long run a system will fail if it can. Note that ML does //not// claim that everything constantly fails unless there is no possibility to do so. It simply says that statistically in the long run a system will fail if it can.
 +
 ===== Strategies ===== ===== Strategies =====
  
Line 60: Line 61:
 ===== Origin ===== ===== Origin =====
  
-The exact wording and who exactly coined the term, remains unknown. Nevertheless it can be stated that its origin is an experiment with a rocket sled conducted by Edward A. Murphy and John Paul Stapp. During this experiment some sensors have been wired incorrectly. A more accurate quote might read something like this: "If there's more than one possible outcome of a job or task, and one of those outcomes will result in disaster or an undesirable consequence, then somebody will do it that way." A more detailed version of the history of the experiment and the law can be found in ((Nick T. Spark: [[http://www.improb.com/airchives/paperair/volume9/v9i5/murphy/murphy0.html|The Fastest Man on Earth]]. In: Annals of Improbable Research)) and Wikipedia.+The exact wording and who exactly coined the term, remains unknown. Neverthelessit can be stated that its origin is an experiment with a rocket sled conducted by Edward A. Murphy and John Paul Stapp. During this experimentsome sensors had been wired incorrectly. A more accurate quote might read something like this: "If there's more than one possible outcome of a job or task, and one of those outcomes will result in disaster or an undesirable consequence, then somebody will do it that way." A more detailed version of the history of the experiment and the law can be found in ((Nick T. Spark: [[http://www.improb.com/airchives/paperair/volume9/v9i5/murphy/murphy0.html|The Fastest Man on Earth]]. In: Annals of Improbable Research)) and Wikipedia.
  
  
Line 68: Line 69:
 /*  * [[wiki:Examined]]*/ /*  * [[wiki:Examined]]*/
  
-  * [[wiki:Accepted]] The principle is widely known and it'validity is assumed. Nevertheless sometimes it is rather used as a kind of joke instead of as design advice. See for example Jargon File: //[[http://www.catb.org/jargon/html/M/Murphys-Law.html|Murphy's Law]]//+  * [[wiki:Accepted]] The principle is widely known and its validity is assumed. Nevertheless sometimes it is rather used as a kind of joke instead of as design advice. See for example Jargon File: //[[http://www.catb.org/jargon/html/M/Murphys-Law.html|Murphy's Law]]//
  
 /*  * [[wiki:Questioned]]*/ /*  * [[wiki:Questioned]]*/
  
 Furthermore every defect in any system is a manifestation of ML. If there is a fault then obviously something went wrong. The correlation between the number of possibilities for introducing defects and the actual defect count can be regarded trivially intuitive. Furthermore every defect in any system is a manifestation of ML. If there is a fault then obviously something went wrong. The correlation between the number of possibilities for introducing defects and the actual defect count can be regarded trivially intuitive.
 +
 ===== Relations to Other Principles ===== ===== Relations to Other Principles =====
  
Line 79: Line 81:
 ==== Specializations ==== ==== Specializations ====
  
-  * [[Don't Repeat Yourself]] (DRY): Duplication is a typical example for error possibilities. In case of a change, all instances of a duplicated piece of information have to be changed accordingly. So there is always the possibility to forget to change one of the duplicates. DRY is the application of ML to duplication.+  * [[Don't Repeat Yourself]] (DRY): Duplication is a typical example of error possibilities. In case of a change, all instances of a duplicated piece of information have to be changed accordingly. So there is always the possibility to forget to change one of the duplicates. DRY is the application of ML to duplication.
   * [[Easy to Use and Hard to Misuse]] (EUHM): Because of ML an interface should be crafted so it is easy to use and hard to misuse. EUHM is the application of ML to interfaces.   * [[Easy to Use and Hard to Misuse]] (EUHM): Because of ML an interface should be crafted so it is easy to use and hard to misuse. EUHM is the application of ML to interfaces.
   * [[Uniformity Principle]] (UP): A typical source of mistakes are differences. If similar things work similarly, they are more understandable. But if there are subtle differences in how things work, it is likely that someone will make the mistake to mix this up.   * [[Uniformity Principle]] (UP): A typical source of mistakes are differences. If similar things work similarly, they are more understandable. But if there are subtle differences in how things work, it is likely that someone will make the mistake to mix this up.
Line 86: Line 88:
 ==== Contrary Principles ==== ==== Contrary Principles ====
  
-  * **[[Keep It Simple Stupid]] (KISS)**: On the one hand a simpler design is less prone to implementation errors. In this aspect KISS is similar to ML. On the other hand it is sometimes more complicated to make a design "fool-proof" so usage and maintenance mistakes are prevented. In this aspect KISS is rather a contrary principle. Both applies at the same time so a tradeoff has to be made whether correct implementation or correct usage and maintenance are more important in the given case. This means, it is necessary to consider KISS in addition to ML in order to find a suitable compromise. See [[#example 1: parameters]].+  * **[[Keep It Simple Stupid]] (KISS)**: On the one hand a simpler design is less prone to implementation errors. In this aspectKISS is similar to ML. On the other handit is sometimes more complicated to make a design "fool-proof" so usage and maintenance mistakes are prevented. In this aspect KISS is rather a contrary principle. Both apply at the same time so a tradeoff has to be made whether correct implementation or correct usage and maintenance are more important in the given case. This means, it is necessary to consider KISS in addition to ML in order to find a suitable compromise. See [[#example 1: parameters]].
  
 ==== Complementary Principles ==== ==== Complementary Principles ====
Line 116: Line 118:
 replaceAll(String pattern, String replacement) replaceAll(String pattern, String replacement)
 </code> </code>
-This is less error prone. When for example a call to ''replaceFirst()'' is replaced by a call to ''replaceAll()'', one cannot forget to exchange the parameters anymore. This is how is is done in the [[http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceFirst(java.lang.String, java.lang.String)|Java API]].+This is less error prone. When for example a call to ''replaceFirst()'' is replaced by a call to ''replaceAll()'', one cannot forget to exchange the parameters anymore. This is how it is done in the [[http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceFirst(java.lang.String, java.lang.String)|Java API]].
  
 But here still one could mix up the two string parameters. Although this is less likely, as having the substring to look for first is "natural", such a mistake is still possible. An alternative would be the following: But here still one could mix up the two string parameters. Although this is less likely, as having the substring to look for first is "natural", such a mistake is still possible. An alternative would be the following:
principles/murphy_s_law.txt · Last modified: 2021-10-20 21:18 by christian