You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: reader/content/high-level-design/representations/_index.md
+97-5Lines changed: 97 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,17 +25,109 @@ Unfortunately, given the ambitious goals UML tries to achieve, it has become an
25
25
26
26
## Class diagrams
27
27
28
-
Class diagrams are the most common form of technical abstraction for software systems. Class diagrams are static representations of the software elements and their relationships within a system. For object-oriented systems class diagrams detail the key classes, fields, and methods within a system and how they relate to each other statically. While class diagrams can contain all program elements, they typically focus on a key subset of elements (especially with respect to fields and methods); this does not mean that only public API should be shown, but also API that are intentionally not private. These diagrams are an excellent abstraction for developers to reason about and discuss various design alternatives. Class diagrams can be translated fairly directly into code skeletons (and vice versa).
28
+
Class diagrams are the most common form of technical abstraction for software systems.
29
+
Class diagrams are static representations of the software elements and their relationships within a system.
30
+
For object-oriented systems class diagrams detail the key classes, fields, and methods within a system and how they relate to each other statically.
31
+
While class diagrams can contain all program elements, they typically focus on a key subset of elements (especially with respect to fields and methods); this does not mean that only public API should be shown, but also API that are intentionally not private.
32
+
These diagrams are an excellent abstraction for developers to reason about and discuss various design alternatives. Class diagrams can be translated fairly directly into code skeletons (and vice versa).
33
+
34
+
Classes and interfaces are represented by simple rectangles that detail their names, fields, and methods.
35
+
Method and field visibility can be clarified by prepending names with + (public), # (protected), and - (private).
36
+
Three primary classes of edges exist in class diagrams. Large hollow arrows represent inheritance relationships.
37
+
Dotted lines with simple arrowheads represent dependencies (typically through method calls and field references).
38
+
Solid lines with filled diamonds represent composition relationships; these relationships indicate that the class on the diamond-end creates and is primarily responsible for the lifecycle of one or more variables of the linked type.
39
+
40
+
A common way UML class diagrams are used is to translate a verbal description of a requirement or system component into a potential class diagram.
41
+
For example, a class diagram for a system that lets students enroll in course offerings, and instructors manage rosters and grades, could be the following.
42
+
43
+
{{< figure src="uml-class-enrolment.png" alt="UML Class Diagram modeling course enrolment." >}}
44
+
<!-- Mermaid code
45
+
46
+
classDiagram
47
+
direction LR
48
+
49
+
class Person {
50
+
+id
51
+
+name
52
+
}
53
+
54
+
class Student {
55
+
+enroll
56
+
+drop
57
+
}
58
+
59
+
class Instructor {
60
+
+assignGrade
61
+
}
62
+
63
+
class Course {
64
+
+code
65
+
+title
66
+
+createOffering
67
+
}
29
68
30
-
Classes and interfaces are represented by simple rectangles that detail their names, fields, and methods. Method and field visibility can be clarified by prepending names with + (public), # (protected), and - (private). Three primary classes of edges exist in class diagrams. Large hollow arrows represent inheritance relationships. Dotted lines with simple arrowheads represent dependencies (typically through method calls and field references). Solid lines with filled diamonds represent composition relationships; these relationships indicate that the class on the diamond-end creates and is primarily responsible for the lifecycle of one or more variables of the linked type.
* Inheritance is modeled with hollow arrows: `Person` is a base class for `Student` and `Instructor`.
121
+
* Composition uses filled diamonds: a `Course` composes its `CourseOfferings`, and a `CourseOffering` composes its `Enrollment` records (it owns their lifecycle).
122
+
* Dependencies use dotted arrows: `EnrollmentService` depends on `PaymentProcessor` and `NotificationService`, and interacts with `Student` and `CourseOffering`.
31
123
32
124
<!--
33
125
For example, the class diagram below could be used to generate the text that follows.
Translating from class diagrams to/from code is fairly straightforward. A more common use case is to translate from a textual description to a potential class diagram. For example the class diagram and high-level descriptions below are different representations of the same task.
77
-
169
+
-->
78
170
<!--
79
171
Design a system for drawing UML class and sequence diagrams. Class diagrams should support inheritance, composition, aggregation, and dependency relationships. Sequence diagrams only support sync & async calls and responses.
0 commit comments