principles:murphy_s_law
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:murphy_s_law [2021-09-02 10:43] – old revision restored (2021-05-11 22:12) 65.21.179.175 | principles:murphy_s_law [2021-09-02 14:01] – old revision restored (2021-09-02 10:22) 65.21.179.175 | ||
---|---|---|---|
Line 78: | Line 78: | ||
==== Complementary Principles ==== | ==== Complementary Principles ==== | ||
- | * **[[Fail Fast]] (FF)**: Sometimes it is impossible to actually prevent an error. In such a case it is advisable to fail fast so the error is recognized early. | + | * **[[Fail Fast]] (FF)**: Sometimes it is impossible to actually prevent an error. In such a case it is advisable to fail fast to the mistake |
Line 146: | Line 146: | ||
Note that the typecast is rather a symptom than the actual problem here. The problem is, that the '' | Note that the typecast is rather a symptom than the actual problem here. The problem is, that the '' | ||
- | ==== Example 3: Date, Mutability/ | ||
- | |||
- | In Java the classes [[http:// | ||
- | |||
- | <code java> | ||
- | Date date1 = new Date(2013, 01, 16); | ||
- | Date date2 = date1; | ||
- | System.out.println(date1); | ||
- | System.out.println(date2); | ||
- | date1.setMonth(2); | ||
- | System.out.println(date1); | ||
- | System.out.println(date2); | ||
- | </ | ||
- | |||
- | Furthermore as can be seen in the code above, the month value counterintuitively is zero-based, which results in 1 meaning February. This obviously is another source for mistakes. | ||
- | |||
- | Because of these and several other flaws in the design of the Java date API, most of the methods in '' | ||
===== Description Status ===== | ===== Description Status ===== |
principles/murphy_s_law.txt · Last modified: 2021-10-20 21:18 by christian