Software Design Principles

Information hiding.

"We propose instead that one begins with a list of difficult design decisions or design decisions which are likely to change. Each module is then designed to hide such a decision from the others." - On the Criteria To Be Used in Decomposing Systems into Modules. D. L. Parnas, 1972.

Information hiding is related to other principles:

  • Separation of Concerns. Different aspects are considered separately. On the role of scientfic thought. Edsger W. Dijkstra, 1974.

  • Cohesion. Degree to which elements of a module belong together. Structured design. Stevens, Myers, and Constantine, 1974.

  • Coupling. Degree of dependence between modules. Structured design. Stevens, Myers, and Constantine, 1974.

  • Orthogonality. Features are mutually independent, well separated. Adriaan van Wijngaarden et al., 1968.

  • Protected variation pattern. Identify points of predicted variation and create stable interfaces around them. Alistair Cockburn, 1996.

  • Single responsibility principle. A class should have only one responsibility/reason to change. Robert C. Martin, 2005.

  • Open closed principle. A module is open for extension and closed for use by other modules. Bertrand Meyer, 1988.

Don't Repeat Yourself (DRY)

"Every piece of knowledge must have a single, unambiguous, authoritative representation withing a system." - The Pragmatic Programmer. Andrew Hunt, David Thomas, 1999.

"Most people take DRY to mean you shouldn't duplicate code. That's not its intention. The idea behind DRY is far grander than that. DRY says that every piece of system knowledge should have one authoritative, unambiguous representation. Every piece of knowledge in the development of something should have a single representation. A system's knowledge is far broader than just its code. It refers to database schemas, test plans, the build system, even documentation." - Orthogonality and the DRY Principle. Dave Thomas

DRY is related to the abstraction principle: "Each significant piece of functionality in a program should be implemented in just one place in the source code. Where similar functions are carried out by distinct pieces of code, it is generally beneficial to combine them into one by abstracting out the varying parts." - Types and Programming Languages. Benjamin C. Pierce.

But see also "Duplication is far cheaper than the wrong abstraction" (at 14:50) - All the Little Things. Sandy Metz

Keep it Simple Stupid (KISS)

"It seems that perfection is attained not when there is nothing more to add, but when there is nothing more to remove." - Terre des Hommes, Antoine de Saint Exupéry.

"Simplicity is prerequisite for reliability." - How do we tell truths that might hurt? Edsger W. Dijkstra

Simple Made Easy - Rich Hickey

Principle of Least Astonishment

"An important principle of human engineering for usability, which for computer systems means designing to make them easy to set up, easy to use, easy to program, and easy to maintain, is the principle of least astonishment. People are part of the system. The design should match the user's experience, expectations, and mental models" - Principles of Computer System Design. Jerome H. Saltzer, M. Frans Kaashoek

Conceptual Integrity can be one way to achieve less astonishment.


Related: