Basic Modelling Concepts: Difference between revisions
Jump to navigation
Jump to search
Line 105: | Line 105: | ||
== Class Diagrams == | == Class Diagrams == | ||
{| class="wikitableharm" width="1150" | |||
! width="575" | Ontwerpbeslissingen | |||
! width="575" | Development design decisions | |||
|- | |||
! style="text-align:center;" colspan="2" | - 1 - | |||
|- style="vertical-align:top;" | |||
| Attributen zijn private<br>Getters en Setters toevoegen (Alleen indien nodig) | |||
| Attributes are private<br>Add only the necessary Getters and Setters | |||
|- | |||
! style="text-align:center;" colspan="2" | - 2 - | |||
|- style="vertical-align:top;" | |||
| Constructor heeft parameters: | |||
* Identificerende attributen | |||
* Verplichte attributen | |||
Optioneel extra constructors | |||
* Indien vaak meer parameters gewenst zijn. | |||
| Constructor has parameters: | |||
* Identifying attributes | |||
* Required attributes | |||
Optional extra (alternative) constructors | |||
* When often more parameters are required | |||
|- | |||
! style="text-align:center;" colspan="2" | - 3 - | |||
|- style="vertical-align:top;" | |||
| Associatie met lage multipliciteit | |||
* Kies één of meer attributen van enkelvoudig type | |||
Associatie met hoge multipliciteit | |||
* Kies voor een attribuut van type Collection | |||
| Association with low multiplicity | |||
* Choose one or more attributes of base type | |||
Association with high multiplicity | |||
* Choose an attribute of type Collection | |||
|- | |||
! style="text-align:center;" colspan="2" | - 4 - | |||
|- style="vertical-align:top;" | |||
| Afleidbare informatie | |||
* Definieer een functie om de waarde te berekenen (of sla de waarde op in een attribuut). | |||
* Vermijd redundantie | |||
| Derivable / deductable Information | |||
* Define a method to calculate the value (or use an attribute) | |||
|- | |||
! style="text-align:center;" colspan="2" | - 5 - | |||
|- style="vertical-align:top;" | |||
Als een associatie | |||
* Attributen heeft | |||
* Operaties heeft | |||
* Associaties heeft met andere classes | |||
Introduceer dan een associatie class! | |||
| If an association has | |||
* Attributes | |||
* Operations / Methods | |||
* Associations with other classes | |||
Then Introduce an association class. | |||
|- | |||
! style="text-align:center;" colspan="2" | - 6 - | |||
|- style="vertical-align:top;" | |||
| Administratieve verplicting | |||
* Bij een aggregatie kunnen onderdelen van een object zelfstandig blijven voortbestaan | |||
* Bij een compositie verdwijnen onderdelen van een object als het betreffende object verdwijnt | |||
** levensduur onderdeel ≤ levensduur object | |||
| | |||
|- | |||
! style="text-align:center;" colspan="2" | - 7 - | |||
|- style="vertical-align:top;" | |||
| Liskov substitutieprincipe: | |||
* Overal waar een instantie van een class gebruikt kan worden, kan ook altijd een willekeurige instantie van een willekeurige subclass of subtype gebruikt worden | |||
| Barbara Liskov: | |||
* Let q(x) be a property provable about objects x of type T. Then q(y) should be provable for objects y of type S, where S is a subtype of T. | |||
|- | |||
! style="text-align:center;" colspan="2" | - 8 - | |||
|- style="vertical-align:top;" | |||
| Programmeer tegen een interface, niet tegen een implementatie | |||
| Program to an interface, not against an implementation | |||
|} | |||
== See also == | == See also == |
Revision as of 10:41, 5 March 2015
Modelling tools have their own interpretation of how diagrams, icons are used. This webpage tries to give some clues on how this implementation are made.
Diagram Elements | Sterotypes |
---|---|
![]() ![]() |
![]() ![]() |
Object Orientation Basic Elements
Basic OO Elements are:
Association
https://upload.wikimedia.org/wikipedia/en/f/f5/BidirectionalAssociation.png | https://upload.wikimedia.org/wikipedia/en/0/05/UnidirectionalAssociation.png |
---|---|
A bidirectional association | Unless otherwise specified, navigation across an association is bidirectional, although it may be limited to just one direction by adorning some end with an arrowhead pointing to the direction of traversal. |
Description | |
Association defines a relationship between classes of objects that allows one object instance to cause another to perform an action on its behalf. |
Aggregation
https://upload.wikimedia.org/wikipedia/commons/d/d0/Aggregation-Composition3.png |
---|
A bidirectional association, first a composition, the second is an aggregation. |
Description |
Association defines a relationship between classes of objects that allows one object instance to cause another to perform an action on its behalf. A "uses" B = Aggregation : B exists independently (conceptually) from A.
|
Composition
In Java:
public class Point { private float x; private float y; /** * Constructor * @param x Value for the x-axis. * @param y Value for the y-axis. */ public Point(float x, float y) { this.x = x; this.y = y; } ... } |
width="525"
public class Circle { private float radius; private Point center; /** * Constructor * @param center Instance of class point * @param radius Length of the radius. */ public Circle(Point center, float radius) { this.center = center; this.radius = radius; } ... } |
Class Diagrams
Als een associatie- Attributen heeft
- Operaties heeft
- Associaties heeft met andere classes
Ontwerpbeslissingen | Development design decisions |
---|---|
- 1 - | |
Attributen zijn private Getters en Setters toevoegen (Alleen indien nodig) |
Attributes are private Add only the necessary Getters and Setters |
- 2 - | |
Constructor heeft parameters:
Optioneel extra constructors
|
Constructor has parameters:
Optional extra (alternative) constructors
|
- 3 - | |
Associatie met lage multipliciteit
Associatie met hoge multipliciteit
|
Association with low multiplicity
Association with high multiplicity
|
- 4 - | |
Afleidbare informatie
|
Derivable / deductable Information
|
- 5 - | |
If an association has
Then Introduce an association class. | |
- 6 - | |
Administratieve verplicting
|
|
- 7 - | |
Liskov substitutieprincipe:
|
Barbara Liskov:
|
- 8 - | |
Programmeer tegen een interface, niet tegen een implementatie | Program to an interface, not against an implementation |
See also
http://agilemodeling.com/images/style/classDiagramAnalysisVsDesign.gif top
- Agile Modeling, Class Diagrams Guidelines. See example above.