-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlegend_classes.uml
149 lines (125 loc) · 4.08 KB
/
legend_classes.uml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
@startuml
!include default_style.iuml
title UML Class diagram and object diagram explained
'-----------------------------------------------------------------------
' Display configuration
' hide members
hide methods
'-----------------------------------------------------------------------
' Classes
package "Conceptual data model (class diagram)" {
class Users {
id : string
username: string
...
}
note top of Users #orange
- **Attributes** can be described
**in your preferred type language**
(eg. SQL, PHP, Java, C++, etc.).
Just copy and paste your defined
types from your **source code**
(a bit **informal but very useful**)
end note
abstract class Contents
note top of Contents #orange
- Any instance of an abstract class
**is an instance of one of its**
**subclasses**
end note
class JobOffers {
id : string
...
}
class Posts {
id : string
...
}
class Publications {
id : string
...
}
'-----------------------------------------------------------------------
' Associations
Contents <|-- JobOffers
Contents <|-- Posts
Users "1" *- "authorOf\r*" Contents: createdBy <
note top on link #orange
- The **association name** can
always be used **as a role** in
involved classes
- The meaning of decorating an
association with a **triangle** is
to use its **name as a role** in
the indicated **orientation** (eg.
p2.publisher, post2.createdBy...)
end note
Contents "1" -- "publishedIn\l0..1" Publications : content <
note right on link #orange
- An extra role has been included to
illustrate the use of roles
(eg. publishedIn)
- **Roles used to indicate** the name of
the **artifacts in concrete**
**implementations** (tables relational
model; sets, hashes, indices in NoSQL
models, etc.)
end note
Users "1" *-- "publications\l*" Publications : publisher <
note right on link #orange
- The meaning of **composition**
(represented with a **filled diamond**)
is that any instance must be a
**component of only one owner**
(even under multiple classes of
potential owners).
- Aliases for multiplicities:
**1 = 1..1**, *** = 0..***
- In this diagrams **aggregation**
(**unfilled diamond**) is not used
since it has no formal semantics
("Think of it as a modeling placebo"
[Rumbaugh, UML Reference]).
end note
note as publisher_implementation
Example indicating implementations:
- Publication:publisher implemented as
a property in a hash in Redis
- Users:publications implemented as
a set in Redis
- Publication:publisher implemented as
not null column in table *publications*
- Users:publications implemented as
a SQL view inspecting table
*publications*
end note
Users .. publisher_implementation
publisher_implementation . Publications
}
'-----------------------------------------------------------------------
legend right
- Aggregation (represented with a blank diamond) is not used since
it is **strictly meaningless** (as Martin Fowler says in UML
Distilled).
' - The meaning of composition (represented with a filled diamond) is that
' any instance must be a component of only one owner (even under multiple
' classes of potential owners).
' - Aliases for multiplicities: 1 = 1..1, * = 0..*
' - Expressions {...} represents (mathematical) sets (no arrays, no
' tuples, no hashes, no artifacts in any physical or logical model)
' - The name of the association can always be used as a role
' in classes involved in the association
' - The meaning of decorating an association with a triangle is to use its
' name as a role in the indicated orientation (eg. p2.publisher,
' post2.createdBy...)
' - An extra role has been included to illustrate the use of roles
' - Roles used to indicates the name of the artifacts in concrete
' implementations (tables relational model, sets or hashed in NoSQL
' models, etc.)
' - Roles and attributes follow the same syntax
' - Attributes can be described in your preferred type language (eg. SQL,
' PHP, Java, C++, etc.). Just copy and paste your defined types from
' your source code (a bit informal but very useful)
' - When relevant, you can add attribute values in class instances
end legend
@enduml