Docsity

Object-Oriented Analysis and Design (OOAD): Class and Object Diagrams in UML, Lecture notes of Object Oriented Analysis and Design

Partial preview of the text

Download Object-Oriented Analysis and Design (OOAD): Class and Object Diagrams in UML and more Lecture notes Object Oriented Analysis and Design in PDF only on Docsity!

Structural Modeling

Class Diagram

Object Diagram

2

What is Class diagram?

  • A class diagram shows the existence of classes and

their relationships in the logical view of a system

  • UML modeling elements in class diagrams are:
    • Classes, their structure and behavior.
    • relationships components among the classes like

association, aggregation, composition,

dependency and inheritance

  • Multiplicity and navigation indicators
  • Role names or labels.

4

RELATIONSHIP

  • Association
  • Aggregation
  • Composition
  • Inheritance
  • Dependency
  • Instantiation

5

ASSOCIATION

These are the most general type of relationship:

  • It denotes a semantic connection between two classes
  • It shows BI directional connection between two classes
  • It is a weak coupling as associated classes remain somewhat independent of each other
  • Example:

CUSTOMER (^) ATM system

7

AGGREGATION

This is a special type of association

  • The association with label “contains” or “is part of” is an aggregation  represents “has a “ relationship
  • It is used when one object logically/physically contains other
  • The container is called as aggregate with diamond at end
  • The components of aggregate can be shared with others
  • It expresses a whole - part relationships, like …

8

COMPOSITION

This is a strong form of aggregation

  • It expresses the stronger coupling between the

classes

  • The owner is explicitly responsible for creation and

deletion of the part

  • Any deletion of whole is considered to cascade its

part

  • The aggregate has a filled diamond at its end

Window Client Area

Generalization

Prep by: Arun Timalsina 10

11

DEPENDENCY

  • Dependency is semantic connection between

dependent and independent model elements.

  • This association is unidirectional and is shown with

dotted arrowhead line.

  • In the following example it shows the dependency

relationship between client and server.

  • The client avails services provided by server so it

should have semantic knowledge of server.

  • The server need not know about client.

Client Server

Different Relationships

Prep by: Arun Timalsina 13

Adornments : Name & Role

Prep by: Arun Timalsina 14

16

What is Cardinality?

Definition: Number of instances of each class involved in the dialogue is specified by cardinality.

  • Common multiplicity values:
  • Symbol Meaning
  • 1 One and only one
  • 0..1 Zero or one
  • M…N From M to N (natural integer)
  • 0..* From zero to any positive integer
  • 1..* From one to any positive integer
  • Also thought can be given about navigability to every applicable relationship.

Structural Relationships

Prep by: Arun Timalsina 17

Class Diagram : Static design view

  • To model the vocabulary of a system
    • Modeling the vocabulary; a decision about which

abstractions are part of the system under

consideration and about which fall outside its

boundaries; abstractions and their responsibilities

  • To model simple collaborations
    • A collaboration is a society of classes, interfaces, &

other elements that work together to provide some

cooperative behavior

  • To model a logical database schema
    • A schema as the blueprint for the conceptual design

of the database

Prep by: Arun Timalsina 19

Simple Collaboration Model

Prep by: Arun Timalsina 20