principles:model_principle
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:model_principle [2020-10-12 12:42] – old revision restored (2018-12-08 10:35) 159.69.186.191 | principles:model_principle [2021-09-02 12:34] – old revision restored (2021-05-11 22:08) 65.21.179.175 | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Variants and Alternative Names ===== | ===== Variants and Alternative Names ===== | ||
- | * Direct Mapping(({{page> | + | * Direct Mapping((Bertrand Meyer: // |
- | * Low Representational Gap (LRG)((Craig Larman: //[[resources: | + | * Low Representational Gap (LRG)((Craig Larman: //Applying UML and Patterns |
===== Context ===== | ===== Context ===== | ||
/* fill in contexts here: */ | /* fill in contexts here: */ | ||
Line 25: | Line 24: | ||
Real world actions are then // | Real world actions are then // | ||
- | Be precise with semantics. An operation '' | + | FIXME more detailed description |
- | Keep sure that your software models the reality by invoking the method that has the correct semantics and supplying it with the parameters that are needed from a requirements perspective. | ||
===== Rationale ===== | ===== Rationale ===== | ||
Line 33: | Line 31: | ||
When the structures in the software roughly correspond to the structures of the problem domain, a developer doesn' | When the structures in the software roughly correspond to the structures of the problem domain, a developer doesn' | ||
- | Moreover if something works accidentally, | + | |
===== Strategies ===== | ===== Strategies ===== | ||
Line 39: | Line 37: | ||
* Create methods corresponding to real-world actions | * Create methods corresponding to real-world actions | ||
* Map additionally necessary behavior to natural classes instead of creating artificial classes | * Map additionally necessary behavior to natural classes instead of creating artificial classes | ||
- | * For artificial behavior that cannot be mapped to a natural class at least create a metaphor or an artificial model (like a state machine) | + | * For artificial behavior that cannot be mapped to a natural class at least create a metaphor or an artificial model (like for example |
- | * Be precise with semantics. If you have an operation that currently does what you need but for slightly different reasons because it's an operation on the wrong abstraction level, create a new operation with the correct semantics. Have that new operation call the existing one as an implementation detail (e.g. have a '' | + | |
===== Caveats ===== | ===== Caveats ===== | ||
- | This principle may lead to the problem of modeling the real world in too great detail. This complicates the design without giving any further benefits. Especially a wrong understanding of inheritance may lead to [[anti-patterns: | + | This principle may lead to the problem of modeling the real world in too great detail. This complicates the design without giving any further benefits. Especially a wrong understanding of inheritance may lead to [[anti-patterns: |
See also section [[#contrary principles]]. | See also section [[#contrary principles]]. | ||
Line 54: | Line 52: | ||
> " | > " | ||
- | Although this view is disputed as a definition for object-oriented programming, | + | Although this view is disputed as a definition for object-oriented programming, |
===== Evidence ===== | ===== Evidence ===== | ||
Line 62: | Line 60: | ||
* [[wiki: | * [[wiki: | ||
- | * [[wiki: | + | * [[wiki: |
Line 84: | Line 82: | ||
* **[[Tell, don't Ask/ | * **[[Tell, don't Ask/ | ||
* [[Low Coupling]] (LC): When designing a model for a software, it has to be borne in mind that structures with low coupling are desirable. | * [[Low Coupling]] (LC): When designing a model for a software, it has to be borne in mind that structures with low coupling are desirable. | ||
- | * [[Law of Leaky Abstractions]] (LLA): When building abstractions according to MP, keep in mind that there will most likely be abstraction leaks. A good abstraction minimizes those leaks. | + | |
==== Principle Collections ==== | ==== Principle Collections ==== | ||
Line 129: | Line 127: | ||
* [[http:// | * [[http:// | ||
- | ===== Discussion ===== | ||
- | |||
- | Discuss this wiki article and the principle on the corresponding [[talk: |
principles/model_principle.txt · Last modified: 2021-10-18 21:47 by christian