User Tools

Site Tools


principles:easy_to_use_and_hard_to_misuse

This is an old revision of the document!


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)
  • Use consistent naming and models throughout the design (see UP and MP)
  • 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

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

OOD Principle Language
General Principles
ML KISS MIMC DRY GP RoE
Modularization Principles
MP HC ECV
Module Communication Principles
TdA/IE LC DIP
Interface Design Principles
EUHM PLS UP
Internal Module Design Principles
IH/E IAP LSP PSU

Examples

Description Status

Further Reading

principles/easy_to_use_and_hard_to_misuse.1363596278.txt.gz · Last modified: 2013-05-20 12:46 (external edit)