Murphy's law is true, deep, and somewhat subtle in its implications. It is a simple statement of tautological fact. By definition if it is something that *can* go wrong, it *must* go wrong eventually.
Note: The misspelling in the image, "If it can go wong", is an authentic example of Murphy's Law in practice, perfectly illustrating the principle itself. Even in a text about preventing errors, an error has crept in, demonstrating that anything that can go wrong, will go wrong. ChatGPT that generated the image confessed that it made the mistake honestly.
Edge Case Probability[edit]
- Consider an event with two edge cases: E1 and E2.
- Let P(E1) and P(E2) represent the probabilities of these edge cases occurring.
- Suppose P(E1) = p and P(E2) = q.
Corner Case Probability[edit]
- A corner case C occurs at the intersection of two or more conditions.
- If the corner case depends on both E1 and E2 happening simultaneously, then:
- Assuming E1 and E2 are independent:
Probability of Edge Cases[edit]
- Let's assume (5% chance) and (5% chance).
- These probabilities might seem low, but they are significant enough to consider in testing.
Probability of Corner Case[edit]
- The probability of the corner case C occurring, given and :
- This is 0.25% chance, much lower than the individual edge cases.
Murphy's Law states that if something can go wrong, it will. Applied to our scenario:
- Edge Cases: Each edge case has a 5% chance of occurring. These are already rare, but still within the realm of expected events.
- Corner Cases: The probability of a corner case is much lower (0.25%). Due to its rarity, it might be overlooked during testing.
Mathematical Picture[edit]
Imagine a grid where:
- The x-axis represents one condition (e.g., E1).
- The y-axis represents another condition (e.g., E2).
Each condition has a small probability of occurrence. The intersection (corner) where both conditions meet has an even smaller probability.
Condition Not Met (¬E2) | Condition Met (E2) | |
---|---|---|
Condition Not Met (¬E1) | Common Scenario | Edge Case (q) |
Condition Met (E1) | Edge Case (p) | Corner Case (p \cdot q) |
Summary[edit]
- Edge Cases: ,
- Corner Case:
Implication[edit]
- While edge cases are relatively rare, corner cases are even rarer.
- According to Murphy's Law, despite the low probabilities, over a large number of trials, even these rare corner cases will eventually occur.
- Because of their rarity, corner cases might not be adequately tested, leading to unexpected failures in real-world scenarios.
This illustration helps in understanding why it's crucial to consider both edge and corner cases during testing and why Murphy's Law suggests that these cases will inevitably manifest over time.
No comments:
Post a Comment