object-oriented analysis and design...

43
Object-Oriented Analysis and Design Methodology Romi Satria Wahono Email : [email protected] HP : http://romisatriawahono.net Department of Information and Computer Sciences Graduate School of Science and Engineering Saitama University 1

Upload: lamtruc

Post on 05-Feb-2018

289 views

Category:

Documents


9 download

TRANSCRIPT

Page 1: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Object-Oriented Analysis and Design Methodology

Romi Satria WahonoEmail : [email protected] : http://romisatriawahono.netDepartment of Information and Computer SciencesGraduate School of Science and EngineeringSaitama University

1

Page 2: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

ContentsAn Introduction to the Object-OrientationAn Introduction to the Object-Oriented MethodologyObject-Oriented Notation GuideObject-Oriented Analysis and DesignObject-Oriented Implementation

2

Page 3: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

An Introduction to the Object-Orientation

3

Page 4: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

What is Object-Orientation

A new technology based on objects and classesA way of thingking to organizing software as a collection of discrete objects that incorporate both data structure and behaviourAn abstraction of the real world based on objects and their interactions with other objects

4

Page 5: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Three Characteristics of OO

Abstraction and Classification : Focusing on essential, inherent aspects of an entity and ignoring its accidental. The idea of grouping software ideas into classes of things

Encapsulation and Information Hiding : Separating the external aspects of an object, which are accessible to other objects, from the internal implementation details of object, which are hidden from other objects

Polymorphism and Inheritance :

Abstraction and Classification : Focusing on essential, inherent aspects of an entity and ignoring its accidental. The idea of grouping software ideas into classes of things

Encapsulation and Information Hiding : Separating the external aspects of an object, which are accessible to other objects, from the internal implementation details of object, which are hidden from other objects

Polymorphism and Inheritance :

Object-Oriented System

Object-Oriented System

AbstractionAbstractionAbility of abstractions to share properties by inheritance hierarchy

Ability of abstractions to share properties by inheritance hierarchy

PolymorphismPolymorphismEncapsulationEncapsulation 5

Page 6: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Object and Classes

Object An object is a thing or concept. It can be a real-world thing or concept, or an abstraction of a thing or concept expressed as a software representation.An object has state (attributes) and behavior (method) Individual objects, also called instances, have identity and aredistinct things, and can be distinguished from other objects.

Classes A class is a description of a collection of objects with common attributes and behavior. In practice, the definition or specification of a class includes the definitions of the attributes comprising the state, the methods implementing the behavior, and how to handle creation and destruction of an object.

Object An object is a thing or concept. It can be a real-world thing or concept, or an abstraction of a thing or concept expressed as a software representation.An object has state (attributes) and behavior (method) Individual objects, also called instances, have identity and aredistinct things, and can be distinguished from other objects.

Classes A class is a description of a collection of objects with common attributes and behavior. In practice, the definition or specification of a class includes the definitions of the attributes comprising the state, the methods implementing the behavior, and how to handle creation and destruction of an object.

6

Page 7: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

An Introduction to the Object-Oriented Methodology

7

Page 8: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

What Are Analysis and Design For

Testing a physical entity before building systemCommunicating with CustomersVisualizationReduction of Complexity

8

Page 9: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Various Type of Methodologies

Shlaer/Mellor Method [Shlaer-1988]Coad/Yourdon Method [Coad-1991]Booch Method [Booch-1991]OMT Method [Rumbaugh-1991]Wirfs-Brock Method [Wirfs-Brock-1990]OOSE Objectory Method [Jacobson-1992]UML (Unified Modeling Language) [UML-1997]

9

Page 10: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Development Process

Object-Oriented Analysis

Object-Oriented Design

Object-Oriented Implementation

10

Page 11: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Object-Oriented Notation Guide

11

Page 12: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Class and ObjectClass Object Instances

Class Name

Attribute

Operation

Class Name

Attribute

Operation

Instantiation RelationshipInstantiation Relationship

Class NameClass Name12

Page 13: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Generalization and Inheritance

Superclass

Subclass 1 Subclass 2

13

Page 14: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

AggregationAggregation 1 Aggregation 2

Assembly Class Assembly Class

Part 1 Class Part 2 Class Part 1 Class Part 2 Class

14

Page 15: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

AssociationAssociation

Association NameClass 1 Class 2

Role 1 Role 2

Qualified AssociationAssociation Name

Class 1 Class 2qualifierRole 1 Role 2

Multiplicity of AssociationsMultiplicity of Associations

Class Class Class 1+

One or MoreExactly One Many 15

Page 16: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Ternary Association

Association Name

Class 1 Class 2Role 1 Role 2

Role 3

Class 3

16

Page 17: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Object-Oriented Analysis and Design

17

Page 18: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Analysis and Design ProcessProblem StatementSystem ArchitectureObject Modeling

Identifying Object ClassesPreparing a Data Dictionary for ClassesIdentifying AssociationsIdentifying AttributesRefining with InheritanceGrouping Classes into Modules

Dynamic ModelingFunctional Modeling

Problem StatementSystem ArchitectureObject Modeling

Identifying Object ClassesPreparing a Data Dictionary for ClassesIdentifying AssociationsIdentifying AttributesRefining with InheritanceGrouping Classes into Modules

Dynamic ModelingFunctional Modeling

18

Page 19: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Problem Statement

Requirements StatementProblem ScopeWhat is neededApplication ContextAssumptionsPerformance Needs

19

Page 20: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Example : ATM Network

CashierStation

20

ATM

ATM

ATM

CentralComputer

BankComputer

BankComputer

Account

Account

Account

Account

Page 21: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

System Architecture

ATM

Consortium Computer

Bank Computer

CashCard

Transaction

Consortium

Cashier

CashierStation

Account

Customer

CardAuthorization

Database

Transaction Transaction

User Interface

StationCode

Bank Code

ATM Station

PhoneLines

PhoneLinesUser

21

Page 22: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Identifying Object Classes

22

Extract nouns Eliminate spuriousClasses

Requirements

Statement

Object

Classes

Tentative

Object Classes

Redundant classesIrrelevant classesVague classesAttributesOperationsRolesImplementation constructs

Discard Unnecessary and Incorrect Classes

Discard Unnecessary and Incorrect Classes

Page 23: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Example: IOC for ATM NetworkBad Classes

CostUser

AccessTransaction

Log

SoftwareCommLine

ReceiptTransaction

Data

CashAccount

Data

SystemSecurityProvision

Record KeepingProvision

Banking Network

Vague Attribute Implementation

Redundant Irrelevant

Good Classes

Account ATM Bank Consortium Customer CashierCashierStation

CentralComputer

BankComputer Cash Card Transaction

23

Page 24: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Preparing a Data Dictionary

Isolated word have many interpretations, so prepare a data dictionary for all modeling entitiesDescribe the scope of the class within the current problem, including assumptions or restrictions on its membership or useThe data dictionary also describes associations, attributes, and operation

Isolated word have many interpretations, so prepare a data dictionary for all modeling entitiesDescribe the scope of the class within the current problem, including assumptions or restrictions on its membership or useThe data dictionary also describes associations, attributes, and operation

24

Page 25: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Example: DD for ATM NetworkAccount : a single account in a bank against which transactions can be applied. Account may be of various types, at least checking or savings. A customer can hold more than one account.Bank : A financial institution that holds accounts for customers and that issues cash cards authorizing access to accounts over the ATM network.ATM : …Bank Computer : …Cash Card : …Cashier : ...etc.

Account : a single account in a bank against which transactions can be applied. Account may be of various types, at least checking or savings. A customer can hold more than one account.Bank : A financial institution that holds accounts for customers and that issues cash cards authorizing access to accounts over the ATM network.ATM : …Bank Computer : …Cash Card : …Cashier : ...etc.

25

Page 26: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Identifying Associations

26

Extract verbs Eliminate spuriousassociations

Object

Classes

Tentative

associations

Associations

Associations between eliminated classesIrrelevant or implementation associationsActionsTernary associationsDerived associationsMisnamed associationsMultiplicity

Discard Unnecessary and Incorrect Associations

Discard Unnecessary and Incorrect Associations

Page 27: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Example: IAs for ATM NetworkHasHas

27

Consortium Ban

CentralComputer

BankComputer

RemoteTransaction

CashierTransaction

Cashier

CashierStation

Owns

Communicates with

Communicates with

Entered onEntered on

Entered onEntered on

Entered byEntered by

Owns

Owns

Authorized byAuthorized by

ConcernsConcerns

EmploysEmploysConcernsConcerns

ATM

k Code

Consists of HoldsBank Account

CashCard

HoldsCustomer

Communicates with

AccessesAccesses

HasHas

Page 28: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Identifying AttributesTentative attributes

28

Extract object properties

Eliminate spuriousattributes

Object

Classes

Attributes

ObjectsQualifiersNamesIdentifiersLink attributesInternal valuesFine detailDiscordant attributes

Discard Unnecessary and Incorrect Attributes

Discard Unnecessary and Incorrect Attributes

Page 29: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Example: IAT for ATM Network

29

CentralComputer Bank

Computer

RemoteTransaction

CashierTransaction

CashCard

Cashier

CashierStation

Owns

Communicates with

Communicates with

Entered onEntered on

Entered onEntered on

Entered byEntered by

Owns

Owns

Authorized byAuthorized by

HasHas

EmploysEmploysConcernsConcerns

Bank Code

Station Code

nameStation Code

Employee Code

Balancecredit limit

type

Station Code

Kinddate-timeamount

Kinddate-timeamount

name

password

Card Code

Consortium

ATM

Bank Code

Bank AccountCustomer

Consists of

Communicates with

HoldsHolds

HasHas

AccessesAccesses

ConcernsConcerns

cash on handdispensed

Account Code

IssuesIssues

nameaddress

Page 30: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Refining With Inheritance

This step is to organize classes by using inheritance to share common structureInheritance can be added in two directions :

Bottom Up : By generalizing common aspect of existing classes into a superclasses

By searching for classes with similar attributes, associations, or operationsFor each generalization, define a superclass to share common features

Top Down : By refining existing classes into specialized subclasses

This step is to organize classes by using inheritance to share common structureInheritance can be added in two directions :

Bottom Up : By generalizing common aspect of existing classes into a superclasses

By searching for classes with similar attributes, associations, or operationsFor each generalization, define a superclass to share common features

Top Down : By refining existing classes into specialized subclasses

30

Page 31: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Example: RWI for ATM Network

31

TransactionKind

date-timeamount

cash on handdispensed

CentralComputer

Bank Code

Station Code

BankComputer

Station Code

Bankname

Account Code

Station Code

Card Code

Employee Code

CashierStation

CashierTransaction

RemoteTransaction

CashCard

password

Communicates with

Communicates with

Communicateswith

Communicateswith

Owns

Owns

Owns

ConcernsConcerns

Authorized byAuthorized byEntered byEntered by

HoldsHolds

IssuesIssuesHasHas

ATM Entered onEntered on

ATM

Cashiername

EmploysEmploys Customername

address AccessesAccesses

Consortium Bank Code

HasAccount

Has

Balancecredit limit

type

Consists ofConsists of

Page 32: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Grouping Classes into ModulesA module is a set of classes that captures some logical subset of entire modelFor example: a model of computer operating system might contain modules for process control, device control, file maintenance, and memory management

32

Page 33: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Example: GCIM for ATM Network

Tellers: Cashier, Entry Station, Cashier Station, ATMAccount: Account, Cash Card, Card Authorization, Customer, Transaction, Update, Cashier Transaction, Remote TransactionBanks: Consortium, Bank

33

Page 34: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Dynamic Model

The dynamic model shows the time-dependent behavior of the system and the objects in it.Begin dynamic analysis by looking for event, externally visible stimuli and responses.The dynamic model is important for interactive systems, but insignificant for purely static data repository, such as database.

The dynamic model shows the time-dependent behavior of the system and the objects in it.Begin dynamic analysis by looking for event, externally visible stimuli and responses.The dynamic model is important for interactive systems, but insignificant for purely static data repository, such as database. 34

Page 35: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Dynamic Model

The following steps are performed in constructing a dynamic model

Prepare scenarios of typical interaction sequencesIdentify events between objectsPrepare an event trace for each scenarioBuild a state diagramMatch events between objects to verify consistency

The following steps are performed in constructing a dynamic model

Prepare scenarios of typical interaction sequencesIdentify events between objectsPrepare an event trace for each scenarioBuild a state diagramMatch events between objects to verify consistency

35

Page 36: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Example: DM for ATM NetworkUser ATM Consortium Bank

Insert card

request password

enter passwordverify account

verify card with bank

account OK bank account OK

request kind

enter kind

request amount

enter amountprocess transaction

process bank transaction

bank transaction succeed

36

dispense cashdispense cashtransaction succeed

request take cashrequest take cash

take cashtake cash

take cardtake card

display main screendisplay main screen

Page 37: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Functional Model

The functional model shows how values are computed, without regard for sequencing, decisions, or object structureThe functional model shows which values depend on which other values and the functions that relate themData flow diagrams are useful for showing functional dependencies

The functional model shows how values are computed, without regard for sequencing, decisions, or object structureThe functional model shows which values depend on which other values and the functions that relate themData flow diagrams are useful for showing functional dependencies

37

Page 38: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Example: FM for ATM Network

AccountCashCard

38User

read inputs

bank code,card codebank code,card code balancebalance

performtransaction

generateoutputs

Messages,cash,receipt

Messages,cash,receipt

password,transaction kind,amount,account type

password,transaction kind,amount,account type

Page 39: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Object-Oriented Implementation

39

Page 40: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

Implementation ProcessClass DefinitionCreating ObjectsCalling OperationsUsing InheritanceImplementing Association

40

Page 41: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

References -1-

[Booch-1991] Grady Booch, Object-Oriented Analysis and Design with Application, Benjamin/Cummings, 1991.[Booch-1999] Grady Booch, James Rumbaugh, and IvarJacobson, The Unified Modeling Language User Guide, Addison-Wesley, 1999.[Coad-1991] Peter Coad and Edward Yourdon, Object-Oriented Analysis, Yourdon Press, 1991.[Jacobson-1992] Ivar Jacobson, Magnus Christerson, Patrik Jonson, and Gunnar Overgaard, Object-Oriented Software Engineering: A Use Case Driven Approach, Addison-Wesley, 1992.

[Booch-1991] Grady Booch, Object-Oriented Analysis and Design with Application, Benjamin/Cummings, 1991.[Booch-1999] Grady Booch, James Rumbaugh, and IvarJacobson, The Unified Modeling Language User Guide, Addison-Wesley, 1999.[Coad-1991] Peter Coad and Edward Yourdon, Object-Oriented Analysis, Yourdon Press, 1991.[Jacobson-1992] Ivar Jacobson, Magnus Christerson, Patrik Jonson, and Gunnar Overgaard, Object-Oriented Software Engineering: A Use Case Driven Approach, Addison-Wesley, 1992.

41

Page 42: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

References -2-[ Jacobson-1999] Ivar Jacobson, Grady Booch, and James Rumbaugh, The Unified Software Development Process, Addison-Wesley, 1999.[Rumbaugh-1991] James Rumbaugh, Michael Blaha, William Premerlani, Frederick Eddy, and William Lorenson, Object-Oriented Modeling and Design, Prentice Hall, 1991.[Rumbaugh-1999] James Rumbaugh, Ivar Jacobson, and Grady Booch, The Unified Modeling Language Reference Manual, Addison-Wesley, 1999.[Shlaer-1988] Sally Shlaer and Stephen J. Mellor, Object-Oriented System Analysis: Modeling the World in Data, Yourdon Press, 1988.

[ Jacobson-1999] Ivar Jacobson, Grady Booch, and James Rumbaugh, The Unified Software Development Process, Addison-Wesley, 1999.[Rumbaugh-1991] James Rumbaugh, Michael Blaha, William Premerlani, Frederick Eddy, and William Lorenson, Object-Oriented Modeling and Design, Prentice Hall, 1991.[Rumbaugh-1999] James Rumbaugh, Ivar Jacobson, and Grady Booch, The Unified Modeling Language Reference Manual, Addison-Wesley, 1999.[Shlaer-1988] Sally Shlaer and Stephen J. Mellor, Object-Oriented System Analysis: Modeling the World in Data, Yourdon Press, 1988. 42

Page 43: Object-Oriented Analysis and Design Methodologyromisatriawahono.net/publications/2000/romi-ooad.pdf · Object-Oriented Analysis and Design Methodology ... Object-Oriented Analysis

References -3-[UML-1999] Unified Modeling Language Specification, Object Management Group, www.omg.org, 1999.[Wirfs-Brock-1990] Rebecca Wirfs-Brock, Brian Wilkerson, and Lauren Wiener, Designing Object-Oriented Software, Prentice Hall, 1990.

43