Sei sulla pagina 1di 48

Chapter 22

Object-Oriented Systems
Analysis and Design and UML

Systems Analysis and Design


Kendall and Kendall
Fifth Edition
Major Topics
 Object-oriented programming concepts
 Object-oriented terminology
 Five-layer model
 CRC Cards
 Unified Modeling Language
 Use case and other UML diagrams
 Relationships
Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-2
Object-Oriented Overview
 Object-oriented techniques work well in
situations where complicated systems
are undergoing continuous
maintenance, adaptation, and design
 There are two ways to model object-
oriented systems
 Coad and Yourdon methodology
 The Unified Modeling Language

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-3


Object-Oriented Programming
 Six ideas characterize object-oriented
programming:
 An object, which represents a real-world
thing or event
 A class, or group of related objects
 Messages, sent between objects
 Encapsulation, only an object makes
changes through its own behavior

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-4


Object-Oriented Programming
 Six ideas characterize object-oriented
programming (continued):
 Inheritance, a new class created from
another class
 Polymorphism, meaning that a derived
class behavior may be different from the
base class

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-5


Terminology
 Class refers to a template for a group of
individual objects with common
attributes and common behavior
 The difference between an Object and a
Class is that the class defines shared
attributes and behaviors of objects
 An object is an instance or occurrence of
a class
Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-6
Terminology

 Another name for property is attribute


 Another name for method is operation
 Interface means the behavior of a class
or component that is noticeable from
outside the class or component

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-7


Encapsulation
 Encapsulation changes the manner in
which data is updated by programs
because data can only be changed via
the services that encapsulate the data

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-8


Inheritance
 The two types of classes are involved in
any inheritance relationship are the base
class and the derived class
 Multiple inheritance means there will be
multiple occurrences of the base type of
class in the inheritance relationship
 Polymorphism only occurs where there is
inheritance
Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-9
Five-Layer Model
 Object oriented analysis and design is
based on a five-layer model:
 Class/object layer notes the classes and
objects
 Structure layer captures various structures of
classes and objects, such as one-to-many
relationships and inheritance
 Attribute layer details the attributes of classes

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-10


Five-Layer Model
 Five-layer model, continued
 Service layer notes messages and object
behaviors
 Subject layer divides the design into
implementation units or team assignments

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-11


Five General Types of Objects
 There are five general types of objects:
 Tangible things
 Roles
 Incidents
 Interactions
 Specifications details

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-12


Criteria to Determine Need for
a New Class of Objects
 Criteria to determine whether a new class
of objects is justified
 There is a need to remember the object
 There is a need for certain behaviors of the
object
 An object has multiple attributes
 A class has more than one object instantiation
Unless it is a base class

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-13


Criteria to Determine Need for
a New Class of Objects
 Criteria, continued
 Attributes have a meaningful value for
each object in a class
 Services behave the same for every object
in a class
 Objects implement requirements that are
derived from the problem setting

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-14


Criteria to Determine Need for
a New Class of Objects
 Criteria, continued
 Objects do not duplicate attributes and
services that could be derived from other
objects in the system

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-15


Basic Types of Structures
 There are two basic types of structures
that might be imposed on classes and
objects:
 Generalization-Specialization structure
(Gen-Spec), which connect class-to-class
 Whole-Part structure which are collections
of different objects that compose another
whole object

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-16


Instance Connections
 Instance connections are references
between objects such as associations or
relationships indicated by a single line
between objects using the same
cardinality notation as Whole-Part
structures

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-17


Methods
 Services (or methods or procedures) must
be analyzed. Activities are
 Object state analysis, showing changes of
state
 Service specification: creating, storing,
retrieving, connecting, accessing, and
deleting objects
 Message specification, consisting of control
and data flow

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-18


Major Components of Object-
Oriented Design Activities
 Object-oriented design activities are
grouped into four major components:
 The problem domain component
 The human interface component
 The data management component
 The task management component

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-19


Problem Domain Component
 The problem domain component
consists of
 Reuse design
 Implementation structures
 Language accommodation

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-20


CRC Cards
 Class, responsibilities, and collaborators
(CRC) cards are used to represent the
responsibilities of classes and the
interaction between the classes

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-21


Creating CRC Cards
 Analysts create CRC cards by
 Finding all the nouns and verbs in a
problem statement
 Create scenarios that are actually
walkthroughs of system functions
 Identify and refine responsibilities into
smaller and smaller tasks, if possible

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-22


Creating CRC Cards
 Creating CRC cards, continued
 The group determines how tasks are
fulfilled by objects or interacting with other
things
 Responsibilities evolve into methods or
operations

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-23


The Unified Modeling
Language (UML)
 UML (Unified Modeling Language) is the
result of a collaboration of individual
object-oriented methods that has been
adopted as a standard for modeling
object-oriented systems
 It differs from the Coad and Yourdon
OOA-OOD in the way that it breaks
down objects and their relationships
Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-24
The Unified Modeling
Language (UML)
 UML has three categories:
 Things, the objects
 Relationships, the glue that holds things
together
 Diagrams, categorized as either structure
or behavioral

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-25


Use Case
 A use case describes three things:
 An actor (user) that initiates an event
 An event that triggers a use case
 The use case that performs the actions
triggered by the event

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-26


Kinds of Use Cases
 There are two kinds of use cases:
 Primary, the standard flow of events within
a system that describe a standard system
behavior
 Use case scenarios that describe variations
of the primary use case

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-27


Steps for Creating a Use Case
Model
 The steps required to create a use case
model are
 Review the business specifications and
identify the actors within the problem
domain
 Identify the high-level events and develop
the primary use cases that describe the
events and how actors initiate them

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-28


Steps for Creating a Use Case
Model
 Creating a use case model, continued
 Review each primary use case to determine
possible variations of flow through the use
case
 Develop the use case documents for all
primary use cases and all important use case
scenarios
 Move to UML diagramming techniques to
complete the systems analysis and design

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-29


Two General Groupings of
Things
 There are two general groupings of
things in UML:
 Structural things that define the conceptual
and physical structures of an O-O system and
are described by nouns
 Behavioral things, the verbs of a UML model
that represent the behavior of the system
and the states of the system before, during,
and after the behaviors occur

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-30


Categories of Structural Things
 There are seven categories of structural
things
 The first five are conceptual or logical
 The last two are physical in nature
 Component
 Node

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-31


Categories of Structural Things
 Seven categories of structural things:
 Classes, which have properties or
attributes and methods or operations
 Interfaces, the behavior of a class or
component of a system that is noticeable
from outside the class or component

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-32


Categories of Structural Things
 Seven categories, continued
 Collaborations, which describe the interactions
of two or more things in a system that
perform a behavior that is more than any one
of the things can do alone
 Use cases, which describe a series of actions
that demonstrate a distinct behavior of the
system and its interactions with the actors

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-33


Categories of Structural Things
 Seven categories, continued
 Control or active classes
A control class can initiate and control an
independent flow of activity within the system
 Components, which are a physical part of a
system that represents the services and
interfaces implemented by the elements
contained within that component, including
software code

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-34


Categories of Structural Things
 Seven categories, continued
 Nodes, which represent a piece of
hardware on which your system executes
Components are physically deployed on nodes

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-35


Behavioral Things
 Behavioral things consist of
 Interactions, or messages sent between a
set of objects within the system to perform
a specific task
 State machine, a series of states that an
object goes through in response to actions
within the system

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-36


Packages
 Packages are groups of things
 They can be physical subsystems

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-37


Types of Relationships
 There are two types of relationships
that hold things together:
 Structural
 Behavioral

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-38


Types of Structural
Relationships
 There are four types of structural
relationships:
 Dependencies, where one thing affects
another thing that uses it
 Aggregations, which show how the whole
object is composed of the sum of its parts
 Associations that describe structural
connections between things

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-39


Types of Structural
Relationships
 Four types of structural relationships,
continued
 Generalizations, which describe a
relationship between a general kind of
thing and a more specific kind of thing,
used for modeling class inheritance and
specialization

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-40


Types of Active Behavioral
Relationships
 There are four active behavioral
relationships:
 Communicates is used to connect an actor
to a use case
 Includes describes the situation where a
use case contains a behavior that is
common to more than one use case

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-41


Types of Active Behavioral
Relationships
 Types of active behavioral relationships,
continued
 Extends describes the situation where one
use case possesses the behavior that
allows the new use case to handle a
variation or exception
 Generalizes implies that one thing is more
typical than the other thing

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-42


UML Structural Diagrams
 UML structural diagrams include
 Class diagrams used to model the static
structural design of a system
 Object diagrams portray the state of class
instances and their relationships at a point
in time

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-43


UML Structural Diagrams
 UML structural diagrams, continued
 Component diagrams show an overview of
the system architecture
 A deployment diagram illustrates the
physical implementation of the system,
including the hardware

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-44


Behavioral Diagrams
 Behavioral diagrams describe the
interaction between people and a use
case

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-45


Behavioral Diagrams
 Behavioral Diagrams include
 Use case diagrams, showing the actors and
the use cases
 Sequence diagrams that depict a succession
of interactions between object instances over
time and they show the processing described
in use case scenarios
 Activity diagrams show the flow of activities
within a process

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-46


Behavioral Diagrams
 Behavioral Diagrams, continued
 Collaboration diagrams illustrate a sequence
of object interactions showing the
organization of the objects during the
interactions
 State chart diagrams show the states of an
object and the events and conditions that
trigger a transition from one state to
another

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-47


Steps Used in UML
 The steps used in UML are
 Define the use case model
 Define the object model
 Continue UML diagramming to model the
system during the systems analysis phase
 Begin system design by refining UML
diagrams and using them to derive classes
and their properties and methods

Kendall & Kendall Copyright © 2002 by Prentice Hall, Inc. 22-48

Potrebbero piacerti anche