Data Modelling (Class Diagram)

A. Key Elements

Class

Attributes

Methods

Relationships

B. Notions and their significance-Class

Used to describe different things in a system

Depicted with the box shape, divided into three sections

Write the name of the thing being depicted to the top

B. Notions and their significance-Attributes

Significant piece of data containing values that describe each instance eg name, id, age

To identify an instance of each class, this is done through Attributes

Also called fields, variables, and properties

Attributes are written in the middle section

Formatted with visibility(-), then lowercase letters, colon (:), data type (string-words, int(integer)-numbers) eg. -userid: string

B. Notions and their significance-Methods

Located at the bottom section of the box

Also called operations or functions

Allow you to specify any behavioral feature of a class

Formatted with visibility(-), then lowercase letters, parentheses (), *(variables and data type) not a must eg +verifyLogin()

C.All other observations that makes the UML

Visibility of attribute or method sets the accessibility for that attribute or method. Minus - sign indicates private, and plus + sign indicates public and can be accessed by any other class. Hash tag# indicates protected and can only be accessed by the same class or its subclasses. Tilde ~ package or default can be used by any other class as long as it's in the same package.

B. Notions and their significance-Relationships

Inheritance

Inherits all the attributes and methods of the superclass (like parent and child)

Attributes added to superclass will be automatically updated to subclasses

A specific attribute can be added to an inheritance and do not affect the superclass or other inheritances

Abstraction is used to instantiate classes with inheritance. The superclass name is put in italics to represent.

Represented with a straight line and an arrow attached pointing towards the parent company

Association

Represented by draw a straight line from one class to another class

A verb is used between the lines to state what happens between the associated classes. There is no dependency between the classes

Aggregation

Special type of association that specifies a whole and its parts

Represented by the straight line with an open diamond shape attached

A relationship where a part can exist outside the relationship

Composition

A relationship where a part can't exist outside the relationship (when a child object cannot exist without the parent)

Represented by the straight line with a closed diamond shape attached

Multiplicity allows you to set numerical constraints on relationships by placing the values in between the straight line from child to parent. They are denoted as follows: 0...1 zero to one (optional), n specific number, 0.. zero to many, 1.. one to many, m...n specific number range