principles:don_t_repeat_yourself
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| principles:don_t_repeat_yourself [2025-08-28 07:00] – created hildegardlahey6 | principles:don_t_repeat_yourself [2025-08-31 14:09] (current) – old revision restored (2021-10-18 21:27) christian | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | There’s a new modern garden hammock seat ([[https:// | + | ====== Don't Repeat Yourself |
| - | Originally seen in mid-century homes, cocoon chairs were made to enclose the sitter, giving you your own private bubble — even in busy spaces. Today’s versions come in plush fabrics, often paired with bouclé cushions. | + | ===== Variants and Alternative Names ===== |
| - | From open-plan apartments to stylish offices, cocoon-style seating is being used to create retreat corners. | + | * Single Point of Truth (SPOT) |
| + | * Single Source of Truth (SSOT) | ||
| - | **Why They Work:** | + | ===== Context ===== |
| - | - Curved lines that feel safe | + | |
| - | - Built-in quiet zone effect | + | |
| - | - Bold shapes that photograph well | + | |
| - | - 70s revival with 2025 relevance | + | |
| - | (Image: [[https:// | + | * [[contexts:Object-Oriented Design]] |
| + | * [[contexts:Implementation]] | ||
| + | ===== Principle Statement ===== | ||
| - | [[//www.youtube.com/embed/Zfc-FZK2DkA|external frame]]Looking | + | > "Every piece of knowledge must have a single, unambiguous, |
| + | |||
| + | |||
| + | ===== Description ===== | ||
| + | |||
| + | DRY not only states that code duplication shall be avoided. Rather DRY is a general rule that states that if there is duplication, | ||
| + | |||
| + | |||
| + | ===== Rationale ===== | ||
| + | |||
| + | If there are several representations of the same information (be it code or any other form of information), | ||
| + | |||
| + | |||
| + | ===== Strategies ===== | ||
| + | |||
| + | * Add a new invokable module (a function, a method, a class, etc.) instead of duplicating code | ||
| + | * Factor out a common base class | ||
| + | * Use code generation when information has to be represented in multiple forms | ||
| + | * Use polymorphism to avoid repeatedly enumerating a set of possible solutions in if or switch statements | ||
| + | |||
| + | ===== Caveats ===== | ||
| + | |||
| + | See section [[#contrary principles]]. | ||
| + | |||
| + | |||
| + | ===== Origin ===== | ||
| + | |||
| + | {{page> | ||
| + | ===== Evidence ===== | ||
| + | /* Comment out what is not applicable and explain the rest: */ | ||
| + | /* * [[wiki: | ||
| + | |||
| + | * [[wiki: | ||
| + | * [[wiki: | ||
| + | |||
| + | /* * [[wiki: | ||
| + | |||
| + | |||
| + | ===== Relations to Other Principles ===== | ||
| + | |||
| + | ==== Generalizations ==== | ||
| + | |||
| + | * [[Murphy' | ||
| + | |||
| + | ==== Specializations ==== | ||
| + | |||
| + | * [[Once And Only Once]] (OAOO): This is the aspect of DRY which is concerned with the avoidance of (code) duplication. | ||
| + | * [[Single Choice Principle]] (SCP): Duplication can also be duplication of information about a set of possibilities. The SCP is about this aspect. | ||
| + | * [[Write Code That Writes Code]]: This is the code generation aspect of DRY. | ||
| + | |||
| + | ==== Contrary Principles ==== | ||
| + | |||
| + | * [[Keep It Simple Stupid]] (KISS): Especially code generators can be very complex. | ||
| + | |||
| + | ==== Complementary Principles ==== | ||
| + | |||
| + | * [[Generalization Principle]] (GP): A generalized solution avoids duplication. | ||
| + | |||
| + | ==== Principle Collections ==== | ||
| + | |||
| + | {{page> | ||
| + | {{page> | ||
| + | |||
| + | ===== Examples ===== | ||
| + | |||
| + | |||
| + | ===== Description Status ===== | ||
| + | /* Choose one of the following and comment out the rest: */ | ||
| + | / | ||
| + | [[wiki: | ||
| + | / | ||
| + | |||
| + | |||
| + | ===== Further Reading ===== | ||
| + | |||
| + | * [[wiki> | ||
| + | * [[wp> | ||
| + | * [[http:// | ||
| + | |||
| + | ===== Discussion ===== | ||
| + | |||
| + | Discuss this wiki article and the principle on the corresponding [[talk: | ||
| - | Shop the latest — and prepare to get cosy. | ||
principles/don_t_repeat_yourself.1756357247.txt.gz · Last modified: by hildegardlahey6
