update classDiagram documentation:

fix typos and describe naming convention
This commit is contained in:
Louis Frament
2019-10-29 17:50:19 +01:00
parent e010a03dd5
commit d8d5d0fa61

View File

@@ -44,7 +44,7 @@ Mermaid can render class diagrams.
+String beakColor +String beakColor
+swim() +swim()
+quack() +quack()
} }
class Fish{ class Fish{
-int sizeInFeet -int sizeInFeet
-canEat() -canEat()
@@ -69,7 +69,7 @@ A single instance of a class in the diagram contains three compartments:
``` ```
classDiagram classDiagram
class BankAccount class BankAccount
BankAccount : +String onwer BankAccount : +String owner
BankAccount : +Bigdecimal balance BankAccount : +Bigdecimal balance
BankAccount : +deposit(amount) BankAccount : +deposit(amount)
BankAccount : +withdrawl(amount) BankAccount : +withdrawl(amount)
@@ -77,7 +77,7 @@ classDiagram
```mermaid ```mermaid
classDiagram classDiagram
class BankAccount class BankAccount
BankAccount : +String onwer BankAccount : +String owner
BankAccount : +BigDecimal balance BankAccount : +BigDecimal balance
BankAccount : +deposit(amount) BankAccount : +deposit(amount)
BankAccount : +withdrawl(amount) BankAccount : +withdrawl(amount)
@@ -98,6 +98,9 @@ classDiagram
class Animal class Animal
Vehicle <|-- Car Vehicle <|-- Car
``` ```
Naming convention: a class name should be composed of alphanumeric (unicode allowed) and underscore characters.
## Defining Members of a class ## Defining Members of a class
UML provides mechanisms to represent class members, such as attributes and methods, and additional information about them. UML provides mechanisms to represent class members, such as attributes and methods, and additional information about them.
@@ -117,7 +120,7 @@ There are two ways to define the members of a class, and regardless of the which
``` ```
class BankAccount class BankAccount
BankAccount : +String onwer BankAccount : +String owner
BankAccount : +BigDecimal balance BankAccount : +BigDecimal balance
BankAccount : +deposit(amount) BankAccount : +deposit(amount)
BankAccount : +withdrawl(amount) BankAccount : +withdrawl(amount)
@@ -125,7 +128,7 @@ There are two ways to define the members of a class, and regardless of the which
```mermaid ```mermaid
classDiagram classDiagram
class BankAccount class BankAccount
BankAccount : +String onwer BankAccount : +String owner
BankAccount : +BigDecimal balance BankAccount : +BigDecimal balance
BankAccount : +deposit(amount) BankAccount : +deposit(amount)
BankAccount : +withdrawl(amount) BankAccount : +withdrawl(amount)
@@ -134,7 +137,7 @@ There are two ways to define the members of a class, and regardless of the which
- Associate members of a class using **{}** brackets, where members are grouped within curly brackets. Suitable for defining multiple members at once. For example: - Associate members of a class using **{}** brackets, where members are grouped within curly brackets. Suitable for defining multiple members at once. For example:
``` ```
class BankAccount{ class BankAccount{
+String onwer +String owner
+BigDecimal balance +BigDecimal balance
+deposit(amount) +deposit(amount)
+withdrawl(amount) +withdrawl(amount)
@@ -143,7 +146,7 @@ class BankAccount{
```mermaid ```mermaid
classDiagram classDiagram
class BankAccount{ class BankAccount{
+String onwer +String owner
+BigDecimal balance +BigDecimal balance
+deposit(amount) +deposit(amount)
+withdrawl(amount) +withdrawl(amount)