principles:encapsulate_the_concept_that_varies
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
principles:encapsulate_the_concept_that_varies [2019-10-07 08:29] – [Contrary Principles] 2600:1700:6470:22d0:c500:a3eb:d473:80ab | principles:encapsulate_the_concept_that_varies [2020-10-12 16:09] – old revision restored (2013-02-11 13:08) 159.69.186.191 | ||
---|---|---|---|
Line 5: | Line 5: | ||
===== Context ===== | ===== Context ===== | ||
/* fill in contexts here: */ | /* fill in contexts here: */ | ||
- | * [[contexts: | + | * [[contexts: |
- | * [[contexts: | + | |
- | * [[contexts: | + | |
===== Principle Statement ===== | ===== Principle Statement ===== | ||
Line 48: | Line 47: | ||
* Visitor: New operations have to be added to a given more or less static inheritance structure of classes. | * Visitor: New operations have to be added to a given more or less static inheritance structure of classes. | ||
* ... | * ... | ||
- | |||
- | ===== Caveats ===== | ||
- | |||
- | See section [[#contrary principles]]. | ||
- | |||
===== Origin ===== | ===== Origin ===== | ||
- | |||
- | The principle is stated, explained and used in the GoF book: | ||
Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides: // | Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides: // | ||
- | |||
- | But the idea if ECV is actually much older. It was first presented in | ||
- | |||
- | David Parnas: // | ||
- | |||
===== Evidence ===== | ===== Evidence ===== | ||
Line 86: | Line 73: | ||
* **[[More Is More Complex]] (MIMC)**: ECV demands adding a new class for a new varying concept. | * **[[More Is More Complex]] (MIMC)**: ECV demands adding a new class for a new varying concept. | ||
- | * [[Model Principle]] (MP): ECV sometimes results in classes which do not correspond | + | * [[Model Principle]] (MP): ECV sometimes results in classes which do not correspond |
==== Complementary Principles ==== | ==== Complementary Principles ==== | ||
Line 94: | Line 81: | ||
* [[Generalization Principle]] (GP): Encapsulating a varying concept typically results in a more generally applicable solution. This is especially true when an abstract concept is encapsulated by introducing an interface or an abstract class. | * [[Generalization Principle]] (GP): Encapsulating a varying concept typically results in a more generally applicable solution. This is especially true when an abstract concept is encapsulated by introducing an interface or an abstract class. | ||
* [[Dependency Inversion Principle]] (DIP): ECV may result in the introduction of an abstract base class. Here DIP demands that other classes should only depend on this new abstract base class and not on the concrete subclasses. | * [[Dependency Inversion Principle]] (DIP): ECV may result in the introduction of an abstract base class. Here DIP demands that other classes should only depend on this new abstract base class and not on the concrete subclasses. | ||
- | * [[Information Hiding/ | ||
==== Principle Collections ==== | ==== Principle Collections ==== | ||
Line 100: | Line 86: | ||
- | ===== Examples | + | ===== Example |
Line 115: | Line 101: | ||
* [[Single Responsibility Principle]] | * [[Single Responsibility Principle]] | ||
* [[Open-Closed Principle]] | * [[Open-Closed Principle]] | ||
- | |||
- | ===== Discussion ===== | ||
- | |||
- | Discuss this wiki article and the principle on the corresponding [[talk: |
principles/encapsulate_the_concept_that_varies.txt · Last modified: 2021-10-18 21:31 by christian