Upload
dylan-corcoran
View
242
Download
0
Tags:
Embed Size (px)
Citation preview
Introduction to Object Introduction to Object Orientation System Analysis Orientation System Analysis
and Designand 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
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.
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).
Class Car
Attributes Model Location #Wheels = 4
Operations Start Accelerate
<<instanceOf>>
<<instanceOf>>
<<instanceOf>>
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.
Basic Characteristic (3)Basic Characteristic (3)
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.
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.
Basic Characteristic (6)Basic Characteristic (6)
(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
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)
OBJECT ORIENTED OBJECT ORIENTED NOTATION GUIDENOTATION GUIDE
Class and ObjectClass and Object
ClassClass
Instantiation Instantiation relationshiprelationship
Object Object instanceinstance
Class Name
Attributes
Methods
Class name
Attributes
Methods
Class Name Class Name
Generalization and InheritanceGeneralization and Inheritance
AggregationAggregation
Aggregation 1Aggregation 1 Aggregation 2Aggregation 2
AssociationAssociation AssociationAssociation
Multiplicity of associationMultiplicity of association
Ternary AssociationTernary Association
OBJECT ORIENTED OBJECT ORIENTED ANALYSIS AND DESIGNANALYSIS 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
PROBLEM STATEMENTSPROBLEM STATEMENTS
Problem StatementProblem Statement Requirements statementRequirements statement
Problem scopeProblem scope What’s neededWhat’s needed Application contextApplication context AssumptionsAssumptions Performance needsPerformance needs
Example : ATM NetworkExample : ATM Network
System ArchitectureSystem Architecture
Identifying Object ClassesIdentifying Object Classes
Example : ATM NetworkExample : ATM Network
Preparing a Data DictionaryPreparing a Data Dictionary
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
Identifying AssociationsIdentifying Associations
ExampleExample
Identifying AttributesIdentifying Attributes
ExampleExample
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
ExampleExample
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
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
DYNAMIC MODELDYNAMIC MODEL
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.
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
ExampleExample
FUNCTIONAL MODELFUNCTIONAL MODEL
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
ExampleExample
OBJECT ORIENTATION OBJECT ORIENTATION IMPLEMENTATIONIMPLEMENTATION
Implementation ProcessImplementation Process Class DefinitionClass Definition Creating ObjectsCreating Objects Calling OperationsCalling Operations Using InheritanceUsing Inheritance Implementing AssociationImplementing Association