0% found this document useful (0 votes)
11 views50 pages

Lecture 7 - Chapter 13

Uploaded by

Ahmad Yasser
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views50 pages

Lecture 7 - Chapter 13

Uploaded by

Ahmad Yasser
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 50

Chapter 13

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Object-Oriented Design:
Use Case Realizations

Chapter 13

Systems Analysis and Design


in a Changing World 7th Ed
Satzinger, Jackson & Burd

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Chapter 13 Outline
Object-Oriented Design with Interaction Diagrams
Use Case Realization with Communication
Diagrams
Use Case Realization with Sequence Diagrams
Developing a Multilayer Design
Updating and Packaging the Design Classes
Design Patterns

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Learning Objectives
Explain the different types of objects and layers in a
design
Develop communication diagrams for use case
realization
Develop sequence diagrams for use case realization
Develop updated design class diagrams
Develop multilayer subsystem packages
Explain design patterns and recognize various
specific patterns

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Overview
Chapter 12 introduced software design concepts for
OO programs, use case realization using the CRC cards
technique, and fundamental design principles
This chapter continues the discussion of OO software
design at a more advanced level
Three layer design is demonstrated using
communication diagrams, sequence diagrams,
package diagrams, and design patterns
Design is shown to proceed use case by use case, and
within each use case, layer by layer

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Steps of Object-Oriented Design

Object-oriented design
The process to identify the classes, their methods
and the messages required for a use case

Use case driven


Design is carried out use case by use case

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 12


©2016. Cengage Learning. All rights reserved.
Steps of Object-
Oriented Design

Three paths
Simple use case use
CRC Cards
Medium use case use
Communication
Diagram
Complex use case use
Sequence Diagram

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 12


©2016. Cengage Learning. All rights reserved.
OOD with Interaction Diagrams

CRC Cards focuses on the business logic, also known as


problem domain layer of classes
Three layers include view layer, business logic/problem
domain layer, and data access layer
Questions that come up include
How do objects get created in memory?
How does the user interface interact with other objects?
How are objects handled by the database?
Will other objects be necessary?
What is the lifespan of each object?

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD with Interaction Diagrams
Use case realization
The process of elaborating the detailed design for a
particular use case using interaction diagrams
Communication diagram
A type of interaction diagram which emphasizes the
set of objects involved in a use case
Sequence diagram
A type of interaction diagram which emphasizes the
sequence of messages involved in a use case

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Interaction diagrams
Communication and Sequence diagrams and their
components

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Use Case Controller
Switchboard between user-interface classes and
domain layer classes
Reduces coupling between view and domain layer
A controller can be created for each use case, however,
several controllers can be combined together for a
group of related use cases
It is a completely artificial class – an artifact

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Understanding Communication Diagrams
Actor – the external role of the person or thing that
initiates the use case. Sends messages.
Object – the instantiated class objects that perform the
actions (methods) to execute the use case. They
receive messages and process messages.
Link – simply connectors between objects to carry the
messages.
Message – the requests for service with an originating
actor or object and a destination object, which
performs the requested service

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Understanding Communication Diagrams
Symbols used in a communication diagram:

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Message Syntax
[true/false condition] sequence-number: return-
value: = message-name (parameter-list)
true/false condition – determines if message is sent
sequence number – notes the order of the messages
return-value – value coming back to origin object
from the destination object
message-name – camelCase name identifier. Reflects
the requested service
parameter-list – the arguments being passed to the
destination object

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Example Communication Diagram:
Create customer account use case

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD with Communication Diagrams
First-cut DCD for Create customer account
use case

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD for Create customer account
Input model -- SSD

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD for Create customer account
Extend input messages
1. From the DCD put objects on communication
diagram
2. For each message, find primary object, ensure
visibility, elaborate use case with all messages
between objects
3. Name each message and add all required message
elements

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD with communication diagrams
createNewCustomer message extended to all objects

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD with communication diagrams
enterAddress message extended to all objects

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD with communication diagrams
enterAccount message extended to all objects

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD with communication diagrams
Final communication diagram with all messages

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD with communication diagrams
Updated
DCD

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Understanding Sequence Diagrams

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Understanding Sequence Diagrams
Lifeline
The dashed line under the object which serves as an
origin point and a destination point for messages
Activation lifeline
The vertical box on a lifeline which indicates the
time period when the object is executing based on
the message
Messages have origins and destinations
May be on lifeline or on object box
Return values may be dashed message arrow, or on
same message

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
OOD with Sequence Diagrams
Same process as with communication diagrams
Choose a use case
Input models – activity diagram, SSD, classes
Create first-cut DCD
Extend input messages
Add all required internal messages
Origin and destination objects
Elaborate each message
Add other layers as desired (view, data access)
Update DCD

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Example:
Fill Shopping Cart

Input activity
diagram
Note the activity
flows that cross the
system boundary

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Example:
Fill Shopping Cart

SSD
Note the input
and return
messages
Note the
repeating
message

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Example:
Fill Shopping Cart

First-Cut DCD

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Example: Fill Shopping Cart
First step in addItem message. Create a cart if first item in
the purchase
Note true/false test, two types of return values, named
objects, activation lifelines, message origins and destinations

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Example: Fill Shopping Cart
Completion of addItem message.

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Example: Fill Shopping Cart
Note origin and destination objects and visibility
createCart () – cart handler knows if first item
aCrt:=createCart() – customer owns onlineCart
addItem() – forwarded message
createCartItem() – cartItem responsible for creating
itself and getting values
getPrice() – just returns the price
getDescription() – just returns description
updateQty(qty) – initiates updates

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Example: Fill Shopping Cart
addAccesory
message
(with objects
and lifelines)

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Assumptions
Perfect technology assumption
No logon or other technical issues
Perfect memory assumption
No need to read or write data
Perfect solution assumption
No exception conditions, no error handling

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Multilayer Sequence Diagrams
Add the view layer for input screens to handle
input messages
Add data layer to read and write the data

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
View Layer
Example:
Add
customer
account use
case

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
View Layer
Partial example: Fill shopping cart use case

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Data Layer Data layer for reading or updating
existing persistent objects

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Data Layer
Data Access to instantiate a new object – Two
methods
Instantiate the object in memory, the object
invokes the data access to get any required
persistent data
Send a message to the data access object, and
it obtains the required persistent data and then
instantiates the new object

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Instantiating a New Object
Method 1. The instantiated object gets the data

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Instantiating a New Object
Method 2. The data access gets the data and
instantiates the object

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Partial Fill shopping cart with Data Access

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Updated DCD

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Package Diagrams
Can be used to define formal packages such as
subsystems
Can be used informally to group classes together
for understanding
Dependency relationship
A relationship between packages or classes within a
package in which a change of the independent
component may require a change in the dependent
component. Indicated by dashed line. Read in the
direction of the arrow, i.e. AB is A depends on B.

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Package Diagram
Three-layer package
diagram of classes in
Figure 13-24
Dependencies
View layer depends
on Data Access layer
SearchItemWindow
depends on
ProductItem
etc.

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Implementation Issues
Three Layer Design

View Layer Class Responsibilities


Display electronic forms and reports.
Capture such input events as clicks, rollovers, and
key entries.
Display data fields.
Accept input data.
Edit and validate input data.
Forward input data to the domain layer classes.
Start and shut down the system.

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Implementation Issues
Three Layer Design
Domain Layer Class Responsibilities
Create problem domain (persistent) classes.
Process all business rules with appropriate logic.
Prepare persistent classes for storage to the database.
Data Access Layer Class Responsibilities
Establish and maintain connections to the database.
Contain all SQL statements.
Process result sets (the results of SQL executions) into
appropriate domain objects.
Disconnect gracefully from the database.

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Summary
This chapter went into more detail about use case realization
and three layer design to extend the design techniques from last
chapter
Three layer design is an architectural design pattern, part of the
movement toward the use of design principles and patterns.
Use case realization is the design of a use case, done with a
design class diagram and interaction diagrams. Using interaction
diagrams allows greater depth and precision than using CRC
cards.
Use case realization proceeds use case by use case (use case
driven) and then for each use case, it proceeds layer by layer

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Summary (continued)
Starting with the business logic/domain layer, domain classes
are selected and an initial design class diagram is drawn.
The systems sequence diagram (SSD) from analysis is expanded
by adding a use case controller and then the domain classes for
the use case.
Messages and returns are added to the interaction diagram as
responsibilities are assigned to each class.
The design class diagram is then updated by adding methods to
the classes based on messages they receive and by updating
navigation visibility.
Simple use case might be left with two layers if the domain
classes are responsible for database access. More complex
systems add a data access layer as a third layer to handle
database access

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.
Summary (continued)
The view layer can also be added to the sequence diagram to
show how multiple pages or forms interact with the use case
controller.
The UML package diagram is used to structure the classes into
packages, usually one package per layer. The package diagram
can also be used to package layers into subsystems.

Systems Analysis and Design in a Changing World, 7th Edition - Chapter 13


©2016. Cengage Learning. All rights reserved.

You might also like