You are on page 1of 26

UNIT II STATIC UML DIAGRAMS

Class Diagram–– Elaboration – Domain Model –


Finding conceptual classes and description classes –
Associations – Attributes – Domain model refinement
– Finding conceptual class Hierarchies – Aggregation
and Composition – Relationship between sequence
diagrams and use cases – When to use Class Diagrams
Class Diagrams
• In software engineering, a class diagram in the Unified Modeling
Language (UML) is a type of static structure diagram that describes
the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among
objects.
Purpose of Class Diagrams
 Shows static structure of classifiers in a system
 Diagram provides basic notation for other structure diagrams
prescribed by UML
 Helpful for developers and other team members too
 Business Analysts can use class diagrams to model systems from
business perspective
A UML class diagram is made up of:
 A set of classes and
 A set of relationships between classes
newAtt : Datatype

newOperation()

A Class Diagram Contains 3 Parts


1.Name of the class: Contains Specific Name for the class
2.Attributes of the class: A significance piece of data containing values that describes
each instance of the class. Also called fields, variables and properties.
3.Method of the class: Methods are called as operations or functions. It allows you to
specify any behavioral feature of a class.
Visibility of Class Diagram
• In object-oriented design, there is a notation of
visibility for attributes and operations. UML
identifies four types of visibility: public, protected,
private, and package.

• The +, -, # and ~ symbols before an attribute and


operation name in a class denote the visibility of
the attribute and operation.
Visibility of class example

+ denotes public attributes – It can be accessed by any other class.

-denotes private attributes – They can be accessed any other class or sub class.

# denotes protected attributes – This visibility can also be accessed by the same class and
within all the immediate children classes of the base class.

~ denotes package attributes – Can be accessed within this class and all the classes which are
inside in a package.
Class Multiplicities Example
Class Multiplicity
Multiplicity Association
• This is the most common type of relationship used in UML. The
association is shown between the classes or instance of classes.
• For example In the figure given below the customer and the bank
account is shown by the association relationship.
• This can be read as “One customer can have multiple accounts in the
bank.” (in an optional type question if all the answers are correct)
Aggregation and Composition
Aggregation implies a relationship where the child can exist
independently of the parent.
Composition implies a relationship where the child cannot exist
independent of the parent.
Class Diagram Example
Class Diagram Example
Domain Model
• Consider a banking system in which a bank has one or more
branches. Each branch has customer which account is present in
that branch. The account can be of two types savings account and
current account. Design the domain model.

You might also like