47
Introduction to Object Introduction to Object Orientation System Orientation System Analysis and Design Analysis and Design

Introduction to Object Orientation System Analysis and Design

Embed Size (px)

Citation preview

Page 1: Introduction to Object Orientation System Analysis and Design

Introduction to Object Introduction to Object Orientation System Analysis Orientation System Analysis

and Designand Design

Page 2: Introduction to Object Orientation System Analysis and Design

ObjectivesObjectives Understand the basic characteristics of Understand the basic characteristics of

object-oriented systems.object-oriented systems. Understand the object orientation notationUnderstand the object orientation notation Understand how to analyze and design with Understand how to analyze and design with

OO paradigmOO paradigm

Page 3: Introduction to Object Orientation System Analysis and Design

What’s Object Orientation?What’s Object Orientation? A new technology based on objects and A new technology based on objects and

classesclasses A paradigm (way of thingking) to organize A paradigm (way of thingking) to organize

software as a collection of discrete objects software as a collection of discrete objects that incorporate both data and process.that incorporate both data and process.

An abstraction of the real world based on An abstraction of the real world based on objects and their interactions with other objects and their interactions with other objects.objects.

Page 4: Introduction to Object Orientation System Analysis and Design

Basic CharacteristicBasic Characteristic

(1) Classes and Objects(1) Classes and Objects OO focus on capturing structure and OO focus on capturing structure and

behaviour in little modules that encompass behaviour in little modules that encompass both data and process. These modules are both data and process. These modules are known as OBJECTs.known as OBJECTs.

Class is a general template we use to define Class is a general template we use to define and create specific instances or objects.and create specific instances or objects.

An object is an instantiation of a class.An object is an instantiation of a class. Each object has attributes (describe the object) Each object has attributes (describe the object)

and behaviors (what an object can do).and behaviors (what an object can do).

Page 5: Introduction to Object Orientation System Analysis and Design

Class Car

Attributes Model Location #Wheels = 4

Operations Start Accelerate

<<instanceOf>>

<<instanceOf>>

<<instanceOf>>

Page 6: Introduction to Object Orientation System Analysis and Design

Basic Characteristic (2)Basic Characteristic (2)

(2) Methods and Messages(2) Methods and Messages Methods implement an object’s behaviourMethods implement an object’s behaviour In other languages, method is known as In other languages, method is known as

procedure or function.procedure or function. A message is a function or procedure call from A message is a function or procedure call from

one object to another object.one object to another object.

Page 7: Introduction to Object Orientation System Analysis and Design

Basic Characteristic (3)Basic Characteristic (3)

Page 8: Introduction to Object Orientation System Analysis and Design

Basic Characteristic (4)Basic Characteristic (4)

(3) Encapsulation and Information Hiding(3) Encapsulation and Information Hiding Encapsulation : how to wrap process and data Encapsulation : how to wrap process and data

into a single entity.into a single entity. Only the information required to use a software Only the information required to use a software

module is published to the user. Exactly how module is published to the user. Exactly how the module implements the required the module implements the required information is unnecessary.information is unnecessary.

Page 9: Introduction to Object Orientation System Analysis and Design

Basic Characteristic (5)Basic Characteristic (5)

(4) Inheritance(4) Inheritance Is a mechanism to create a class from other Is a mechanism to create a class from other

class.class. Related terms : superclass and subclassRelated terms : superclass and subclass Subclass inherit the appropriate attributes and Subclass inherit the appropriate attributes and

methods from its superclass.methods from its superclass. Avoid repeating of writing attributes or Avoid repeating of writing attributes or

methods.methods. The relationship between the class and its The relationship between the class and its

superclass is known as the superclass is known as the A-Kind-OfA-Kind-Of relationship.relationship.

Page 10: Introduction to Object Orientation System Analysis and Design

Basic Characteristic (6)Basic Characteristic (6)

Page 11: Introduction to Object Orientation System Analysis and Design

(5) Polymorphism and Dynamic Binding(5) Polymorphism and Dynamic Binding Polymorphism : the same message can be Polymorphism : the same message can be

interpreted differently by different classes of interpreted differently by different classes of objects.objects.

For example : sent message “draw” to an circle For example : sent message “draw” to an circle object, a square object, and a triangle object object, a square object, and a triangle object will make a different result.will make a different result.

Dynamic Binding : determining the exact Dynamic Binding : determining the exact implementation of a request based on both the implementation of a request based on both the request (operation) name and the receiving request (operation) name and the receiving object at run-timeobject at run-time

Page 12: Introduction to Object Orientation System Analysis and Design
Page 13: Introduction to Object Orientation System Analysis and Design

Various MethodologiesVarious Methodologies Shlaer/Mellor methods (Shlaer-1988)Shlaer/Mellor methods (Shlaer-1988) Coad/Yourdon methods (Coad-1991)Coad/Yourdon methods (Coad-1991) Booch methods (Booch-1991)Booch methods (Booch-1991) OMT methods (Rumbaugh-1991)OMT methods (Rumbaugh-1991) Wirfs-Brock methods (Wirfs-Brock-1990)Wirfs-Brock methods (Wirfs-Brock-1990) OOSE Objectory methods (Jacobson-1992)OOSE Objectory methods (Jacobson-1992) Unified Modelling Languages (UML-1997)Unified Modelling Languages (UML-1997)

Page 14: Introduction to Object Orientation System Analysis and Design
Page 15: Introduction to Object Orientation System Analysis and Design

OBJECT ORIENTED OBJECT ORIENTED NOTATION GUIDENOTATION GUIDE

Page 16: Introduction to Object Orientation System Analysis and Design

Class and ObjectClass and Object

ClassClass

Instantiation Instantiation relationshiprelationship

Object Object instanceinstance

Class Name

Attributes

Methods

Class name

Attributes

Methods

Class Name Class Name

Page 17: Introduction to Object Orientation System Analysis and Design

Generalization and InheritanceGeneralization and Inheritance

Page 18: Introduction to Object Orientation System Analysis and Design

AggregationAggregation

Aggregation 1Aggregation 1 Aggregation 2Aggregation 2

Page 19: Introduction to Object Orientation System Analysis and Design

AssociationAssociation AssociationAssociation

Multiplicity of associationMultiplicity of association

Page 20: Introduction to Object Orientation System Analysis and Design

Ternary AssociationTernary Association

Page 21: Introduction to Object Orientation System Analysis and Design

OBJECT ORIENTED OBJECT ORIENTED ANALYSIS AND DESIGNANALYSIS AND DESIGN

Page 22: Introduction to Object Orientation System Analysis and Design

Analysis and Design ProcessAnalysis and Design Process

1.1. Problem statementProblem statement

2.2. System architectureSystem architecture

3.3. Object modellingObject modelling1.1. Identifying object classesIdentifying object classes2.2. Preparing a data dictionary for classesPreparing a data dictionary for classes3.3. Identifying associationIdentifying association4.4. Identifying attributesIdentifying attributes5.5. Refining with inheritanceRefining with inheritance6.6. Grouping classes into modelGrouping classes into model

4.4. Dynamic modellingDynamic modelling

5.5. Functional modellingFunctional modelling

Page 23: Introduction to Object Orientation System Analysis and Design

PROBLEM STATEMENTSPROBLEM STATEMENTS

Page 24: Introduction to Object Orientation System Analysis and Design

Problem StatementProblem Statement Requirements statementRequirements statement

Problem scopeProblem scope What’s neededWhat’s needed Application contextApplication context AssumptionsAssumptions Performance needsPerformance needs

Page 25: Introduction to Object Orientation System Analysis and Design

Example : ATM NetworkExample : ATM Network

Page 26: Introduction to Object Orientation System Analysis and Design

System ArchitectureSystem Architecture

Page 27: Introduction to Object Orientation System Analysis and Design

Identifying Object ClassesIdentifying Object Classes

Page 28: Introduction to Object Orientation System Analysis and Design

Example : ATM NetworkExample : ATM Network

Page 29: Introduction to Object Orientation System Analysis and Design

Preparing a Data DictionaryPreparing a Data Dictionary

Page 30: Introduction to Object Orientation System Analysis and Design

ExampleExample AccountAccount : a single account in a bank against : a single account in a bank against

which transactions can be applied. Account which transactions can be applied. Account may be of various types, at least checking or may be of various types, at least checking or savings. A customer can hold more than one savings. A customer can hold more than one account.account.

BankBank : A financial institution that holds : A financial institution that holds accounts for customers and that issues cash accounts for customers and that issues cash cards authorizing access to accounts over the cards authorizing access to accounts over the ATM network.ATM network.

ATMATM : … : … Bank ComputerBank Computer : …. : …. CustomerCustomer : … : … etcetc

Page 31: Introduction to Object Orientation System Analysis and Design

Identifying AssociationsIdentifying Associations

Page 32: Introduction to Object Orientation System Analysis and Design

ExampleExample

Page 33: Introduction to Object Orientation System Analysis and Design

Identifying AttributesIdentifying Attributes

Page 34: Introduction to Object Orientation System Analysis and Design

ExampleExample

Page 35: Introduction to Object Orientation System Analysis and Design

Refining with InheritanceRefining with Inheritance This step is to organize classes by using This step is to organize classes by using

inheritance to share common structureinheritance to share common structure Inheritance can be added in two directions :Inheritance can be added in two directions :

Bottom Up Bottom Up : : By generalizing common aspect By generalizing common aspect of existing classes into a superclassesof existing classes into a superclassesBy searching for classes with similar attributes, By searching for classes with similar attributes,

associations, or operationsassociations, or operationsFor each generalization, define a superclass to For each generalization, define a superclass to

share common featuresshare common features Top Down Top Down : : By refining existing classes into By refining existing classes into

specialized subclassesspecialized subclasses

Page 36: Introduction to Object Orientation System Analysis and Design

ExampleExample

Page 37: Introduction to Object Orientation System Analysis and Design

Grouping Class into ModulesGrouping Class into Modules A module is a set of classes that captures A module is a set of classes that captures

some logical subset of entire modelsome logical subset of entire model For example: a model of computer operating For example: a model of computer operating

system might contain modules for process system might contain modules for process control, device control, file maintenance, and control, device control, file maintenance, and memory managementmemory management

Page 38: Introduction to Object Orientation System Analysis and Design

ExampleExample Tellers : Cashier, Entry Station, Cashier Tellers : Cashier, Entry Station, Cashier

Station, ATMStation, ATM Account: Account, Cash Card, Card Account: Account, Cash Card, Card

Authorization, Customer, Transaction, Update, Authorization, Customer, Transaction, Update, Cashier Transaction, Remote TransactionCashier Transaction, Remote Transaction

Banks: Consortium, BankBanks: Consortium, Bank

Page 39: Introduction to Object Orientation System Analysis and Design

DYNAMIC MODELDYNAMIC MODEL

Page 40: Introduction to Object Orientation System Analysis and Design

Dynamic ModelDynamic Model The dynamic model shows the time-The dynamic model shows the time-

dependent behavior of the system and the dependent behavior of the system and the objects in it.objects in it.

Begin dynamic analysis by looking for event, Begin dynamic analysis by looking for event, externally visible stimuli and responses.externally visible stimuli and responses.

The dynamic model is important for The dynamic model is important for interactive systems, but insignificant for interactive systems, but insignificant for purely static data repository, such as purely static data repository, such as database.database.

Page 41: Introduction to Object Orientation System Analysis and Design

The following steps are performed in The following steps are performed in constructing a dynamic model :constructing a dynamic model :1.1. Prepare scenarios of typical interaction Prepare scenarios of typical interaction

sequencessequences2.2. Identify events between objectsIdentify events between objects3.3. Prepare an event trace for each scenarioPrepare an event trace for each scenario4.4. Build a state diagramBuild a state diagram5.5. Match events between objects to verify Match events between objects to verify

consistencyconsistency

Page 42: Introduction to Object Orientation System Analysis and Design

ExampleExample

Page 43: Introduction to Object Orientation System Analysis and Design

FUNCTIONAL MODELFUNCTIONAL MODEL

Page 44: Introduction to Object Orientation System Analysis and Design

Functional ModelFunctional Model The functional model shows how values are The functional model shows how values are

computed, without regard for sequencing, computed, without regard for sequencing, decisions, or object structuredecisions, or object structure

The functional model shows which values The functional model shows which values depend on which other values and the depend on which other values and the functions that relate themfunctions that relate them

Data flow diagrams are useful for showing Data flow diagrams are useful for showing functional dependenciesfunctional dependencies

Page 45: Introduction to Object Orientation System Analysis and Design

ExampleExample

Page 46: Introduction to Object Orientation System Analysis and Design

OBJECT ORIENTATION OBJECT ORIENTATION IMPLEMENTATIONIMPLEMENTATION

Page 47: Introduction to Object Orientation System Analysis and Design

Implementation ProcessImplementation Process Class DefinitionClass Definition Creating ObjectsCreating Objects Calling OperationsCalling Operations Using InheritanceUsing Inheritance Implementing AssociationImplementing Association