chapter3

25
Session 3 Understand and Use Object Oriented Methods

Upload: dang-tuan

Post on 06-Dec-2014

1.069 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Chapter3

Session 3

Understand and Use Object Oriented

Methods

Page 2: Chapter3

OOAD with UML / Session 3 / 2 of 25

Review OOAD refers to the development of systems

with the base concept of objects and classes UML is a modeling tool used in

Information systems Technical systems Embedded systems Distributed systems System software Business Systems

SDLC refers to different phases in the software development process

Page 3: Chapter3

OOAD with UML / Session 3 / 3 of 25

Objectives

Discuss the class diagram and object diagram

Represent the relationships between classes

Discuss the concept of object Model

Identify classes during analysis

Page 4: Chapter3

OOAD with UML / Session 3 / 4 of 25

Class and Object Class - A class is a description of a

group of objects with common properties (attributes), behavior (Operations), relationships, and semantic

Object - An object represents an entity, either physical, conceptual, or software

Page 5: Chapter3

OOAD with UML / Session 3 / 5 of 25

Class Diagram-1

Class Object

Page 6: Chapter3

OOAD with UML / Session 3 / 6 of 25

Class Diagram-2 Class Names Class Attributes Class Methods Constraints Comment

Page 7: Chapter3

OOAD with UML / Session 3 / 7 of 25

Representation of Relationship

Multiplicity-Multiplicity defines how many objects participate in a relationship

Page 8: Chapter3

OOAD with UML / Session 3 / 8 of 25

Multiplicity & Navigation

Student Schedule

Navigation

Multiplicity

0..*1

Page 9: Chapter3

OOAD with UML / Session 3 / 9 of 25

Aggregation An aggregation is a stronger form of relationship where

the relationship is between a whole and its parts

Student Schedule

Aggregation

WholePart

Page 10: Chapter3

OOAD with UML / Session 3 / 10 of 25

Aggregation-Composition

Composition is a form of aggregation with strong ownership and coincident lifetimes of the part with the aggregate

Student Schedule

Aggregation

Whole Part

Page 11: Chapter3

OOAD with UML / Session 3 / 11 of 25

Aggregation-Dependency A dependency relationship is a weaker form of

relationship

Page 12: Chapter3

OOAD with UML / Session 3 / 12 of 25

Aggregation-Generalization

A specialization/generalization relationship is one, in which objects of the specialized element (the child) are substitutable for objects of the generalized element (the parent)

Superclass Subclass

Page 13: Chapter3

OOAD with UML / Session 3 / 13 of 25

Association Association is a connection between classes

Professor University

Professor UniversityWorks for

Class

Association Name

Role Names

EmployerEmployee

Page 14: Chapter3

OOAD with UML / Session 3 / 14 of 25

Constraints of Association

An association may have a name that is placed on, or adjacent to the association path

The name of the association should reflect the purpose of the relationship and be a verb phrase; the name of an association can be omitted, particularly if roles names are used. Names like “has” and “contains should be avoided”, as they add no information about what the relationships are between the classes.

Each end of an association is a role specifying the face that a class plays in the association (not a constraint). Each role must have a name, and the role names must be unique. The role name should be a noun indicating the associated object’s role in relation to the associating object.

The use of association names and role names are mutually exclusive: one should not use both an association name and role name. For each association, it needs to decide as to which conveys more information.

Page 15: Chapter3

OOAD with UML / Session 3 / 15 of 25

Association Classes

Page 16: Chapter3

OOAD with UML / Session 3 / 16 of 25

Qualified Association

Theatre Seat1 99

Theatre Seat1Row {1,2,…9}

Column {1,2,..11}

1

Page 17: Chapter3

OOAD with UML / Session 3 / 17 of 25

Recursive Association

Page 18: Chapter3

OOAD with UML / Session 3 / 18 of 25

Inheritance and Generalization-1

Page 19: Chapter3

OOAD with UML / Session 3 / 19 of 25

Inheritance and Generalization-2

The mechanism for sharing attributes and operations using the principle of generalization is referred to as inheritance

Page 20: Chapter3

OOAD with UML / Session 3 / 20 of 25

Same Association or Aggregation

Page 21: Chapter3

OOAD with UML / Session 3 / 21 of 25

Interface

Page 22: Chapter3

OOAD with UML / Session 3 / 22 of 25

Object Model

Language independent

Notation allowing the specification of classes, their data or attributes (private) and methods (public), inheritance

This diagram depicts the structural relationship and functional behavior of the classes

Page 23: Chapter3

OOAD with UML / Session 3 / 23 of 25

Nouns in problem statement Knowledge of the problem

domain Use Cases Physical entities Devices Events Roles played Operational procedures Sites Organisational units

How to Identify Classes?

Tangible things Events Roles played Interactions Location Organizational Units The Requirements

statement Use Cases Application experts Studying the system

Similar systems Previous systems

Page 24: Chapter3

OOAD with UML / Session 3 / 24 of 25

Candidate Classes

Page 25: Chapter3

OOAD with UML / Session 3 / 25 of 25

Summary A class icon is a

rectangle with three sections within it

Association is a connection between classes

An interface is a collection of operations that are used to specify a service of a class or a component

Object Model generally deals with classes