OBJECT ORIENTED ANALYSIS - PowerPoint PPT Presentation

1 / 57
About This Presentation
Title:

OBJECT ORIENTED ANALYSIS

Description:

Title: Slide 1 Author: Mar Yah Last modified by: Khairul Azhar Kasmiran Created Date: 1/12/2003 3:49:18 AM Document presentation format: On-screen Show – PowerPoint PPT presentation

Number of Views:74
Avg rating:3.0/5.0
Slides: 58
Provided by: MarY234
Category:

less

Transcript and Presenter's Notes

Title: OBJECT ORIENTED ANALYSIS


1
CHAPTER 6
  • OBJECT ORIENTED ANALYSIS

2
Learning Objectives
  • Understand object oriented concepts
  • Be able to understand and/or draw object oriented
    analysis modeling
  • Use case diagram
  • Activity diagram
  • Class diagram
  • Sequence diagram
  • Collaboration diagram
  • State diagram

3
Object-Oriented Concepts
  • Must be understood to apply class-based elements
    of the analysis model
  • Key concepts
  • Classes and objects
  • Attributes and operations
  • Encapsulation and instantiation
  • Inheritance

4
Classes
  • object-oriented thinking begins with the
    definition of a class, often defined as
  • template
  • generalized description
  • blueprint ... describing a collection of
    similar items
  • a superclass establishes a hierarchy of classes
  • once a class of items is defined, a specific
    instance of the class can be identified

5
Building a Class
Class name
Attributes
Operations
6
Encapsulation/Hiding
Class encapsulates both data and the
logical procedures required to manipulate the data
Reduces the propagation of side effects when
changes occur
method 2
method 1
data
method 3
method 6
method 4
method 5
Achieves information hiding
7
Class Hierarchy
PieceOfFurniture (superclass)
Table
Chair
Desk
Chable"
Subclass inherit both attributes and operations
from a superclass
subclasses of the
Subclasses of the furniture superclass
Instances of chair
instances of Chair
8
Methods(a.k.a. Operations, Services)
An executable procedure that is encapsulated in a
class and is designed to operate on one or more
data attributes that are defined as part of the
class. A method is invoked via message passing.
9
Attributes
A collection of data values that describe a
class
10
  • Objects
  • Instances of a specific class
  • Inherit a class attributes and operations
  • Class STUDENT
  • Object instance (object) Ali
  • attributes name, date of birth, etc.
  • operations calc_age, calc_cgpa, etc.

11
Example
STUDENT
Name DOB Address Phone
Calculate_age Calculate_gpa Register_course
12
Object Oriented Analysis (OOA)
  • Based on objects rather than data or processes
  • The intent of OOA is to define all classes (and
    the relationships and behavior with them) that
    are relevant to the problem to be solved
  • There are various OOA methods. Booch Method,
    Jacobson Method and Rumbaugh Method have
    collaborated into.

Unified Approach Unified Modeling Language (UML)
13
THE OOA PROCESS
Use Case Modeling shows functions
Class-based Modeling Class diagram, CRC
Behavioral Model State Diagram, Sequence Diagram
14
  • USE CASE MODELING
  • Illustrates the manner in which an actor
    interacts with the system
  • Actor Anything that communicates with the
    system and that is external to the system
  • Can be people or devices
  • Represent the roles that people/devices play as
    the system operates
  • Use Case
  • Depiction of a systems behavior or functionality
    under various conditions as the system responds
    to requests from users
  • Full functioning for a specific business purpose

Represent actor
Represent a use case
15
Use-Cases
  • A collection of user scenarios that describe the
    thread of usage of a system
  • Each scenario is described from the point-of-view
    of an actor
  • Each scenario answers the following questions
    (eg refer handout Use Case Template for
    Surveillance)
  • Who is the primary actor, the secondary actor
    (s)?
  • What are the actors goals?
  • What preconditions should exist before the story
    begins?
  • What main tasks or functions are performed by the
    actor?
  • What extensions might be considered as the story
    is described?
  • What variations in the actors interaction are
    possible?
  • What system information will the actor acquire,
    produce, or change?
  • Will the actor have to inform the system about
    changes in the external environment?
  • What information does the actor desire from the
    system?
  • Does the actor wish to be informed about
    unexpected changes?

16
Use-Case Diagram
S
a
f
e
H
o
m
e
c
a
m
e
r
a
s
C
o
n
f
i
g
u
r
e

S
a
f
e
H
o
m
e

s
y
s
t
e
m

p
a
r
a
m
e
t
e
r
s
S
e
t

a
l
a
r
m
17
Eg consider the interactions between a Bank
Customer and an ATM
Bank ATM Machine
Withdraw Cash
Check Balance
Bank Customer
Create Online Transaction
18
Writing Use-Cases (Scenario)
  • Use caseAccess camera surveillance-display
    camera views (ACS-DCV)
  • Actorhomeowner
  • If Im at remote location, I can use any PC with
    appropriate browser software to log on to the
    SafeHome Products Web site. I enter my user ID
    and two levels of passwords and, once Im
    validated, I have access to all functionality for
    my installed SafeHome system. To access specific
    camera view, I select surveillance from the
    major function buttons displayed, I then select
    pick camera, and the floor plan of the house is
    displayed. I then select the camera that Im
    interested in. Alternatively, I can look at
    thumbnail snapshots from all cameras
    simultaneously by selecting all cameras as my
    viewing choice. Once I choose a camera, I select
    view and a one-frame-per-second view appears in
    a viewing window that is identified by the camera
    ID. If I want to switch cameras, I select pick a
    camera and the original viewing window
    disappears and the floor plan of the house is
    displayed again. I then select the camera that
    Im interested in. A new viewing window appears.
  • A variation of this narrative use case is an
    ordered sequence of user actions refer handout
    Use Case Template for Surveillance (Pressman,
    R. (2005). Software Engineering A
    Practitioner's Approach, 6th edition. New York
    McGraw-Hill)
  • .

19
Use-Case Modeling
  • Relationships Between Use Cases
  • Use cases may participate in relationships with
    other use-cases
  • Two types
  • Extends
  • Adds new behaviors or actions to a use case
  • Include
  • One use case references another use case

20.19
20
Example Use-case diagram for a university
registration system (Correction arrow direction
should be in opposite direction)
20.20
21
(No Transcript)
22
Activity Diagram
  • Supplements the use-case by providing a
    diagrammatic representation of procedural flow
  • May adds additional detail not directly
    mentioned by the use case

Activity/Function
Flow/Transition
Decision
23
An activity diagram for Access Camera surveillance
24
ATM Authorization
Masuk kad
Baca kad
Minta PIN
Masuk PIN
Tidak
Sahkan PIN
Adakah sah?
Ya
Pilih servis
25
Class-Based Modeling
  • Identify analysis classes by examining the
    problem statement
  • Use a grammatical parse to isolate potential
    classes
  • Identify the attributes of each class
  • Identify operations that manipulate the attributes

26
Analysis Classes
  • External entities (e.g., other systems, devices,
    people) that produce or consume information to be
    used by a computer-based system.
  • Things (e.g, reports, displays, letters, signals)
    that are part of the information domain for the
    problem.
  • Occurrences or events (e.g., a property transfer
    or the completion of a series of robot movements)
    that occur within the context of system
    operation.
  • Roles (e.g., manager, engineer, salesperson)
    played by people who interact with the system.
  • Organizational units (e.g., division, group,
    team) that are relevant to an application.
  • Places (e.g., manufacturing floor or loading
    dock) that establish the context of the problem
    and the overall function of the system.
  • Structures (e.g., sensors, four-wheeled vehicles,
    or computers) that define a class of objects or
    related classes of objects.

27
Selecting ClassesCriteria
  • Retained Information
  • Needed services have a set of identifiable
    operations
  • Multiple attributes
  • Common attributes
  • Common operations
  • Essential requirements

28
CRC Modeling
  • Analysis classes have responsibilities
  • Responsibilities are the attributes and
    operations encapsulated by the class
  • Analysis classes collaborate with one another
  • Collaborators are those classes that are
    required to provide a class with the information
    needed to complete a responsibility.
  • In general, a collaboration implies either a
    request for information or a request for some
    action.

29
CRC Modeling
30
Class Types
  • Entity classes, also called model or business
    classes, are extracted directly from the
    statement of the problem (e.g., FloorPlan and
    Sensor).
  • Boundary classes are used to create the interface
    (e.g., interactive screen or printed reports)
    that the user sees and interacts with as the
    software is used.
  • Controller classes manage a unit of work
    UML03 from start to finish. That is, controller
    classes can be designed to manage
  • the creation or update of entity objects
  • the instantiation of boundary objects as they
    obtain information from entity objects
  • complex communication between sets of objects
  • validation of data communicated between objects
    or between the user and the application.

31
Responsibilities
  • System intelligence should be distributed across
    classes to best address the needs of the problem
  • Each responsibility should be stated as generally
    as possible
  • Information and the behavior related to it should
    reside within the same class
  • Information about one thing should be localized
    with a single class, not distributed across
    multiple classes.
  • Responsibilities should be shared among related
    classes, when appropriate.

32
Collaborations
  • Classes fulfill their responsibilities in one of
    two ways
  • A class can use its own operations to manipulate
    its own attributes, thereby fulfilling a
    particular responsibility, or
  • a class can collaborate with other classes.
  • Collaborations identify relationships between
    classes
  • Collaborations are identified by determining
    whether a class can fulfill each responsibility
    itself
  • three different generic relationships between
    classes WIR90
  • the is-part-of relationship
  • the has-knowledge-of relationship
  • the depends-upon relationship

33
Composite Aggregate Class
34
Associations
  • Two analysis classes are often related to one
    another in some fashion
  • In UML these relationships are called
    associations
  • Associations can be refined by indicating
    multiplicity (the term cardinality is used in
    data modeling

35
Multiplicity
36
Behavioral Modeling
  • The behavioral model indicates how software will
    respond to external events or stimuli. To create
    the model, the analyst must perform the following
    steps
  • Evaluate all use-cases to fully understand the
    sequence of interaction within the system.
  • Identify events that drive the interaction
    sequence and understand how these events relate
    to specific objects.
  • Create a sequence for each use-case.
  • Build a state diagram for the system.
  • Review the behavioral model to verify accuracy
    and consistency.

37
State Representations
  • In the context of behavioral modeling, two
    different characterizations of states must be
    considered
  • the state of each class as the system performs
    its function and
  • the state of the system as observed from the
    outside as the system performs its function

38
The States of a System
  • statea set of observable circum-stances that
    characterizes the behavior of a system at a given
    time
  • state transitionthe movement from one state to
    another
  • eventan occurrence that causes the system to
    exhibit some predictable form of behavior
  • actionprocess that occurs as a consequence of
    making a transition

39
Behavioral Modeling
  • make a list of the different states of a system
    (How does the system behave?)
  • indicate how the system makes a transition from
    one state to another (How does the system change
    state?)
  • indicate event
  • indicate action
  • draw a state diagram or a interaction diagram
    (sequence diagram or collaboration diagram)

40
Sequence diagram
  • A representation of how events cause flow from
    one object to another as a function of time.
  • Events are identified by examining a use case
  • Is a shorthand version of a use case
  • Sequence diagram consists of
  • Objects
  • Lifeline
  • Messages/Event

41
Sequence Diagram
anOrder
Object Object and Class
anOrder Order
Message/event
prepare()
needsToReorder()
Self Delegation
42
object
Object A Class A
Object B Class B
messageA( )
message
messageB(string)
messageC( )
activation (optional)
lifeline
43
Identifying events with the Use-Case
  • Use case for a small portion of the SafeHome
    security function
  • The homeowner uses the keypad to key in a
    four-digit password. The password is compared
    with the valid password stored in the system. If
    the password is incorrect, the control panel will
    beep once and reset itself for additional input.
    If the password is correct, the control panel
    awaits further action.

44
Sequence Diagram
45
Class diagram
Sequence diagram
Bob ClockStaff
Ali User
printRecord( )
STAFF printRecord calculateSalary
CLOCKSTAFF printRecord calculateSalary
COMISSIONSTAFF printRecord calculateSalary
Bob ClockStaff
Ali User
calculateSalary( )
46
DeliveryItem
itemnumberquantityetc
new()
is_for
ReOrderItem
StockItem
itemnumberquantityetc
orderNumberminQuantitydateetc
OrderEntryWindow
new()
choose()
check()boolean remove() needsToReorder()
boolean
47
AReorder Item
aDelivery Item
new
checktrue new
48
Computer
PrintServer
Printer
status() integer
print(file)
uses
print(filename)
print(file)
Managed by
Queue
store(file)
49
aComputer Computer
aPrintServer PrintServer
aPrinter Printer
aQueue Queue
aUser User
print(file)
printer free print(file)
50
Collaboration Diagram
  • Shows the relationships among objects
  • Consists of
  • Objects
  • Lines connecting the objects
  • Messages

Object A
Object C
2. Message2 3. Message3
Object B
1. message1
51
1. keyInCourseInfo
CourseForm
Interaction diagrams
Student
2. addCourse
CourseForm
AcademicStaff
StudentSchedule
AcademicStaff
Student
3. newCourse
keyInCourseInfo
addCourse
StudentSchedule
newCourse
52
State Diagram
  • Indicates how an individual class changes state
    based on external events
  • Represents states for each class and the events
    (triggers) that cause changes between these
    states
  • One state diagram for each class.
  • Event causes the transition, the labels for
    each arrow
  • Action occurs concurrently with the state
    transition or as a consequence of it. Generally
    involves one or more operations
    (responsibilities)
  • Transition represented by an arrow
  • Guard condition a boolean condition that must be
    satisfied in order for the transition to occur
  • Activity - represents a long-running task during
    that state.
  • Actions vs activity
  • Actions cannot be interrupted, activity can be
    interrupted by an incoming event. 
  • Both represent an operation on the object being
    studied. 
  • For example, an operation that sets an attribute
    would be considered an action, while a long
    calculation might be an activity. 

53
State-Diagram Notation
An operation that is perform when an object is in
a certain state
54
Example State Diagram
55
Class CourseSchedule
bina jadual kursus
Initialization
dibuka pd pelajar
ditutup kuota penuh
add student/numStudent0
addstudent numStudent50
Open
Closed
add student numStudentlt50
cancel
cancel
Cancelled
delete
Dibatalkan atau tidak ditawarkan lagi
doSend cancellation notices
56
State Diagram for the ControlPanel Class
57
State Diagram
Write a Comment
User Comments (0)
About PowerShow.com