principles:easy_to_use_and_hard_to_misuse
This is an old revision of the document!
Table of Contents
Easy To Use And Hard To Misuse (EUHM)
Variants and Alternative Names
Context
Principle Statement
A module shall be easy to use and hard to misuse.
Description
Rationale
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:
- Make use of static typing, so the compiler will report faults
- Make the interface simple, so there will be fewer usage defects (see KISS)
- Use the same mechanisms wherever reasonably possible (see UP)
- Avoid Preconditions (see Invariant Avoidance Principle)
- …
Caveats
See section contrary principles.
Origin
Evidence
Relations to Other Principles
Generalizations
- Murphy's Law (ML): 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.
Specializations
- Principle of Least Surprise (PLS): A module is easy to use if there is no surprise in how it works.
Contrary Principles
- Keep It Simple Stupid (KISS): Both principles, KISS and EUHM, are about simplicity. But while EUHM is about the simplicity of an interface, KISS is rather concerned with simplicity of the implementation. KISS is contrary in those cases where the solution which is easier to implement is not so easy to use or imposes further possibilities for misuse.
Complementary Principles
- Model Principle (MP): An interface that is crafted according to the model is easier to use than one that is not.
- Invariant Avoidance Principle (IAP): One reason for a possible misuse of a module is an invariant. For example there might be a method which takes a list and an index where the index has to be within the bounds of the list. Each of these invariants imposes further possibilities for misuse of the module. So it is better to avoid them.
- Information Hiding/Encapsulation (IH/E): A module should be properly encapsulated in order to make it easy to use and hard to misuse.
Principle Collections
Example
Description Status
Further Reading
principles/easy_to_use_and_hard_to_misuse.1634105969.txt.gz · Last modified: 2021-10-13 08:19 by 194.209.25.108