Chapter 5, Analysis: Object Modeling - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Chapter 5, Analysis: Object Modeling

Description:

... phone number, fax number, and address of the ... phone. fax. add ... phone, fax, address. Penultimate Floss:Supplier. Search for Supplier. Search ... – PowerPoint PPT presentation

Number of Views:351
Avg rating:3.0/5.0
Slides: 29
Provided by: BerndB
Category:

less

Transcript and Presenter's Notes

Title: Chapter 5, Analysis: Object Modeling


1
Chapter 5, AnalysisObject Modeling
2
Software Lifecycle Activities
System Design
Object Design
Implemen- tation
Testing
Requirements Elicitation
Requirements Analysis
Implemented By
Expressed in Terms Of
Structured By
Realized By
Verified By
?
?
Application Domain Objects
Implementation Domain Objects
Use Case Model
Source Code
SubSystems
Test Cases
3
Outline
  • 1. Overview of Analysis Model
  • Inputs - requirements model (use cases)
  • Outputs or parts of the Analysis Model
  • dynamic model
  • Develop preliminary sequence diagrams to
    illustrate the interaction between objects
  • Develop state diagrams for objects with
    interesting behavior
  • static model
  • Develop preliminary object and class diagrams
    showing the structure of the system
  • Heuristics to help create the Analysis Model

4
Requirements Model, Analysis Model, Design Models
  • 1. Analyze the problem statement
  • Identify functional requirements
  • Identify nonfunctional requirements
  • Identify constraints (pseudo requirements)
  • 2. Build the functional model
  • Develop use cases to illustrate functionality
    requirements
  • 3. Build the dynamic model
  • Develop sequence diagrams to illustrate the
    interaction between objects
  • Develop state diagrams for objects with
    interesting behavior
  • 4. Build the static model
  • Develop object and class diagrams showing the
    structure of the system
  • 5. Use the analysis model (static and dynamic) to
    create the architecture and the (detailed) design
    models

5
Analysis UML Activity Diagram
6
Analysis Model - model structure and behavior
of objects-start with objects seen by from
clients perspective
  • Structure - Static model
  • Behavior - Dynamic model
  • Static and dynamic modeling need to be done at
    the same time
  • Creating the Analysis Model
  • Input model requirements model (use cases)
  • Output models static and dynamic models
  • Subsequently, the analysis model is the input for
    creating the architecture and (detailed) design
    models

7
Analysis Model
  • Steps during dynamic modeling
  • use case event flows (normal, alternate)
  • heuristic start with 1 sequence diagram per use
    case
  • if alternate flows are complex, then consider
    using separate sequence diagrams for each
    alternate flow
  • Steps during static modeling
  • 1. Object/Class identification
  • heuristic start with the nouns in the use cases
    event flows
  • 2. Find the attributes
  • heuristic nouns
  • 3. Find the methods
  • Basic methods include Create, Read, Update,
    Delete (CRUD)
  • 4. Find the associations between classes
  • Association, generalization, aggregation,
    composition
  • 5. Find the multiplicity relationship between
    classes

8
Static Modeling with UML
  • Classes
  • Associations (Relations)
  • Part of- Hierarchy (Aggregation)
  • Kind of-Hierarchy (Generalization)
  • Attributes
  • Detection of attributes
  • Application specific
  • Attributes in one system can be classes in
    another system
  • Operations/Signature/Methods
  • Generic methods
  • Domain specific methods

9
Dynamic Modeling with UML
  • Diagrams for dynamic modeling
  • Interaction diagrams
  • Sequence Diagram
  • Dynamic behavior of a set of objects arranged in
    time sequence.
  • Good for real-time specifications and complex
    scenarios
  • Collaboration Diagram
  • Shows the relationship among objects. Does not
    show time
  • Statecharts
  • A state machine that describes the response of an
    object of a given class to the receipt of outside
    stimuli (Events).
  • Activity Diagram
  • Special type of statechart where all states are
    action states

10
Heuristics or Guidelines - Where do we start?
  • Class Identification
  • Identify the boundary (or interface) objects of
    the system
  • Identify the important entity objects in the
    system
  • Identify control objects in the system
  • Class identification is crucial to
    object-oriented modeling
  • Basic assumption
  • 1. We can find the classes for a new software
    system (Forward Engineering)
  • 2. We can identify the classes in an existing
    system (Reverse Engineering)
  • Why can we do this?
  • Philosophy, science, experimental evidence

11
Object vs. Class
  • Object (instance) Exactly one thing
  • The lecture on September 7 on Software
    Engineering from 900 -1020
  • A class describes a group of objects with similar
    properties
  • IETM, Author, Corrosion, Work order
  • Class diagram A graphic notation for modeling
    classes and their relationships ("associations")

12
How do you find classes?
  • Learn about problem domain Observe your client
  • Apply general world knowledge and intuition
  • Apply design patterns
  • Try to establish a taxonomy
  • Take the flow of events and find participating
    objects in use cases
  • Do a textual analysis of scenario or flow of
    events (Abbott Textual Analysis, 1983)
  • Nouns are good candidates for classes
  • Heuristic (for 6354) start with the points in
    blue

13
Mapping parts of speech to object model
components Abbot 1983

Part of speech
Model component
Example

Proper noun
object
Jim Smith

Improper noun
class
Toy, doll

Doing verb
method
Buy, recommend

being verb
inheritance
is-a (kind-of)

having verb
aggregation
has an

modal verb
constraint
must be

adjective
attribute
3 years old

transitive verb
method
enter

intransitive verb
method (event)
depends on
14
Example Use Case from Dental Office System -
input for creating the Analysis Model
  • Title Search for Supplier Information
  • Preconditions Dental Office System has been
    initialized
  • Postconditions If the search is successful, then
    the supplier information is displayed. If the
    search is not successful, then an error message
    is displayed.
  • Normal Flow
  • The Operator requests to search for supplier. The
    Operator may perform a keyword search using the
    boolean operators not, and, and or. The
    Operator may enter up to three keywords
  • The system displays the name, phone number, fax
    number, and address of the suppliers that match
    the search criteria.
  • Alternate Flow
  • The Operator requests to search for supplier. The
    Operator may perform a keyword search using the
    boolean operators not, and, and or.
  • If no matches are found, then the system displays
    an error message to the Operator.

15
Example Use Case from Dental Office System
  • // Circle the nouns (focus on the normal and
    alternate flows)
  • Title Search for Supplier Information
  • Preconditions Dental Office System has been
    initialized
  • Postconditions If the search is successful, then
    the supplier information is displayed. If the
    search is not successful, then an error message
    is displayed.
  • Normal Flow
  • The Operator requests to search for supplier. The
    Operator may perform a keyword search using the
    boolean operators not, and, and or. The
    Operator may enter up to three keywords
  • The system displays the name, phone number, fax
    number, and address of the suppliers that match
    the search criteria to the Operator.
  • Alternate Flow
  • The Operator requests to search for supplier. The
    Operator may perform a keyword search using the
    boolean operators not, and, and or.
  • If no matches are found, then the system displays
    an error message to the Operator.
  • // I started here with proper nouns (actors).
  • // Exercise identify nouns/possible objects and
    attributes

16
UML Class and Object Diagrams
Class Diagram
Supplier
Supplier
ACME Floss Supplier
Vogue Supplier
Object Diagram
Anonymous Object
17
Attributes and Values
Supplier
ACME FlossSupplier
namestring
nameACME Floss Inc.
address 1607 N. Floyd Rd Richardson, Texas, USA
address string
phone string
fax string
phone 972-883-4216
fax 972-883-2349
18
Operation, Signature or Method?
  • Operation A function or transformation applied
    to objects in a class. All objects in a class
    share the same operations (Analysis Phase)
  • Signature Number types of arguments, type of
    result value. All methods of a class have the
    same signature (Object Design Phase)
  • Method Implementation of an operation for a
    class (Implementation Phase)

19
Links and Associations
  • Links and associations establish relationships
    among objects and classes.
  • Link
  • A connection between two object instances.
  • A link is an instance of an association
  • Association
  • Bidirectional mapping.
  • One-to-one, many-to-one, one-to-many,
  • An association describes a set of links like a
    class describes a set of objects.
  • Generalization, aggregation, composition, and
    others

20
Object Types
  • Entity Objects
  • Represent the persistent information tracked by
    the system (Application domain objects, Business
    objects)
  • Boundary Objects
  • Represent the interaction between the user and
    the system
  • Control Objects
  • Represent the control tasks performed by the
    system
  • Having three types of objects leads to models
    that are more resilient to change.
  • The boundary of a system changes more likely than
    the control
  • The control of the system change more likely than
    the application domain

21
Example Use Case from Dental Office System
  • // Circle the nouns (focus on the normal and
    alternate flows)
  • Title Search for Supplier Information
  • Preconditions Dental Office System has been
    initialized
  • Postconditions If the search is successful, then
    the supplier information is displayed. If the
    search is not successful, then an error message
    is displayed.
  • Normal Flow
  • The Operator requests to search for supplier. The
    Operator may perform a keyword search using the
    boolean operators not, and, and or. The
    Operator may enter up to three keywords.
  • The system displays the name, phone number, fax
    number, and address of the suppliers that match
    the search criteria to the Operator.
  • Alternate Flow
  • The Operator requests to search for supplier. The
    Operator may perform a keyword search using the
    boolean operators not, and, and or.
  • If no matches are found, then the system displays
    an error message to the Operator.
  • // Supplier is an entity object what are name,
    phone, fax, and address?
  • // Boundary objects? Control objects?

22
Example Dental Office System - describe as
classes - if needed, generalize the objects
ltltentitygtgt
ltltcontrolgtgt
ltltboundarygtgt
DentalOfficeControl
Supplier
GUI
ltltentitygtgt
ltltcontrolgtgt
Client
...
ltltentitygtgt
TIP If you organize your boundary objects on the
left, then this model is going to be organized in
a similar way to your sequence diagrams
Dental Office
23
Static Modeling in Practice Encourage
Brainstorming
Find New Objects (nouns in use case)
Generalize as a Class
Iterate on Names, Attributes and Methods
Find Associations between Classes, Links between
Objects
Label the associations, links
Determine the multiplicity of the associations
  • Iteratively refine the model
  • Dont put too many objects/classes into the same
    package 7-2

24
Example Dental Office System - a place to start
ltltcontrolgtgt
ltltboundarygtgt
DentalOfficeGUIBoundary
DentalOfficeControl
ltltentitygtgt
ltltentitygtgt
Supplier
Client
name
address
phone
ltltentitygtgt
fax
Appointment
add
modify
search
delete
25
Dynamic Modeling
  • Definition of dynamic model
  • A collection of sequence diagrams one state
    chart diagram for each class with important
    dynamic behavior.
  • Purpose
  • Identify signatures for the object model
  • Verify the use cases
  • How do we do this?
  • Start with use case (or scenario)
  • Model interaction between objects to create
    sequence diagram
  • Model dynamic behavior of single objects to
    create Statechart diagram

26
Sequence Diagram
  • From the flow of events in the use case proceed
    to the sequence diagram
  • A sequence diagram is a graphical description of
    objects participating in a use case
  • Relation to object identification
  • Objects/classes have already been identified
    during object modeling
  • New objects are identified as a result of
    dynamic modeling
  • Find/correct errors of omission
  • Heuristic
  • Events in a use case are externally visible
  • The events map to interactions between an actor
    and a boundary object in the sequence diagram
  • For each interaction in the use case there is an
    interaction in the sequence diagram between
    actors and boundary objects

27
Heuristics for Sequence Diagrams
  • Layout
  • 1st column Should correspond to the actor who
    initiated the use case
  • 2nd column often a boundary object
  • 3rd column often a control object that manages
    the rest of the use case
  • Creation
  • When is each object created?
  • Highly related to use case that initializes the
    system
  • Access
  • Entity objects are accessed by control and
    boundary objects,
  • Entity objects should never call boundary or
    control objects This makes it easier to share
    entity objects across use cases and makes entity
    objects resilient against technology-induced
    changes in boundary objects.

28
Sequence Diagram - a place to start
Penultimate FlossSupplier
DentalOffice Control
DentalOfficeGUI Boundary
ACME FlossSupplier
Operator
create()
Request Search for Suppliers
Search for Supplier
search()
Enter search criteria
Supplier name, phone, fax, address
...
Collection of suppliers name, phone, fax,
address
Search for Supplier Response
Write a Comment
User Comments (0)
About PowerShow.com