Docsity

Understanding Object Model Diagrams: Classes, Associations, and Aggregation, Slides of Object Oriented Analysis and Design

Partial preview of the text

Download Understanding Object Model Diagrams: Classes, Associations, and Aggregation and more Slides Object Oriented Analysis and Design in PDF only on Docsity!

Constructing The Object Model Diagram

The Object Model Diagram is a graphical representation of the classes within a system and the static or underlying relationships between them.

The Class Diagram

Class name

Attributes

methods

May be completed during design phase

Completed during the design phase

Cardinality Constraints

  • Zero or more
  • One or more

Zero or one

All objects of the class participate in the association – (total)

Explicit cardinality

Examples

Course

Student

Professor

takes

teaches

All Course objects have a professor and at least 1 student

1 *

In any semester a professor will teach zero or more courses

0..

Students may take up to 6 courses

Relationship Attributes

Employee

name

ss_num

salary

Company

name works for

Bad – salary as an attribute precludes the possibility of an employee working for more than one company

works for

salary

Better – model salary as a relationship attribute

Role Relationships

Person

name ss_num address

child of child

parent

Role identifiers

2

Every person has 2 parents and zero or more children

Aggregation

Coleman’s Notation

Aggregate Class Name

  • Component 1 + Component 2 3 Component 3

Multiplicity of each component

Aggregation models the has-a relationship

Aggregation

UML Notation

Aggregate Class

Component 1 Component 2 Component 3

  • (^) + 3

Qualification to Remove Multiplicty

The qualifier is a special attribute that limits the multiplicity of an association.

The qualifier distinguishes among the set of objects at the many end of an association

Qualification

Example

Directory File

contains

A directory contains zero or more files

Multiplicity can be removed by the qualifier file name which uniquely identifies a single file.

Generalization and Specialization

Circle

area perimeter

Rectangle

area perimeter

Shape

area perimeter

Classes having the same attributes may be generalized to a common ancestor class docsity.com

Generalization and Specialization

Vehicle

Land Vehicle Air Vehicle Water Vehicle

A sea plane travels in the air and on water

Constructing the Object Model Diagram

Step 1

Determine the objects in the problem domain from the requirements document.

Example -- Arithmetic Expression

An arithmetic expression is a collection of one or more terms separated by additive operators. A term is a sequence of one or more factors separated by multiplicative operators. A factor is a variable, or a constant, or an arithmetical expression enclosed in parentheses.

Requirements Document