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 01:11] – 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 seat stealing the spotlight: the cocoon chair — and it’s easy to understand why. These design-forward loungers offer a perfect blend of privacy and comfort, making them a top pick for modern interiors. | + | ====== Don't Repeat Yourself (DRY) ====== |
- | [[// | + | ===== Variants and Alternative Names ===== |
- | From urban lofts to stylish offices, | + | * Single Point of Truth (SPOT) |
+ | * Single Source of Truth (SSOT) | ||
- | **Why They Work:** | + | ===== Context ===== |
- | - Soft silhouettes that feel safe | + | |
- | - Built-in quiet zone effect | + | |
- | - Instagram-worthy design | + | |
- | - Blends mid-century with modern vibes | + | |
- | Designers and style-savvy homeowners are using cocoon chairs to define lounge areas. Add a floor lamp and a rug — it’s ready for Pinterest. | + | * [[contexts: |
+ | * [[contexts: | ||
+ | ===== Principle Statement ===== | ||
- | Looking | + | > "Every piece of knowledge must have a single, unambiguous, |
+ | |||
+ | |||
+ | ===== Description ===== | ||
+ | |||
+ | DRY not only states | ||
+ | |||
+ | |||
+ | ===== 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: | ||
- | Explore our collection — and prepare to get cosy.(Image: |
principles/don_t_repeat_yourself.1756336300.txt.gz · Last modified: by hildegardlahey6