You are on page 1of 194

Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Object-Oriented ) has Analysis
e ฺ and
Design c o m
Using id
UML
u
e ฺ G
r a cl ent
@ o tuGuide
Activity d
a
m this S
e r
h ฺ vฺv use OO-226 Rev E
i t e s t o
(h ens e
a lic
Verm
h
H ites

D61808GC21
Edition 2.1
June 2010
D67901
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.

Disclaimer

This document contains proprietary information, is provided under a license agreement containing restrictions on use and
disclosure, and is protected by copyright and other intellectual property laws. You may copy and print this document solely for
your own use in an Oracle training course. The document may not be modified or altered in any way. Except as expressly
permitted in your license agreement or allowed by law, you may not use, share, download, upload, copy, print, display,
perform, reproduce, publish, license, post, transmit, or distribute this document in whole or in part without the express
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

authorization of Oracle.

The information contained in this document is subject to change without notice. If you find any problems in the document,
please report them in writing to: Oracle University, 500 Oracle Parkway, Redwood Shores, California 94065 USA. This
document is not warranted to be error-free.

Sun Microsystems, Inc. Disclaimer

This training manual may include references to materials, offerings, or products that were previously offered by Sun
Microsystems, Inc. Certain materials, offerings, services, or products may no longer be offered or provided. Oracle and its
affiliates cannot be held responsible for any such references should they appear in the text provided.
ble
Restricted Rights Notice
fe r a
If this documentation is delivered to the U.S. Government or anyone using the documentation on behalf of the U.S.
an s
Government, the following notice is applicable:
n - t r
n o
U.S. GOVERNMENT RIGHTS
a
has eฺ
The U.S. Government’s rights to use, modify, reproduce, release, perform, display, or disclose these training materials are
restricted by the terms of the applicable Oracle license agreement and/or the applicable U.S. Government contract.
)
Trademark Notice
ฺ c om uid
r a cle ent G
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective
owners.
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
V erm
h
H ites
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
This page intentionally )left hasblank.
eฺ
o m i d
l e ฺc t Gu
o rac uden
a @ St
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
This page intentionally )left hasblank.
eฺ
o m i d
l e ฺc t Gu
o rac uden
a @ St
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Table of Contents
bl e
About This Workbook ..........................................................Preface-ix
fe r a
Conducting the labs.............................................................. Preface-ix
an s
- t r
Conventions ............................................................................. Preface-x
n
no
Typographical Conventions ......................................... Preface-x
a
) h as ฺ
Additional Conventions............................................... Preface-xi
Examining Object-Oriented Concepts
ฺ c o m u ide
and Terminology..............1-1
Objectives ........................................................................................... 1-1
c l n t G
e ...........................................................
o r a de
Activity 1: Using Abstraction 1-2
a S tu
@ Inheritance............................................................
Activity 2: Using 1-3
Activity
e r m thi
3: Using s
Delegation and Cohesion ................................... 1-5

h ฺ vฺv u4:5:sUnderstanding
Activity e the Benefits of Using Interfaces ........ 1-6

i t e s Activity
t o Defining Object-Oriented Terminology ...................... 1-7

a e n se Modeling and the Software


(h Introducing
erm licDevelopment Process ......................................................................2-1
h V Objectives ........................................................................................... 2-1

H ites Activity 1: Defining Workflows ....................................................... 2-2


Activity 2: Identifying Characteristics of the
Requirements Gathering Workflow ............................................. 2-3
Activity 3: Identifying Characteristics of the
Requirements Analysis Workflow ............................................... 2-4
Activity 4: Identifying Characteristics of the
Architecture Workflow .................................................................. 2-5
Activity 5: Identifying Characteristics of the
Design Workflow ............................................................................ 2-6
Activity 6: Exploring the Benefits of Modeling ............................. 2-7
Activity 7: Identifying the Benefits of
Modeling Software.......................................................................... 2-8
Activity 8: Identifying Diagram Types ........................................... 2-9
Creating Use Case Diagrams ..........................................................3-1
Objectives ........................................................................................... 3-1
Activity 1: Identifying Use Case Symbols ...................................... 3-2

v
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Hotel System – Abstract of Additional Requirements (1)............ 3-3
Activity 2: Creating a Use Case Diagram ....................................... 3-4
Hotel System – Abstract of Additional Requirements (2)............ 3-6
Activity 3: Refining the Use Case Diagram.................................... 3-7
Creating Use Case Scenarios and Forms...................................... 4-1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Objectives ........................................................................................... 4-1


Activity 1: Examining Use Case Scenarios ..................................... 4-2
Activity 2: Creating Use Case Forms .............................................. 4-4
Activity 3: Writing Glossary of Terms ............................................ 4-5
Creating Activity Diagrams ............................................................. 5-1
Objectives ........................................................................................... 5-1
Actrivity1: Identifying Activity Diagram Symbols....................... 5-2
bl e
Activity 2: Creating an Activity Diagram....................................... 5-3
fe r a
an s
Determining the Key Abstractions ................................................. 6-1
n - t r
a no
Objectives ........................................................................................... 6-1
Activity 1: Finding Candidate Key Abstractions .......................... 6-2
has eฺ
Activity 2: Finding Key Abstractions Using CRC ......................... 6-3
)
Constructing the Problem Domain c m .....................................
oModel u id 7-1
l e ฺ t G
c en
raClass
Objectives ........................................................................................... 7-1
Activity 1: Identifying
@ o t u d
Diagram Elements ........................... 7-2
a
m thiasObject
Activity 2: Extending S
Class Diagram ........................................... 7-3
e r
v se
ฺ v ฺ
Activity 3: Identifying
u
Diagram Symbols .......................... 7-5

e h t4:o Validating
sActivity a Class Diagram........................................... 7-6
i t se from Analysis to Design
(hTransitioning
a e n
erm Usinglic Interaction Diagrams ............................................................ 8-1
h V Objectives ........................................................................................... 8-1

H ites Activity 1: Identifying Collaboration Diagram Elements ............ 8-2


Activity 2: Creating a Communication Diagram........................... 8-3
Activity 3: Identifying Sequence Diagram Elements .................... 8-4
Activity 4: Creating a Sequence Diagram....................................... 8-5
Modeling Object State Using State Machine Diagrams................ 9-1
Objectives ........................................................................................... 9-1
Activity 1: Identifying State Machine Diagram Elements............ 9-2
Activity 2: Creating a State Diagram............................................... 9-3
Applying Design Patterns to the Design Model .......................... 10-1
Objectives ......................................................................................... 10-1
Activity 1: Applying CRP ............................................................... 10-2
Activity 2: Applying the Strategy Pattern .................................... 10-3
Activity 3: Applying the Observer Pattern .................................. 10-4
Activity 4: Applying the State Pattern .......................................... 10-5

vi Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Introducing Architectural Concepts and Diagrams ....................11-1
Objectives ......................................................................................... 11-1
Activity 1: Identifying Tiers, Layers, and
Systemic Qualities......................................................................... 11-2
Activity 2: Exploring Component Diagrams ............................... 11-4
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 3: Understanding Deployment Diagrams ..................... 11-6


Activity 4: Creating a High-Level Deployment Diagram .......... 11-7
Introducing the Architectural Tiers...............................................12-1
Objectives ......................................................................................... 12-1
Activity 1: Update and Extend a Tiers
and Layers diagram ...................................................................... 12-2
Activity 2: Create DAOFactory and DAO Classes...................... 12-3
bl e
Refining the Class Design Model..................................................13-1 r
fe 13-1a
n s
Objectives .........................................................................................
n - tra
Activity 1: Refining Attributes ....................................................... 13-2
Activity 2: Refining Associations using Aggregation n o and
s a
a
Composition...................................................................................
Activity 3: Refining the Direction)ofhTraversal............................

13-4
13-5
o m i d e
Activity 4: Refining Business
l e c Methods
ฺClass G u and Constructors ......... 13-6
Activity 5: Checking your
r a c en tDiagram for
High Cohesionoand Low
Activity 6: a @ Components
Creating S tudCoupling with
............................................ 13-7
Interfaces....................... 13-8
r m h i s
Overview
ฺ v ฺveof uSoftware
s e t Development Processes ..........................14-1
i t e sh Objectives
t o ......................................................................................... 14-1
e
(h ensActivity 1: Identifying Methodology Characteristics ................. 14-2
a lic Activity 2: Defining the Five Object-Oriented
Verm Methodologies ............................................................................... 14-3
h
H ites Activity 3: Producing an Iteration Plan ........................................ 14-4
Activity 4: Selecting Methodologies.............................................. 14-5
Overview of Frameworks ...............................................................15-1
Objectives ......................................................................................... 15-1
Activity 1: Creating a Conceptual Framework ............................ 15-2
Activity 2: Identifying Potential Frameworks ............................. 15-3
Course Review................................................................................16-1
Solutions to Labs

vii
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Preface
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

About This Workbook

Conducting the labs e


r a bl
sfe
Except for self-check activities or where directed otherwise, it is suggested
that the lab activities in this workbook are completed in small groups. - t r an
no
This promotes the UML modeling ideals of communicating and sharing of
n
a
has eฺ
ideas to create better solutions, which can enhance the learning
)
experience. The instructor will assist in assigning groups.
ฺ c om uid
Self-check activities are meantcto n t G individually by each
lebe completed
student. However, these o r a de also be completed in pairs or small
activitiesumay
groups. @
a is S t
r m
e e th
v ฺ v
e s hฺ to us
( h it se
a e n
erm lic
h V
H ites

Preface-ix
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Conventions

Conventions
The following conventions are used in this course to represent various
training elements and alternative learning resources.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Typographical Conventions
Courier is used for the names of commands, files, directories,
programming code, and on-screen computer output; for example:
Use ls -al to list all files. e
system% You have mail. r a bl
n s fe
Courier is also used to indicate programming constructs, such r a
-t as class
names, methods, and keywords; for example: n o n
a
The getServletInfo method is used to h
) asauthor
get
ฺ information.
The java.awt.Dialog class contains
omDialog e
idconstructor.
ฺ c G u
Courier bold is used for charactersr a cle and e n t
numbers that you type; for
o t u d
example:
r m a@ is S

To list the v e in this
files e thdirectory, type:
# sls v
hฺ to us
it e
a ( h
e n se is also used for each line of programming code that is
lic in a textual description; for example:
Courier
erm referenced
bold

h V
H ites 1 import java.io.*;
2 import javax.servlet.*;
3 import javax.servlet.http.*;
Notice the javax.servlet interface is imported to allow access to its
life cycle methods (Line 2).

Courier italics is used for variables and command-line placeholders


that are replaced with a real name or value; for example:
To delete a file, use the rm filename command.

Courier italic bold is used to represent variables whose values are to


be entered by the student as part of an activity; for example:
Type chmod a+rwx filename to grant read, write, and execute
rights for filename to world, group, and users.

Preface-x Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Conventions

Palatino italics is used for book titles, new words or terms, or words that
you want to emphasize; for example:
Read Chapter 6 in the User’s Guide.
These are called class options.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Additional Conventions
Java™ programming language examples use the following additional
conventions:
Method names are not followed with parentheses unless a formal or

bl e
actual parameter list is shown; for example:
fe r a
“The doIt method...” refers to any method called doIt.
an s
n - t r
“The doIt() method...” refers to a method called doIt that takes
no arguments. a no
ha s
Line breaks occur only where there )are

o m i d eฺ code.(commas),
separations

e ฺ c
conjunctions (operators), or white
G u
space in the Broken code is
indented four spaces under
r a cl theestarting
n t code.
● If a command used
a @oin theStSolaris™
ud Operating Environment is
r
different from
e t h is used in the Microsoft Windows platform,
m a command
ฺv useare shown; for example:
bothvcommands

e h
sIf working
t o in the Solaris Operating Environment
i t e
(h ens $cd $SERVER_ROOT/bin
a lic
Verm If working in Microsoft Windows
h
H ites C:>cd %SERVER_ROOT%\bin

About This Workbook Preface-xi


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Lab 1

Examining Object-Oriented Concepts and


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Terminology

Objectives e
r a bl
sfe
Upon completion of these activities, you should be able to:
- t r an

no
Define fundamental object-oriented (OO) concepts n
a

) h asassociations,
Create simple class diagrams using classes,

inheritance,
and interfaces
ฺ c om uide

cle eand
Apply the concepts of cohesion
n G
t delegation to class diagrams
r a
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

1-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Using Abstraction

Activity 1: Using Abstraction


In this exercise, you will use abstraction on a real-world car object. You
must ensure that you keep only those responsibilities of the car object
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

that are relevant for each specified domain.

Preparation
No special preparation is required for this activity.

ble
Tasks fe r a
ans
n - t r
Complete the following step:
a no
1. Draw a UML class description for each of the
) hasfollowing

business

ide
domain contexts:
ฺ c om context
u
a.
r a cle ent G
A Car in a “Used Car Lot” business
b. A Car in a “MotoroRacinguCircuit
a @ St d Game” business context
e r m this
Note – The h ฺ vฺv Circuit
“Motor u se Racing Game” can be a computer simulation
t e s game
or a iphysical t o (for example, Digital Scaletrix) with methods to
(h the s e
ncar.
rm acontrol
li c e
V e
e s h c. A Car in a “Vehicle Licensing Registration” business context
Hit d. A Car in any other business context agreeable to your group
(optional)

Note – You can refer to the example UML diagrams in Module 1 of the
Student Guide to review the graphical notation of a UML Class diagram.

1-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Using Inheritance

Activity 2: Using Inheritance


In this exercise, you will use inheritance to extend the responsibilities
(attributes and methods) of a class.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Task 1 - Create an Inheritance Hierarchy bl e


fe r a
an s
Complete the following step:
n - t r
1. no
Draw UML classes that are related by inheritance. Each class should
a
) has eฺ
include its name, attributes, and methods. These classes, which are
all from the banking domain, are as follows:
c o m uid
ฺ G
● An Account class that
r a clecontains
n t the following attributes and
methods:
@ o tude
● a ibalance
Attributes:
m s S and accountNumber
r h
ฺ v ฺveMethods:

u s e t credit and debit
i t e sh A SavingsAccount
t o class, whose business rules include that
( h ●
s e
r m a licen your balance cannot go below zero.
Ve ● A LoanAccount class, whose business rules include that your
e s h balance cannot go above zero and you can debit only once (that
Hit is, when the account is opened).
● A CheckingAccount(CurrentAccount) class, whose business
rules include the following:
● You may have an overdraft limit.
● If you have an overdraft limit, your balance can drop below
zero, but it cannot exceed that overdraft limit.
● A TaxFreeSavingsAccount class, whose business rules include
that you have an annual credit limit and you cannot credit more
than that amount each year.

Note – You can refer to the example UML diagrams in Module 1 of the
Student Guide to review the graphical notation for inheritance.

Examining Object-Oriented Concepts and Terminology 1-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Using Inheritance

Note – The problem has a reduced scope to eliminate distractions that add
no value at this time. For example, we are not adding any aspects on
interest charged or interest payable.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Task 2 - Map the Business Rules to the Methods


Complete the following step:
1. For each method identified in the previous task, create a list
containing the following information:
ble
a. Class name and method name
fe r a
b. The business rules that apply to that method ans
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

1-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Using Delegation and Cohesion

Activity 3: Using Delegation and Cohesion


In this exercise, you will delegate coherent responsibilities to classes by
using class associations and inheritance.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks bl e
fe r a
an s
Complete the following steps:
n - t r
1. no
Add the following details to the Class diagram that you created in
a
the previous activity:
) has eฺ
● Customer information (such
c o mas name,
u i daddress, and telephone

number)
r a cle ent G
A businessocustomer

a @ number. S tudmust also have a company
e r m this
registration

h ฺ vฺv A upersonal

se customer might have a tax reference number.
i t e s A branch
t o code identifier (each branch in this bank has a unique

e
(h ens identifier)
a lic Bank name and address details
Verm ●

e s h
Hit
2. Ensure that your Class diagram satisfies the following condition:
A customer can have many accounts in this bank. However, an
account can be owned by only one customer.

Examining Object-Oriented Concepts and Terminology 1-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Understanding the Benefits of Using Interfaces

Activity 4: Understanding the Benefits of Using Interfaces


In this exercise, you will understand how interfaces enable you to build
flexible solutions.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks ble
fe r a
ans
Complete the following steps:
n - t r
1. Read the following scenario:
a no
You were asked to write a software system
s can be used to buy
hathat
m ) d eฺ and sell behavior
c o
and sell property. You decided to delegate the
u i buy
that is specific to properties toleaฺPropertyTradingService
c en t G class
that includes the buy andra sell methods.
o tud
@asked
Now, you havem a
been
i s Sensure that this software system is able
to
r
e trading h
t of different types of items, such as vehicles
to support
and h ฺ vฺvmarket
stock
the
u s e
shares.
i t e s t o
2.(h Draw asclass
n e diagram that describes the classes and interfaces that
a e
ic be required to provide a flexible solution to the problem
Verm lwill
specified in step 1. You should ensure that new types of items can be
h
H ites added to the software system with minimal changes to the existing
software system.

1-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 5: Defining Object-Oriented Terminology

Activity 5: Defining Object-Oriented Terminology

Self-Check – Match the object-oriented programming terms with their


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

definitions.

Term Definition

polymorphism Identifying only those attributes and methods


bl
that are relevant to the class within the system. e
object link The ability to derive new classes that acquirefe r a
a n s
n -t r
attributes and methods from a base class.
inheritance The blueprint for an object. n o
s a
abstraction Hiding internal methods
) a
h eฺ data from direct
and
om theuiclass.
access from outside
ฺ c d
object e
cl ebetween
A relationship n t G two objects (instances).
r a
o measure
delegation a @The S tudof how much an entity (component
e r m ort h is supports a singular purpose within a
class)
h ฺ vฺv use system.
encapsulation hite
s to
( n s e The ability to determine the actual method called

r m a lice based on the object’s subtype.

h Ve
association An instance of a class.
e s
Hit class Offloading some coherent responsibilities to
another component (one or more classes) or
method.
coupling A relationship between two classes.

cohesion The degree to which classes within our system


are dependent on each other.

Examining Object-Oriented Concepts and Terminology 1-7


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Lab 2

Introducing Modeling and the Software


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Development Process

Objectives e
r a bl
sfe
Upon completion of these activities, you should be able to:
- t r an

no
Define the workflows in the Object-Oriented Software Development n
a
(OOSD) process
) h as ฺ

c o m uideGathering workflow
Identify characteristics of the Requirements
● Identify characteristics of the
c l eฺ Requirements
n t G Analysis workflow
r a
o of the e
dArchitecture
● Identify characteristics
a @ S t u workflow
● Identify e r m thisof the Design workflow
characteristics
h ฺ vฺv benefits
Identify u seof modeling software
i

t e s t o
(h ens
● Define e the various Unified Modeling Language (UML) diagram
a lic types
Verm
h
H ites

2-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Defining Workflows

Activity 1: Defining Workflows

Self-Check – Match each workflow with its description.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Term Definition

Requirements Model the high-level structure of the system,


Gathering paying particular attention to the NFRs and
ble
mitigation of risk.
fe r a
ans
Requirements Install the implementation into the production
n - t r
no
Analysis environment.
Architecture s a
Build/Code the software components defined in
the Solution model. ) h a
o m i d eฺ
Design Determine thel e c u of the system by
ฺrequirements
G
meeting c business
rathe e t
n owner and users of the
@ S o
proposed tu d
system.
a s
Implementation ฺ v erm Ensure
e thi the implementation meets the
s h ฺv usexpectations defined in the requirements.
it e t o
Testing
a ( h
e n se Create a Solution model of the system that
e rm li c satisfies the functional requirements.
h V
ite s
Deployment Analyze, refine, and model the requirements of
H the system.

2-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Identifying Characteristics of the Requirements Gathering Workflow

Activity 2: Identifying Characteristics of the Requirements


Gathering Workflow
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the characteristics of the Requirements Gathering

✓ workflow mentioned during the lecture.

a. ___ This workflow includes meeting the business owner and


users of the proposed system to understand their
requirements.
b. ___ This workflow requires you to model the high-level system
bl e
structure to satisfy the non-functional requirements (NFRs).
fe r a
an s
c. ___ The purpose of this workflow is to determine what the
n - t r
system must do.
a no
d. ___ s diagram showing the
You will create a business domainaclass
h this
)
required business classes during
m d ฺ
eworkflow.
o i
c CaseGdiagrams
ฺUse u
e. ___ l e
You will create initial
c en t during this
workflow. ora
a @ Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Introducing Modeling and the Software Development Process 2-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Identifying Characteristics of the Requirements Analysis Workflow

Activity 3: Identifying Characteristics of the Requirements


Analysis Workflow
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the characteristics of the Requirements Analysis

✓ workflow mentioned during the lecture.

a. ___ This workflow includes recording Use Case scenarios.


b. ___ This workflow starts with analyzing and Use Case scenarios.
c. ___ The purpose of this workflow is to model how the system
ble
will support the use cases.
fe r a
d. ___ You will create a business domain class diagram showing the ans
required business classes during this workflow. n - t r
n o
a
has eฺ
e. ___ You will create a detailed Deployment diagram showing the
system architecture during this workflow.
)
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

2-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Identifying Characteristics of the Architecture Workflow

Activity 4: Identifying Characteristics of the Architecture


Workflow
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the characteristics of the Architecture workflow

✓ mentioned during the lecture.

a. ___ You will create detailed Deployment diagram during this


workflow.
b. ___ The purpose of this workflow is to model the high-level
structure of the system to satisfy the NFRs.
bl e
c. ___ You will create a tiers and layers diagram during thissfe
r a
workflow.
- t r an
d. ___ The purpose of this workflow is to model n othen high-level
structure of the system to satisfya s
the
a
FRs.
m ) h during
d eฺ this workflow.
e. ___ You will refine the Designo model
ฺc t Gu i
l e
o rac uden
a @ St
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Introducing Modeling and the Software Development Process 2-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 5: Identifying Characteristics of the Design Workflow

Activity 5: Identifying Characteristics of the Design


Workflow
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the characteristics of the Design workflow mentioned

✓ during the lecture.

a. ___ You will use an Activity diagram to verify Use Case


diagrams during this workflow.
b. ___ You will analyze the Use Case scenarios to determine
additional detail during this workflow.
ble
fe r a
c. ___ s
You will create a Solution model during this workflow.
a n
d. ___ n
You might create a Statechart diagram during this r
-tworkflow.
o
n the system
a
has eฺ
e. ___ The purpose of this workflow is to model how
will support the use cases.
)
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

2-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 6: Exploring the Benefits of Modeling

Activity 6: Exploring the Benefits of Modeling


In this exercise, you will explore one of the benefits of modeling.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks
bl e
fe r a
As a group, complete the following steps:
a n s
n
1. Review the following front and plan views of an objectr
-t that a
company wants you to build: n o
a
) has eฺ
Front View
ฺ c om uidPlan/Top View
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Figure 0-1 Front View and Plan View of an Object

2. Answer the following questions:


● Has the company given you sufficient information to build the
object? If not, what additional information do you need?
● Assuming that someone did actually build the object for the
company, what do you think would the object look like?

Introducing Modeling and the Software Development Process 2-7


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 7: Identifying the Benefits of Modeling Software

Activity 7: Identifying the Benefits of Modeling Software

Self-Check – Select the benefits of modeling software mentioned during


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

the lecture.

a. ___ Models give you only a starting point for a new system.
b. ___ Models help you only to understand what you have
developed.
c. ___ Models help you visualize new or existing systems.
ble
d. ___ Models are a concrete realization of a system.
fe r a
e. ___ Models help you communicate decisions to project ans
stakeholders. n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

2-8 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 8: Identifying Diagram Types

Activity 8: Identifying Diagram Types

Self-Check – Match the UML diagram with its description of the diagram


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

type.

Diagram Name Definition

Use Case Represents changes in state or value along with state


duration constraints
bl e
Class Represents a flow of tasks that might be performed by fe r a
n s
either a system or an actor
n - tra
Object Represents a collection of components,
a noand shows how
these are distributed across one s or more hardware nodes
h a
) fragments
Communication Represents a flow of task
o m with i d eฺ of detailed object
interactions l e ฺc t Gu
c en
raacollection
Sequence Representso
@some S tud behavior
of objects that work together to
a
m this
support
r system
e
Activity
h ฺ vฺv Represents
u se the internal structure of a class in terms of
i t e s t oparts
e
(h ens Represents a conceptual view of a collection of other
rm a
State Machine
lic
V e modeling elements and diagrams
eshComponent
Hit
Represents a collection of physical software components
and their interrelationships
Deployment Represents the set of states that an object might experience
along with triggers that transition the object from one
state to another
Package Represents a time-oriented perspective of an object
communication
Interaction Represents a runtime snapshot of software objects and
Overview their interrelationships
Timing Represents extensions to standard diagrams
Composite Structure Represents the set of high-level behaviors that the system
must perform for a given actor

Introducing Modeling and the Software Development Process 2-9


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 8: Identifying Diagram Types

Diagram Name Definition

Profile Represents a collection of software classes and their


interrelationships
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
V erm
h
H ites

2-10 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Lab 3

Creating Use Case Diagrams


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Objectives
bl e
Upon completion of these activities, you should be able to:
fe r a
Identify the essential elements in a Use Case diagram an s

n - t r

FRs provided by the business owner a no
Extend a Use Case diagram based on a list of additional high-level

Divide a Use Case diagram into views ) has eฺ


om based

ฺ c u idon a list of additional


● e views
n t G
cbyl the eadditional
Extend the Use Case diagram
o r
high-level FRs provideda d stakeholders
@ diagram
Refine the UseaCase
t u
S views by modeling dependency

r m h i s
ฺ v ฺve use t
relationships

i t e sh to
a (h ense
erm lic
h V
H ites

3-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Identifying Use Case Symbols

Activity 1: Identifying Use Case Symbols

Self-Check – Write the name of each Use Case diagram symbol in the


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

space allotted next to each symbol.

Symbol Symbol Name

 e
r a bl
 
s fe
- t r an

 
n o n
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
ฺ ฺv use
vGetEmployeeInfo
e s h t o
i t
(h ens e
a lic
Verm 
 
h
ites
  
 

H  

3-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Hotel System – Abstract of Additional Requirements (1)

Hotel System – Abstract of Additional Requirements (1)


This workbook contains several exercises you can use to apply what you
have learnt. Most of the exercises involve a fictional case study requiring
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

you to extend the example Hotel system.

You will use the following abstract of additional high-level requirements


discovered during a meeting with the business owner for ‘‘Activity 2:
Creating a Use Case Diagram’’ on page L3-4 of this workbook.

Abstract e
r a bl
sfe
The receptionist must be able to check out customers before they leave the
- t r an
hotel. During the check-out procedure, a customer’s bill is calculated and
no n
a
presented to the customer. In most cases, immediate payment is required
has eฺ
to settle the bill for any outstanding room, meal, or other chargeable items
)
om uid
added to the bill during the stay. The most common payment method is in
ฺ c
the form of a credit card or a debit card.
r a cle ent G
Some customers will @ o all ortupart
have d of their bill guaranteed by a
a
m thfor
purchase order.rInvoices S
is these charges will be generated daily and
e
vฺv orusent
either printed
h ฺ seelectronically to the company or travel agent.
i t e s t o
(h ens
Customers ewho are currently checked-in, but have not yet checked-out,
a liccharge food, beverages, or other services to their room account.
erm
can

h V
H ites The room telephone is enabled upon check-in and disabled upon check-
out.

Creating Use Case Diagrams 3-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Creating a Use Case Diagram

Activity 2: Creating a Use Case Diagram


In this exercise, you extend the initial Use Case diagram of the Hotel
System based on additional high-level requirements discovered during a
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

meeting with the business owner.

Figure 3-1 illustrates the initial Use Case diagram of the Hotel System.

ble
fe r a
ans
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Figure 3-1 Initial Use Case Diagram of the Hotel System

Preparation
No special preparation is required for this activity.

3-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Creating a Use Case Diagram

Tasks
Complete the following steps:
1. Read the abstract of additional requirements for the Hotel System
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

that is provided on page L3-3.


2. Create a system boundary for the Hotel System.
Hint: Use Case diagrams can grow to be very large. Therefore, it is
good practice to only draw the upper-left corner of the system
boundary when starting your diagram.
3. From Figure 3-1 on page L3-4, copy any of the actors, use cases, and
bl e
associations that are relevant to the additional requirements.
fe r a
4. Add actors that are required by the additional requirements.
an s
n - t r
5.
no
Add use cases that are required by the additional requirements.
a
6. Make associations between actors and usescases that are required by
the additional requirements. ) ha eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Creating Use Case Diagrams 3-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Hotel System – Abstract of Additional Requirements (2)

Hotel System – Abstract of Additional Requirements (2)


You will use the following abstract of additional high-level requirements
discovered during a meeting with the additional stakeholders for
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

‘‘Activity 3: Refining the Use Case Diagram’’ on page L3-7 of this


workbook.

Abstract
The marketing staff can publish current offers to their customer base via
e-mail. ble
fe r a
The hotel group does not currently have a loyalty scheme. However, the ans
group is affiliated with airlines, car rental companies, and other reward n - t r
a no
points schemes. For example, customers traveling on affiliated airlines
has eฺ
will earn airmiles. Customers that have registered a loyalty card will have
)
om uid
points awarded to that external scheme when their bill for a reservation is
settled. ฺ c
r a cle ent G
Customers who provided @ ao ud must be sent a text message
phone tnumber
m a S
is arrival date. This is a courtesy text
during the morning
e r of their due
t h
vฺv uthem
message reminding
h ฺ se of their booking.
i t e s t o
(h ens
Cleaners can e
request a list of rooms that have been vacated. Once a
a lic room has been prepared for the next customer, the cleaning staff
rm vacated
V e must mark the room as ready for use.
e s h
Hit Occasionally, there are discrepancies in a customer’s bill. Therefore, the
receptionist may need to make adjustments to the bill.

Night auditors will request that the system generates a discrepancy report
during the night. Based on this report, the night auditors might need to
make adjustments to a customer’s bill. The duty of night auditors is
complete for that night only when there are no more discrepancies.

3-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Refining the Use Case Diagram

Activity 3: Refining the Use Case Diagram


In this exercise, you complete the following tasks:
● Add new use cases, actors, and associations
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

● Expand high-level use cases


● Refine the Use Case diagram with dependencies and inheritance
where applicable

Preparation
bl e
fe r a
No special preparation is required for this activity.
an s
n - t r
Tasks a no
) has eฺ
Complete the following steps: ฺ c om uid
r a
1. Read the abstract of additional
tG
cle erequirements
n for the Hotel System
o t u d
r m a@
that is provided
i s S
on the preceding page.

e th
2. Createฺvaepackage structure to hold different use case views.
ฺ v s
h thetouseu cases, actors, and associations created in “Activity 2:
3. esCopy
i t se a Use Case Diagram” to the relevant package views.
(h eCreating
a n
erm lic
h V
H ites Note – A use case or actor may be shown in several Use Case diagram
views.

4. Refine the Use Case diagram views by adding actors, use cases, and
associations for the newly discovered requirements.
5. Refine the Use Case diagram views by expanding any high-level use
cases.
6. Refine the Use Case diagram views by showing dependencies
between use cases.

Note – These dependencies can be <<include>>, <<extend>>, or


generalization dependencies.

Creating Use Case Diagrams 3-7


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Refining the Use Case Diagram

7. You may, if time allows, add other use cases or use case
dependencies not mentioned in the additional requirements, that
would enhance your understanding.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

3-8 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Lab 4

Creating Use Case Scenarios and Forms


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Objectives
bl e
Upon completion of these activities, you should be able to:
fe r a
Create brief descriptions of the main scenarios for a use case an s

n - t r

scenarios a no
Fill in portions of a Use Case form to document a use case and its

) as ฺ to the project’s
hscenarios
om uide
● Add some business terms found in the
Glossary of Terms ฺ c
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

4-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Examining Use Case Scenarios

Activity 1: Examining Use Case Scenarios


In this exercise, you will write summaries of the Use Case scenarios for a
use case.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks ble
fe r a
ans
Complete the following steps:
n - t r
1. no
Read the following key facts of the Check In use case that were
a
has eฺ
determined during a meeting with some of the stakeholders:
)
●A reservation can be identified
c o m i
by customer
u d name—in which
ฺ G than one customer—or
case, the reservation may
r
by reservation number. a cInlematch
both e n
more
t
situations, it is possible that the
o t u d
r m a@ ifiscustomer
required reservation isSnot found. For example, the reservation
will not
ฺ v e be t
found
e h name is not spelled correctly or if

s h ฺvreservation
the
u s number provided is not correct.
ite The e t o
customer may be given the option of upgrading any of the
( h ●
n s
a lice reserved rooms, in which case the additional cost will need to
e r m be calculated.
h V
H ites ● The customer may ask to change any of the booked rooms for
an alternate room of the same type. For example, the customer
asks the Receptionist if the room has a view and is told that the
room does not have a view. In this case, the customer might ask
the Receptionist to change the room.
● Payment pre-authorization may be obtained unless already
guaranteed for the additional services—such as, meals,
beverages, and movies—that may be purchased. For example,
the customer’s credit card may be pre-authorized with the
Electronic Payment Services.
● If there is no payment guarantee for the additional services,
customers are not allowed to charge any items to their bills.
● If check-in is successful, an electronic room key is generated for
each reserved room.

4-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Examining Use Case Scenarios

● If check-in is successful, the phone in each reserved room is


enabled for making outgoing call, provided that the customer
has a payment guarantee for the additional services.
● A Bill—also known as a Folio—is created for the reservation.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

● Check-in should take no longer than 8 minutes to complete.


● Upon completion of the Check In use case, the rooms allocated
are marked as being occupied.

Note – This list of key facts is not an exhaustive list. Your group may wish
to add to this list during the lab.
bl e
2. Create a brief description of a primary (successful) scenario. fe r a
a n s
3. Create a brief description of any other primary (successful)
n r
-t scenarios
and any secondary (unsuccessful) scenarios that n o
could occur.
a
as ฺ in ‘‘Activity 3:
4. Revisit the Use Case diagram that youhrefined
)
Refining the Use Case Diagram’’ m
o on page L3-7
i d e of this workbook, and
c
ฺ correct.
determine if the diagram isestill
l u
G If not, update the diagram.
c
ra repeat n t
@ o
5. Optionally, if time allows,
t u de steps 2 through 4 for another use
r m a is S
case (for example, Charge Customers Bill or Check Out Customer).
ฺ v e e th
v
hฺ to us
it e s
a ( h
e n se
erm lic
h V
H ites

Creating Use Case Scenarios and Forms 4-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Creating Use Case Forms

Activity 2: Creating Use Case Forms


In this exercise, you will document a use case by using a Use Case form.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
Your instructor should hand you a Use Case form template to document
the use case. Alternatively, you can use a flip chart or a whiteboard to
write the details of the Use Case form.

ble
Tasks fe r a
ans
n - t r
Complete the following steps:
a no
1. Complete all the elements of the Use Case form
) as from
hCheck ฺ
the information
included in the Use Case scenario for the
o m i d eIn use case, which

l e ฺc tand
you completed in the previous activity,
G uthe key facts provided in
the previous activity.
o rac uden
@ repeat
2. Optionally, if timeaallows, S t step 1 for another use case (for
example, Charge s
erm Customers
thi Bill or Check Out Customer).
ฺv ฺ v e
s h t o us
it e
a ( h
e n se
erm lic
h V
H ites

4-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Writing Glossary of Terms

Activity 3: Writing Glossary of Terms


In this exercise, you will add some new business terms to the project’s
Glossary of Terms.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks bl e
fe r a
an s
Complete the following steps:
n - t r
1. no
Identify a few business terms used in the scenarios of “Activity 1:
a
) has eฺ
Examining Use Case Scenarios” or in the Use Case form of “Activity
2: Creating Use Case Forms” that would need to be defined in the
ฺ c om uid
project’s Glossary of Terms.
a
2. Write a definition forreach
t G identified in step 1.
cleof theenterms
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Creating Use Case Scenarios and Forms 4-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Lab 5

Creating Activity Diagrams


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Objectives
bl e
Upon completion of these activities, you should be able to:
fe r a
Identify the essential elements in an Activity diagram an s

n - t r
● Create an Activity diagram to model a Use Case diagram
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

5-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Actrivity1: Identifying Activity Diagram Symbols

Actrivity1: Identifying Activity Diagram Symbols

Self-Check – Write the name of each Activity diagram symbol in the


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

space allotted next to each symbol, in the following table.

Symbol Symbol Name

ble
fe r a
Design Product
ans
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

5-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Creating an Activity Diagram

Activity 2: Creating an Activity Diagram


In this exercise, you construct an Activity diagram for a use case in the
Hotel System case study.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No preparation is required for this activity.

Task bl e
fe r a
an s
Complete the following steps:
n - t r
1. no
Examine the flow of events in the solution Use Case form from the
a
lab exercise in module 4.
) has eฺ
2. Create an Activity diagram to represent
ฺ c om uthe id flow of events.
3. Start your diagram withcale n t
start node.G
r a derepresent each activity from the Use
4. Beginning with @ the o t u
first activity,
Case formrasm a is Snode. You may represent a complex set of
ฺ v th node in the main activity diagram, then
an activity
eas oneeactivity
v
activities
us activities in another activity diagram.
hฺ thetointernal
it e s
show

a ( h
e n se
erm lic
h V Note – Start with a simple diagram using branching, iteration, and
e s concurrency. Then add swimlanes, interruptible activity regions, and
Hit object flow where necessary

5. Identify whether you have discovered any new understanding, or


problems with the previous artifacts.
6. Optionally, model another use case with an activity diagram.

Creating Activity Diagrams 5-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Lab 6

Determining the Key Abstractions


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Objectives
bl e
Upon completion of these activities, you should be able to:
fe r a
Identify candidate key abstractions from the project artifacts an s

n - t r
● Use Class-Responsibility Collaboration (CRC) analysis to identify
n o
a
key abstractions from candidate key abstractions
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

6-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Finding Candidate Key Abstractions

Activity 1: Finding Candidate Key Abstractions


In this exercise, you find candidate key abstractions from the Hotel
system’s artifacts.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks ble
fe r a
ans
Complete the following steps:
n - t r
1. no
Using the use case forms, scenarios, and glossary descriptions from
a
) has eฺ
the previous lab, identify the candidate key abstractions and list
them in a candidate key abstraction template form.
c o m uid
ฺ tG
the example in Module 6ra
cle enand
2. Using the use case forms, scenarios,
of the Student
glossary descriptions from
Guide, identify any
@keyo abstractions
tud and then add them in a
additional candidate
m a S
istemplate form.
candidate keye r t h
abstraction
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

6-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Finding Key Abstractions Using CRC

Activity 2: Finding Key Abstractions Using CRC


In this exercise, you identify key abstractions using CRC.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks
bl e
fe r a
Complete the following steps:
a n s
1. Select a candidate key abstraction from the candidate n r
t abstraction
-key
solution of the first activity in this module. n o
a
2. Identify whether there is a use case inhwhich
) as theฺ candidate key
abstraction is prominent. If the o m uid
candidate e abstraction is not
key
prominent in a use case, itle ฺ c Gnot a key abstraction.
r a c probablyn t is
3. Scan the relevant project
@ o artifacts
t u de to identify responsibilities and
collaboratorsm for S key abstraction. If the candidate key
a the icandidate
s
r
ve does h
t have any responsibilities or collaborators, it
ฺ v ฺ
abstraction
s e not

e h tois unot a key abstraction.


sprobably
i t se any responsibilities and collaborators using a CRC card.
(h4. eDocument
a n
Verm 5.lic Modify your candidate key abstractions form according to the
h information found during the CRC process. Write down the reasons
H ites for any candidate key abstraction not qualifying as a key abstraction.

Determining the Key Abstractions 6-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Lab 7

Constructing the Problem Domain Model


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Objectives
bl e
Upon completion of this module, you should be able to:
fe r a
Identify the essential elements in a Class diagram an s

n - t r

adding key abstractions a no
Extend the Domain model class diagram of the Hotel System by

has diagram
Identify the essential elements in an)Object eฺ

o m i d
● Validate the Domain model l e ฺc one
using
t G umore Object diagrams
or
o rac uden
a @ St
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

7-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Identifying Class Diagram Elements

Activity 1: Identifying Class Diagram Elements

Self-Check – Write the name of each Class diagram symbol in the space


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

allotted next to each symbol.


Symbol Symbol Name

Account

ble
Account
fe r a
firstName:String
lastName:String
ans
Amount:BigDecimal
getAmount()
n - t r
setFirstName()
n o
a
1..* ) has eฺ
ฺ c om uid
r a cle ent G
employs
a @o Stud
e r m this
h ฺ vฺv use ClassB
i t e s
ClassA
t o
(h ens e
a lic
Verm
h
H ites ClassX

7-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Extending a Class Diagram

Activity 2: Extending a Class Diagram


In this exercise, you extend the Domain model class diagram of the Hotel
System by adding key abstractions identified during CRC analysis.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
Copy the classes from the Domain model class diagram of the Hotel
system that is shown in Figure 7-1.

bl e
fe r a
1..* made for 1
an s
Reservation
resv cust
Customer
n - t r
reservation number 1..* a
first name no
has eฺ
status last name
res
arrival date v )
address
departure date
1 g
ฺ c om uid
phone number
ua
ra
a c le nt G
<<operations>> nt
ee r
o1..* tude 1..*
reserve a room @ d
a roiosm S Room
by located at 1
e r m t h Property
vฺv use
room property

s h ฺ
i t e e t o 1
( h
a licen s Payment
r m Guarantee
h Ve
es
Hit
Figure 7-1 Domain Model Class Diagram of the Hotel System

Ensure that you leave space for new classes, attributes, and operations.

Note – This activity is best performed in groups by using a whiteboard or


a flip chart.

Constructing the Problem Domain Model 7-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Extending a Class Diagram

Tasks
Complete the following steps:
1. Add new class nodes for each key abstraction that you found
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

in‘‘Activity 2: Finding Key Abstractions Using CRC’’ on page L6-3 of


this workbook. Ensure that you also include a list of known
attributes and responsibilities.
Hint: Start simple by creating one diagram containing class names
and association links between collaborators, leaving space for adding
attributes and operations. When the shape (topology) of the Class
diagram solidifies, create the final version of the diagram with
ble
attributes and operations.
fe r a
2. Add new class nodes that are documented in the ans
exercises/DomainModel/AdditionalKeyAbstractions.pdf file. n - t r
a no
hasindicating
3. Add associations between collaborating classes.
4. Add relationship names along with an arrow
m ) d eฺ the direction
to read the association. o
ฺc t Gu i
l e
rac uden
5. Add association multiplicity.
o
a t improve the clarity of the diagram.
@only ifSthey
6. Add role names, but
erm e thi s
ฺv ฺ v
s h t o us
it e
a ( h
e n se
erm lic
h V
H ites

7-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Identifying Object Diagram Symbols

Activity 3: Identifying Object Diagram Symbols

Self-Check – Write the name of each Object diagram symbol in the space


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

next to each symbol.

Symbol Symbol Name

Bryan:Account

bl e
fe r a
an s
:Account n - t r
a no
) has eฺ
:Account
ฺ c om uid
cle ent G
firstName:Bryan
lastName:Smith
r
Amount:10.29a
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(hSelf-Check e
nsthat – Select the statement or statements about UML Object
rm a c e
h
✓V e li
diagrams are TRUE.

e s
Hit a. ___ Object diagrams can be validated using Class
diagrams.
b. ___ Object diagrams show runtime links.
c. ___ Object symbols can have three
compartments: name, attribute, and an
operations compartment.
d. ___ Object diagrams often show object state.
e. ___ An Object diagram is an instance of a class
diagram.

Constructing the Problem Domain Model 7-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Validating a Class Diagram

Activity 4: Validating a Class Diagram


In this exercise, you validate a Class diagram using one or more Object
diagrams.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
Choose a subset of classes that you want to model as objects. This subset
of classes should be based on the classes used in the primary (successful)
scenario that you created for the Check In use case in ‘‘Activity 1:
Examining Use Case Scenarios’’ on page L4-2 of this workbook. ble
fe r a
ans
Tasks n - t r
a no
Complete the following steps:
) has eฺ
1. Draw an object node for each key ฺ c om uidin the scenario.
abstraction
r a
2. Draw links between collaborating
tG
cle eobjects.
n
3. Follow a partial flowa @ofothe Schosen
tud scenario, changing your object
e r t h is
m progresses.
ฺ v ฺv use
model as the flow
4. Compare
e h
s thetoObject diagram to the Domain model.
i t
(h ense
rm a lic
V e
e s h
Hit

7-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Lab 8

Transitioning from Analysis to Design Using


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Interaction Diagrams

Objectives e
r a bl
sfe
Upon completion of these activities, you should be able to:
- t r an

no
Identify the essential elements of a Communication diagram n
a
● Create a Communication diagram
) has eฺ
● Identify the essential elements of
ฺ c om u id diagram
a Sequence
● Create a Sequence diagram
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

8-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Identifying Communication Diagram Elements

Activity 1: Identifying Communication Diagram Elements

Self-Check – Write the name of each Collaboration diagram symbol in the


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

space next to each symbol.

Symbol Symbol Name

ble
:Account fe r a
ans
n - t r
n o
a
2.1: getAccountInfo()
) has eฺ
ฺ c om uid
r
<<create>>
a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s :MainUIto
a (h ense
erm lic
h V
H ites :AccountSvc

Bill:Customer

8-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Creating a Communication Diagram

Activity 2: Creating a Communication Diagram


In this exercise, you create a Communication diagram for the Check-In
use case.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
You will need the Check-In Use Case Form from Lab 4.

Tasks bl e
fe r a
an s
Complete the following steps:
n - t r
1. no
Read the main flow of events in the Check-In Use Case Form.
a
2. Place the actor for the use case on theh
) as ฺ
diagram.
3. Analyze the flow of events. For ฺ c m action
oevery u idein the use case:
a. Identify and addra boundary tG
cle encomponents.
o tud
@add
b. Identify and
m a i s S components.
control
r h
ฺve usand
c. Identify
ฺ v e tadd entity components.
i t e sd.h Draw t o the associations between these components.
e
(h ee.ns Label the actions performed by each component to satisfy the
a lic interactions in the use case.
Verm
h
H ites 4. Optionally create another diagram or fragment diagram for another
scenario.

Note – If your group prefers, you may do activity 4 before doing activity
2. In which case you may find it easier to convert from the Sequence
diagram created in activity 4.

Transitioning from Analysis to Design Using Interaction Diagrams 8-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Identifying Sequence Diagram Elements

Activity 3: Identifying Sequence Diagram Elements

Self-Check – Write the name of each Sequence diagram symbol in the


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

space next to each symbol.

Symbol Symbol Name

ble
Customer
fe r a
ans
:Account n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

message()

8-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Creating a Sequence Diagram

Activity 4: Creating a Sequence Diagram


In this exercise, you create a Sequence diagram for the Check-In use case.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
You will need the Check-In Use Case Form from Lab 4.

Tasks
bl e
fe r a
Complete the following steps:
a n s
1. Read the main flow of events in the Check-In Use Case n r
-t Form.
o
n diagram.
2. Arrange the components at the top of the Sequence a
Hint: Put actors and boundary components ) has eonฺ the left, followed by
service components in the middle, ฺ c omand uentities
id on the right.
l e
cactivation n G
t for each message in the first
3. Add message links and r a e bars
activity.
a @o Stud
4. RepeatvStep e rm3 for each
t h isactivity in the use case until the task is
h ฺ vฺ use
complete.
i t e s t o
(h ens e
a lic – If you have done activity 2 then you may find it easier to convert
Verm Note
h from the Communication diagram.
H ites

Transitioning from Analysis to Design Using Interaction Diagrams 8-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Lab 9

Modeling Object State Using State Machine


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Diagrams

Objectives e
r a bl
sfe
Upon completion of these activities, you should be able to:
- t r an

no
Identify the essential elements in a State Machine diagram n
a

) has eฺ object
Create a State Machine diagram for a complex

ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

9-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Identifying State Machine Diagram Elements

Activity 1: Identifying State Machine Diagram Elements

Self-Check – Write the name of each State Machine diagram symbol in


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

the space allotted next to each symbol.

Symbol Symbol Name

AcctOverdrawn
ble
fe r a
ans
n - t r
AcctOverdrawn
n o
a
has eฺ
entry / notifyCustomer
entry / doNotAllowSpending
exit / allowSpending)
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

9-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Creating a State Diagram

Activity 2: Creating a State Diagram


In this exercise, you create a State diagram for a banking example.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks
bl e
fe r a
Complete the following steps:
a n s
1. Read the following description for a complex Account n r
-t object.
n o
● All accounts start with a balance of zero.
s a
● An account with a balance greater ) hathan e ฺ equal to zero has a
or
state of “Active.” Whenฺc o m i d
u active, a customer may
accounts are
deposit any amountcof l emoney,
n t G
withdraw any amount of money
r a
(as long as theooverdraft e
dlimit is not reached), and transfer
a @the Active
S tuaccount
moneym
r from
h i s to another account.

ฺ v ฺve use t
i t e s–hAn overdraft
t o limit is a set amount that a customer’s account can
Note e
(hhaveeinnshort-term
s
r m a l i c (less than 3 months) debt without being frozen. It is
Ve similar to a short-term loan from the bank. For example, if the bank gives
h
ites
their customers an overdraft limit of $100.00, it means that a customer’s
H account balance can be –$99.99 without being frozen. But as soon as the
account goes to –$100.00 or below, it is frozen and the customer can no
longer withdraw money.

● If the balance in an account becomes less than zero (but greater


than the overdraft limit such as in the previous example), the
account state is changed to “Overdrawn.” When an account is
overdrawn:
● A customer can still withdraw money from an overdrawn
account as long as the amount withdrawn does not cause
the balance to go below the overdraft limit.
● A customer is sent monthly notices about the status of the
account.
● A customer is notified of being overdrawn when they
withdraw money from an automated teller machine (ATM).

Modeling Object State Using State Machine Diagrams 9-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Creating a State Diagram

● A customer cannot transfer money from the overdrawn


account to another account.
● A customer cannot close the account.
● If the status remains “Overdrawn” for more than 3 months, the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

account state is changed to “Frozen.” When an account is


frozen:
● The customer cannot withdraw money from the account.
● The customer can deposit money into the account.
● The customer is sent monthly notices about the status of
the account.
ble
● The customer is notified by the ATM that they must meet
fe r a
with the bank’s manager to unfreeze the account.
ans
● The customer cannot close the account.
n - t r
● a no
The bank manager might decide to close all of the
has eฺ
customer’s accounts and file legal action against the
)
ฺ c om uid
customer. Should this happen, the customer cannot open

a c le nt G
any accounts with this bank again.
r defalls below zero by an amount
@o limit,
● Whenever the account balance
equal to the a overdraft t u
S the account state is changed to
“Frozen.” r m i s
th bullet for information on the Frozen
e Seeeprevious
v ฺ v
s ฺ
hstatus. t o us
h e
it Ifsaneaccount is closed by the customer, the account state is
( ●
a licenchanged to “Closed” and the customer can no longer use the
e r m
h V account.

H ites 2. Choose the initial and final states for the object. Specify the
preconditions of the initial state and the post conditions of the final
state.
3. Choose the stable states of the object.
4. Specify the partial ordering of stable states over the lifetime of the
object.
5. Specify the events that trigger the transitions between the states of
the object. Specify transition actions (if any).
6. Specify the actions with a state (if any).

9-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Lab 10

Applying Design Patterns to the Design


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Model

Objectives e
r a bl
sfe
Upon completion of these activities, you should be able to:
- t r an
● Apply the Composite Reuse Principle (CRP) n o n
a
● Apply the Strategy pattern
) has eฺ
● Apply the Observer pattern
ฺ c om uid
Apply the State patternacl
e nt G

r
o tude
@
a is S
r m
e e th
v ฺ v
e s hฺ to us
( h it se
a e n
erm lic
h V
H ites

10-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Applying CRP

Activity 1: Applying CRP


In this exercise, you apply CRP to a case study.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks
ble
fe r a
Complete the following steps:
a n s
-t r
1. Read the following information pertaining to a VehiclenInformation
System: n o
a
as ฺ types of vehicle
You need a system to record the details ofhvarious
)
that can move on land, water, air, or
ฺ c o m i de of these terrains.
a combination
u
G for each vehicle
cle toebentrecorded
The information that is required
includes the following:ora
a @ Stud
weight

e r m this
ฺ v sedimensions (h,l,w), where h stands for height, l
vฺMaximum

h
s standst o ufor length, and w stands for width
i t e
a (h ensePower sources with fuel type

erm lic
h V ● Maximum speed on each terrain
e s
Hit
● Certification information (airworthiness, seaworthiness,
and land vehicle inspection).
Your job is to ensure that the system can accommodate these
different types of vehicle and can be easily modified for new terrains
and power sources in the future.
2. Draw a single Class diagram that shows how CRP can be applied to
the problem to create a flexible solution.

10-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Applying the Strategy Pattern

Activity 2: Applying the Strategy Pattern


In this exercise, you apply the Strategy pattern to the Hotel System case
study.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks bl e
fe r a
an s
Complete the following steps:
n - t r
1. no
Read the following information pertaining to the Hotel System case
a
study.
) has eฺ
The marketing department of the
c o mhotel uwill
i d implement various
ฺ t G the quoted price. These
offers may include the r a cle toecalculate
discount offers that are used
following: n
a @o staySfor tudthe price of one night, provided it is a
e
Two

r m this is, Friday, Saturday, or Sunday.
nights

vฺv 5 nights
weekend—that
h ฺ u se stay for the price of 4 nights at any time during the
i t e s t o

e
(h ens offer period.
a lic
erm 10% discount during the offer period.

es hV These discount offers will vary between the hotel properties.


H i t
Your job is to ensure that the Hotel System can accommodate
algorithms for these different offers. You must also ensure that new
offers with different algorithms can be easily added in the future.
2. Draw a single Class diagram that shows the Strategy pattern solving
the problem in the case study.

Applying Design Patterns to the Design Model 10-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Applying the Observer Pattern

Activity 3: Applying the Observer Pattern


In this exercise, you apply the Observer pattern to the Hotel System case
study.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks ble
fe r a
ans
Complete the following steps:
n - t r
1. no
Read the following information pertaining to the Hotel System case
a
study:
) has eฺ
When a customer vacates a room after
c o mchecking
u i d out, various

e should Gnotified immediately and
individual members of the staff
departmental display screens r a clshould n t be
e updated. The individual
be
o
@be notifiedt u d
staff members should
m aThese i s S byofathe message sent to a portable
e
hand-held device.
v r t h members staff should include a
ฺv ฺ
chambermaid, e
s housekeeping supervisor, the mini-bar stockist,
the
u
s h t o
e roome maintenance.
( h itand
shownthes
The departmental display screens should
status of rooms in various departments including
r m a lhousekeeping
i c e and maintenance.
Ve
h
ites
Your job is to ensure that the Hotel System includes the functionality
H to notify the concerned members of the staff and update the
departmental display screens as soon as possible after the room
becomes vacant. You must also ensure that when a room becomes
vacant, other notifications that may be required in the future can be
added easily.
2. Draw a single Class diagram that shows the Observer pattern
solving the problem in the case study.

10-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Applying the State Pattern

Activity 4: Applying the State Pattern


In this exercise, you complete the following tasks:
● Simplify pseudo code by refactoring it based on the State pattern.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

● Create a Class diagram that implements the State pattern for the
previous example.

Preparation
No special preparation is required for this activity. bl e
fe r a
an s
Tasks n - t r
a no
Complete the following steps:
) has eฺ
c m This
ocode. u idlarge block of code is
1. Examine the following pseudo
e ฺ G
r a cl object
currently used in the Account
e n t to ensure that it acts
appropriately whenoa customer
a @ Stud attempts to withdraw money.
r m this{
withdrawlMethod()
e
h ฺ vฺv use
i t e s if (accountStatus
t o = “Active”) {
(h ens eallow customer to withdrawl up to (OverdraftLimit
a lic
erm
+ currentBalance);
h V }
e s else if (accountStatus = “Overdrawn”{
Hit DisplayMessage(“You are Overdrawn”);
allow customer to withdrawl up to (OverdraftLimit
+ currentBalance);
}
else if (accountStatus = “Frozen”) {
DisplayMessage(“Account Frozen, you cannot
withdrawl money, please visit with bank manager”);
}
else {
DisplayMessage(“Account is closed, you cannot
withdrawl money.”
}
2. Given what you know about the State pattern, how would you
refactor this code?

Applying Design Patterns to the Design Model 10-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Applying the State Pattern

3. Create a Class diagram that represents your refactoring (based on the


state pattern). Be sure to annotate each class in the diagram to show
where the code goes.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

10-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Lab 11

Introducing Architectural Concepts and


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Diagrams

Objectives e
r a bl
sfe
Upon completion of these activities, you should be able to:
- t r an

no
Identify the tiers, layers, and systemic qualities for the SunTone n
a
Architectural Methodology
) h as ฺ
● Identify the essential elements of m
o a Component
i d e diagram
l
Identify the essential elements
c G u
eฺ of na tDeployment diagram

r a c
● Create a high-level o
@ Deploymentt u dediagram
r m a is S
ฺ v e e th
v
hฺ to us
it e s
a ( h
e n se
erm lic
h V
H ites

11-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Identifying Tiers, Layers, and Systemic Qualities

Activity 1: Identifying Tiers, Layers, and Systemic Qualities

Self-Check – Match the layers with their definitions.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Layer Definition
Application Provides the APIs that application
components implement
Virtual Platform Consists of the operating system
Upper Platform Includes computing components such as
ble
servers, storage, and network devices
fe r a
ans
Lower Platform Provides a concrete implementation of
n - t r
requirementsa no
components to satisfy the functional

Hardware ) has such


Consists of products e ฺ as web and
o m i d
Platform
l e ฺc and
containers
t G u
middleware

o rac uden
a @ St
e r m this
vฺv uthe
Self-Check – Match
h ฺ setiers with their definitions.
✓ i t
(h ens
e s
e t o
r m a Tier
l i c
Definition

Ve Client Provides services and entities


h
H ites Presentation All back-end components, such as a Database
Management System (DBMS) or Enterprise
Information System (EIS)
Business Usually described as “thin”; often is a web
browser.
Integration Provides the Hyper Text Markup Language
(HTML) pages and forms sent to a web browser
and process the user’s requests
Resource Provides components that tie the business tier to
the resource tier

11-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Identifying Tiers, Layers, and Systemic Qualities

Self-Check – Match the systemic qualities with their definitions.

✓ Systemic Quality Definition


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Developmental Addresses the requisite qualities as the


system evolves
Manifest Addresses the qualities reflected in the
execution of the system
Evolutionary Addresses the requisite qualities in
production
bl e
Operational Addresses the requisite qualities during
fe r a
system development
an s
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Introducing Architectural Concepts and Diagrams 11-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Exploring Component Diagrams

Activity 2: Exploring Component Diagrams

Self-Check – Write the name of each Component diagram symbol in the


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

space next to each symbol.

Symbol Symbol Name

<<JAR>>

PayrollSystemJAR
ble
fe r a
ans
<<reside>>
n - t r
n o
a
) has eฺ
ฺ c om uid
* rac
le nt G
@ o tude
r m a is S
ฺ v e e th
v
hฺ to us
it e s
a ( h
e n se *
erm li c
h V
ites
DBMS
H
DrawApp
*

11-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Exploring Component Diagrams

Self-Check – Select the statement or statements about UML Component

✓ diagrams that are TRUE.

a. ___ A component represents a software unit.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

b. ___ There are descriptor and instance forms of


Component diagrams.
c. ___ Components cannot be abstract.
d. ___ Component diagrams show the organizations and
dependencies among components.
e. ___ You can create your own component icons to extend bl e
the UML. fe r a
an s
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Introducing Architectural Concepts and Diagrams 11-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Understanding Deployment Diagrams

Activity 3: Understanding Deployment Diagrams

Self-Check – Write the name of each Deployment diagram symbol in the


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

space next to each symbol.

Symbol Symbol Name

<<FTP>>

ble
<<JAR>>
fe r a
ans
PayrollSystemJAR
n - t r
n o
a
) has eฺ
PC ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites
Self-Check – Select the statement or statements about UML Deployment

✓ diagrams that are TRUE.

a. ___ You can assign your own icons to represent


hardware in Deployment diagrams.
b. ___ There are descriptor and instance forms of
Deployment diagrams.
c. ___ Descriptor Deployment diagrams show a particular
deployment of a system.
d. ___ The «deploy» stereotype can be used to document
components within a node.
e. ___ There is only a descriptor form of Deployment
diagrams.

11-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Creating a High-Level Deployment Diagram

Activity 4: Creating a High-Level Deployment Diagram


In this exercise, you create a high-level Deployment diagram for the Hotel
System case study.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
Read the following requirements pertaining to the Hotel System case
study:

Hotel System – Additional Abstract of Requirements bl e


fe r a
an s
The database server and the Web server must be on separate hardware
n - t r
nodes.
a no
h as ฺ
Hotel System – Recap of Systemm )
Requirements
ฺ c o u ide
r a cle ent G
@inoLabrequirements
Note – The recap of system
a S
d
tuand are an abstract of the

e r m this
requirements provided 3 Lab 10.

h ฺ
The bookingvฺvagentu e
s(internal staff) must be able to manage reservations on
e s t
it ofscustomerso
( hbehalf
n e who telephone or e-mail with reservation requests.

r m a lice
The majority of these requests will make a new reservation, but
Ve occasionally they will need to amend or cancel a reservation. A reservation
h holds one or more rooms of a room type for a single time period, and must
H ites be guaranteed by either an electronic card payment or the receipt of a
purchase order for corporate customers and travel agents. These payment
guarantees must be saved for future reference.

A reservation can also be made electronically from the Travel Agent system
and also by customers directly via the internet.

The receptionist must be able to check in customers arriving at the hotel.


This action will allocate one or more rooms of the requested type. In most
cases, a further electronic card payment guarantee is required.

The receptionist must be able to check out customers before they leave the
hotel. During the check-out procedure, a customer’s bill is calculated and
presented to the customer. In most cases, immediate payment is required
to settle the bill for any outstanding room, meal, or other chargeable items
added to the bill during the stay. The most common payment method is in
the form of a credit card or a debit card.

Introducing Architectural Concepts and Diagrams 11-7


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Creating a High-Level Deployment Diagram

Some customers will have all or part of their bill guaranteed by a


purchase order. Invoices for these charges will be generated daily and
either printed or sent electronically to the company or travel agent.

The room telephone is enabled upon check-in and disabled upon check-
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

out.

The marketing staff can publish current offers to their customer base via
e-mail.

The hotel group does not currently have a loyalty scheme. However, the
group is affiliated with airlines, car rental companies, and other reward
points schemes. For example, customers traveling on affiliated airlines ble
will earn airmiles. Customers that have registered a loyalty card will have fe r a
points awarded to that external scheme when their bill for a reservation is ans
settled. n - t r
a no
Customers who provided a phone number must
) h abes sent
ฺ a text message
during the morning of their due arrival date.
ฺ c om This
u idisea courtesy text
cle ent G
message reminding them of their booking.
r a
Cleaners can request aa @oforooms
list S
d have been vacated. Once a
tuthat
vacated room has been
e r m prepared
t h is for the next customer, the cleaning staff
must mark ฺthe
h vฺvroomuasseready for use.
i t e s t o
(h a ecustomer
When n e
s vacates a room after checking out, various individual
a
rm members c
li of the staff should be notified immediately and departmental
V e display screens should be updated. The individual staff members should
e s h
Hit
be notified by a messages sent to a portable hand-held device. These
members of the staff should include a chambermaid, the housekeeping
supervisor, the mini-bar stockist, and room maintenance. The
departmental display screens should show the status of rooms in various
departments including housekeeping and maintenance.

Your job is to ensure that the Hotel System includes the functionality to
notify the concerned members of the staff and update the departmental
display screens as soon as possible after the room becomes vacant. You
must also ensure that when a room becomes vacant, other notifications
that may be required in the future can be added easily.

11-8 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Creating a High-Level Deployment Diagram

Tasks
Complete the following steps:
1. Create a high-level Deployment diagram from the selected
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

architecture type and technologies.


2. List the applications mentioned in the case study.
Remember, some applications might exist within the context of
another application. For example, an applet is run within a Web
browser.
3. List the actors and hardware nodes
bl e
4. Draw relationships between actors and the hardware nodes. Draw
fe r a
relationships between hardware nodes.
an s
n - t r
5. Label the hardware nodes.
a no
6. Place the applications identified in Step 2 sin the appropriate
hardware node. h a
) deฺ
c o m u i
e ฺ G
r a cl ent
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Introducing Architectural Concepts and Diagrams 11-9


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Lab 12

Introducing the Architectural Tiers


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Objectives
bl e
Upon completion of these activities, you should be able to:
fe r a
Update and extend the tiers and layers package diagram used in the an s

example case study for the Hotel System. n - t r
n o
a
Extend the DAOFactory used in the example case study to allow a
has eฺ

change of database and the integration of external resources
)
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

12-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Update and Extend a Tiers and Layers diagram

Activity 1: Update and Extend a Tiers and Layers diagram


In this exercise, you update and extend the tiers and layers package
diagram used in the example case study for the Hotel System.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks ble
fe r a
ans
Complete the following steps:
n - t r
1.
a no
Open the TiersAndLayers.pdf file located in the
exercises/ArchTiers/ directory.
) has eฺ
c o
2. Update and extend the Tiers and Layers m diagram
u i d by using the

r a cle ent G
information provided in the TiersAndLayers.pdf file.

a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

12-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Create DAOFactory and DAO Classes

Activity 2: Create DAOFactory and DAO Classes


In this exercise, you create a Class diagram for the DAOFactory and DAO
classes required by the Hotel System.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks bl e
fe r a
an s
Complete the following steps:
n - t r
1. no
Create a Class diagram containing the DAO classes that will allow
a
) has eฺ
you to access two different data sources. You only need to show a
representative number of DAOs to support the Reservation and
Customer entities. ฺ c om uid
2. Add the DAOFactoryra
cle enwill
classes you
t Grequire to create the DAO
objects. a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Introducing the Architectural Tiers 12-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Lab 13

Refining the Class Design Model


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Objectives
bl e
Upon completion of these activities, you should be able to:
fe r a
Refine attributes an s

n - t r
● Encapsulate attributes
a no
● Refine associations
) has eฺ
● Refine methods
ฺ c om uid
● Declare constructors
r a cle ent G
Review your class o totuensure
@design d that it maintains high cohesion

a
m this S
r
and low coupling
e

h ฺ
Createvฺvcomponents
u se with well-defined interfaces
i t e s t o
(h ens e
a lic
Verm
h
H ites

13-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Refining Attributes

Activity 1: Refining Attributes


In this exercise, you will:
● Refine the class attributes in the Design model.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

● Encapsulate the class attributes in the Design model.

Preparation
Review the Class diagram of the Hotel System case study that you created
in ‘‘Activity 2: Extending a Class Diagram’’ on page L7-3 of this ble
workbook. This Class diagram is the starting point for this activity. fe r a
ans
n - t r
Task 1 – Refine Attributes a no
) has eฺ
Complete the following steps:
ฺ c om uid
1. Refine the class attributesa incthe G
le Classntdiagram.
r
o attribute
u dtoe follow convention.
2. Refine the name of @
a is S
each t
r m
edata typethfor each attribute. Create new <<utility>>
3. Identify the
v ฺ v e
s ฺ necessary.
typeshif
t o us For example, the arrival date and departure date
h e
itcould be ecombined into a DateRange class with a method to check
(
a lice for n s
overlapping dates and a method to return the duration.
e r m
h V 4. Designate an initial value for each attribute (if applicable).

H ites 5. Identify the property for each attribute (changeable, addOnly, or


frozen).

Task 2 – Encapsulate Attributes


Complete the following steps:
1. Encapsulate the class attributes in the Class diagram.
2. Make each attribute private.
3. Add public accessor methods for all attributes. Some attributes you
might want to keep hidden, if so then do not create an accessor
method for this attribute.

13-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Refining Attributes

4. Add public mutator methods for all attributes. Do not add a mutator
method for any attribute that is marked with the property of
“frozen.”
5. If appropriate, identify any derived attributes and create accessor or
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

mutator methods to interface with these attributes.

bl e
fe r a
an s
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Refining the Class Design Model 13-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Refining Associations using Aggregation and
Composition
In this exercise, you will refine the class associations using aggregation or
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

composition where appropriate.

Preparation
You will use the Class diagram of the Hotel System case study that you
updated in the previous activity as the starting point for this activity.
ble
fe r a
Task – Adding Aggregation and Composition ans
n - t r
a no
has eฺ
Complete the following steps:
)
ฺ c om uiwhether
1. Review each class association and determine d aggregation or

r a cle ent G
composition would be more appropriate.
o to add
2. Refine you class diagram
@ t u dany aggregation or composition
found in step 1. a
m i s S
r h
ฺ v ฺve use t
i t e sh to
a (h ense
erm lic
h V
H ites
Activity 3: Refining the Direction of Traversal

Activity 3: Refining the Direction of Traversal


In this exercise, you will:
● Determine the direction of traversal of associations.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

● Elaborate class methods to maintain the associations.

Preparation
You will use the Class diagram of the Hotel System case study that you
updated in the previous activity as the starting point for this activity. bl e
fe r a
an s
Task – Refine the Direction of Traversal ofon-tr
Associations a n
) has eฺ
Complete the following steps:
ฺ c om uid
ctraversal t G
le n(navigation).
a
1. Identify the directionrof
o tude
2. Add association @ S
a methods.
r m h i s
ฺ v ฺve use t
i t e sh to
a (h ense
erm lic
h V
H ites

Refining the Class Design Model 13-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Refining Business Methods and Constructors

Activity 4: Refining Business Methods and Constructors


In this exercise, you will:
● Elaborate business methods.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

● Declare constructors.
● Annotate methods and constructors.

Preparation
ble
You will use the Class diagram of the Hotel System case study that you
fe r a
updated in the previous activity as the starting point for this activity.
ans
n - t r
n o
Task – Refine Business Methods and Constructors
s a
) ha eฺ
Complete the following steps: ฺ c om uid
a le nt G
cmethods.
1. Add or define new business r
o tude
2. Add constructors.a @ S
r m h i s
3. Annotate
ฺ v ฺvthee methods
s e t and constructors that you added in steps 1
i e
and
t sh2. to u
a (h ense
erm lic
h V
H ites

13-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 5: Checking your Class Diagram for High Cohesion and Low Coupling

Activity 5: Checking your Class Diagram for High Cohesion


and Low Coupling
In this exercise, you will review your Class diagram to ensure that it has
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

high cohesion and low coupling.

Preparation
You will use the Class diagram of the Hotel System case study that you
updated in the previous activity as the starting point for this activity.
bl e
fe r a
Task – Review Cohesion and Coupling an s
n - t r
a no
has eฺ
Complete the following steps:
1. Review your Class diagram, and m )
ฺ c o discussuiind your group whether the
diagram has high cohesion.
r a cle ent G
2. Review your Class o d discuss in your group whether the
diagram,uand
diagram has low @
a coupling.S t
r m h i s
3. Resolve
ฺ v ฺveanyuissues
s e t identified in steps 1 and 2 by modifying your
e h diagram.
sClass t o
i t
(h ens e
a lic
Verm
h
H ites

Refining the Class Design Model 13-7


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 6: Creating Components with Interfaces

Activity 6: Creating Components with Interfaces


In this exercise, you will create cohesive components from groups of
classes that should work together.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
You will use the Class diagram of the Hotel System case study that you
updated in the previous activity as the starting point for this activity. In
addition, you will use the service classes that you created in ‘‘Activity 2:
Creating a Communication Diagram’’ on page L8-3 and ‘‘Activity 4: ble
Creating a Sequence Diagram’’ on page L8-5 of this workbook to specify
fe r a
names for the interfaces.
ans
n - t r
a no
Task – Define Components and Interfaces
) has eฺ
ฺ c om uid
Complete the following steps:
r a cle ent G
1. Create components forothe different
a @ Stud areas of common functionality.
e r m this
Note – For h ฺ vฺv uinsethe lending library system, we created the
example,
i t e s andtoBookInventory components.
a (h ense
Membership

e rm 2. lForic each component created in step 1, add any provided interfaces.


h V
i t es
H Note – Provided interfaces are often interfaces of the service classes.

3. For each component created in step 1, add any required interfaces


that the component requires other components to provide.

13-8 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Lab 14

Overview of Software Development


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Processes

Objectives e
r a bl
sfe
Upon completion of these activities, you should be able to:
- t r an

no
Describe two characteristics of common methodologies n
a

) has eฺ
Define the five object-oriented methodologies
● Develop an iteration plan
ฺ c om uid
Select the appropriate a cle ent for
methodology
G case studies

r
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

14-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Identifying Methodology Characteristics

Activity 1: Identifying Methodology Characteristics

Self-Check – Select the statement or statements about Use-Case-driven


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

methodologies that are true.

a. ___ Focus on relationships between actors and the system


b. ___ Based on the notion that software performs activities for
users
c. ___ Uses non-functional requirements to drive structure of the
system ble
fe r a
d. ___ Must be iterative
a n s
e. ___ Focus on the systemic qualities, such as reliability n r
-tand
n o
scalability a
) has eฺ
ฺ c om uid
corlestatements
n t G
Self-Check – Select the statement
o r a d e about Architecture-centric
t u
✓ r m
e e th
a@ is S
methodologies that are true.

v ฺ v
a. ___ hฺ Focus on
s t o usrelationships between actors and the system
h it e e on the notion that software performs activities for
a (
b. ___
e n sBased
e rm lic users
h V c. ___ Uses non-functional requirements to drive the architecture
e s
Hit of the system
d. ___ Must be iterative
e. ___ Focus on the systemic qualities, such as reliability and
scalability

14-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Defining the Five Object-Oriented Methodologies

Activity 2: Defining the Five Object-Oriented


Methodologies
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Match the object-oriented software development

✓ methodology terms with their definitions.

Term Definition

Waterfall An iterative software development process, bl e


created by Booch, Jacobson, and Rumbaugh, that fe r a
is freely available for use. an s
n - t r
n o
eXtreme Programming Coding and testing are the a
s key activities within
this methodology. ) ha
(XP)
o m i d eฺ
l e ฺc t Gu
Unified Software r ac deframework,
Team-oriented
o n where each Sprint
Development Process
a @produces
S tua working version of the software.
(UP)
erm e thi s
ฺv ฺ v
s h t o us
h t e
Rational Unified iProcess
e This methodology uses a single phase in which all
(RUP) (
a licen s workflows proceed in a linear fashion.
e r m
es Scrum hV A commercial implementation of the UP
H i t methodology.

Overview of Software Development Processes 14-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 3: Producing an Iteration Plan

Activity 3: Producing an Iteration Plan


In this exercise, you produce an iteration plan for the Hotel System case
study.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks ble
fe r a
ans
Complete the following steps:
n - t r
1. no
Re-assess the priorities and risks for the Use Case form that you
a
workbook. ) has eฺ
created in ‘‘Activity 2: Creating Use Case Forms’’ on page L4-4 of this

c o m uid
2. Assess the priorities and risksle ฺ G
r
discovered in ‘‘Activity 3: a c for thenremaining
Refiningethe
tUse use cases that you
Case Diagram’’ on
page L3-7 of this a @o Stud
workbook.
e r s
m thisignificance
3. Assess the
ฺ v ฺv use
architectural of each use case.

e sh antoiteration plan based on the results of steps 1 to 3.


4. Construct
i t
a (h ense
erm lic
h V
H ites

14-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Selecting Methodologies

Activity 4: Selecting Methodologies


In this exercise, you select the appropriate methodology for each case
study.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks bl e
fe r a
an s
Complete the following steps:
n - t r
1. Read the following scenarios.
a no
2. Select and justify the methodology that
) haissappropriate
ฺ for each case
study. Note: there can be more o
ฺ c than ide
m oneumethodology for a scenario.

r a cle ent G
ACME Insurance Case
a @o Study S tud
e r t h is (AIC) wants to create a system for entering
mCorporation
h
and storingฺ vฺvinsurance
ACME Insurance
u se policies for its over 200,000 world-wide customers.
i t e shas a small
t o development team of 4 people who will work on this
AIC
(hproject, s e
nconsisting
r m a l i c e of one project manager (who also writes
Ve documentation) and three engineers. The project manager has been asked
h
ites
to keep documentation on all phases of the project using the newest
International Standards Organization (ISO) documentation process.
H
Methodology Selection ________________

Justification _________________________________________

_________________________________________________

_________________________________________________

Overview of Software Development Processes 14-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 4: Selecting Methodologies

NoLycra.com Case Study

NoLycra.com is a small startup company that produces cycling jerseys.


The company is located in a small warehouse that includes all business
functions (sales, marketing, manufacturing, shipping, and so on).
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

NoLycra.com has become known for its unique jersey designs featuring
bright colors and non-traditional fabrics. NoLycra.com has recently hired
two computer engineers from a rival company to create an inventory
control system that tracks its customer’s orders and its inventory levels.
These engineers were recruited by NoLycra.com because they had created
an inventory control system at their previous company to help get
products quickly to market.
ble
Methodology Selection ________________ fe r a
a n s
Justification _________________________________________ n-t
r
a no
_________________________________________________
) has eฺ
c o m uid

r a cle ent G
_________________________________________________
o tud
Bravo Case Studyma@ is S
ฺ v er e th
A contractor
s h ฺvhas beenushired by Bravo software to do analysis and design
e
it eXtensible
for an t o
e Markup Language (XML)-based system that can store
( h
asolutions n s
r m l i c eto common technical support issues. The contractor will be
Ve working with a small team of employees to design and implement the
h
ites
system. Most of these employees have technical experience (including
technical writing, engineering, testing, and graphical abilities), but they
H were hired as Technical Support Analysts (TSAs). One of the TSAs
suggests that the team use Rational Rose to help with the project because
Bravo owns a license to this product. The same TSA also reminds the
team that they must follow the Product Life Cycle process when
developing and delivering the new system.

Methodology Selection ________________

Justification _________________________________________

_________________________________________________

_________________________________________________

14-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Lab 15

Overview of Frameworks
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Objectives
bl e
Upon completion of these activities, you should be able to:
fe r a
Create a high level conceptual class diagram showing the classes and an s

interfaces that would be required for a generic framework subsystem n - t r
n o
a
Discover potential domain neutral frameworks that could be shared
has eฺ

across business domains )
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

15-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 1: Creating a Conceptual Framework

Activity 1: Creating a Conceptual Framework


In this exercise, you will complete the following tasks:
● Identify the generic classes that would be required for the
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

framework
● Identify the specific domain classes that could use the framework
● Create a conceptual class diagram for the classes and relationships
that were identified

Preparation ble
fe r a
ans
No special preparation is required for this activity.
n - t r
a no
Tasks ) has eฺ
ฺ c om uid
Complete the following steps: cle n t G
r a e
owouldtubedrequired
1. Identify the classes @
aallocation
that Ssystem, wheretoresources
build a framework for
e r
a generic resource m t h i s are allocated
ฺ v
ฺv of utime.
for a period s e
e s h t o
2. hitDraw a highe level class diagram showing the generic classes and
(
a linterfacesn s
e that would be required for the framework identified in
e r m i c
step 1.
h V
H ites 3. Draw domain specific classes that could use the framework that was
created in step 2.

15-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Activity 2: Identifying Potential Frameworks

Activity 2: Identifying Potential Frameworks


In this exercise, you will identify potential frameworks that could be
shared by a selection of business domains
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Preparation
No special preparation is required for this activity.

Tasks bl e
fe r a
an s
Complete the following steps:
n - t r
1. no
Identify potential frameworks that could be shared, by the following
a
System. ) has eฺ
applications: Hotel System, Car Rental System, and Private Hospital

c o m uid
2. Identify other applicationsle ฺ tG
in step 1. r a c that ecould
n
use the frameworks discovered

@theo tud
3. Optionally,m a
model
i s S
frameworks identified in step 1, and model the
r
e ofethose h
t frameworks.
ฺ v ฺvuses
specific
s
i t e sh to u
a (h ense
erm lic
h V
H ites

Overview of Frameworks 15-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Lab 16

Course Review
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

There are no activities for this module.

bl e
fe r a
an s
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

16-1
Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

ble
fe r a
ans
n - t r
a no
Object-Oriented ) has Analysis
e ฺ and
Design c o m
Using id
UML
u
e ฺ G
r a cl ent
@ o tud
Solutions to Labs

r m a is S
ฺ v e e th
v
hฺ to us
it e s
a ( h
e n se
erm lic
h V
H ites

D61808BP21
Edition 2.1
June 2011
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e
Table of Contents
Solutions to Lab 1: Examining Object-Oriented concepts and Terminology 3
Activity 1: Using Abstraction 3
Activity 2: Using Inheritance 4
Activity 3: Using Delegation and Cohesion 5
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 4: Understanding the Benefits of Using Interfaces 6


Activity 5: Defining Object-Oriented Terminology 7
Solutions to Lab 2: Introducing Modeling and the Software Development Process 8
Activity 1: Defining Workflows 8
Activity 2: Identifying Characteristics of the Requirements Gathering Workflow 9
Activity 3: Identifying Characteristics of the Requirements Analysis Workflow 10
Activity 4: Identifying Characteristics of the Architecture Workflow
ble 11
Activity 5: Identifying Characteristics of the Design Workflow
fe r a 12
Activity 6: Exploring the Benefits of Modeling
ans 13
Activity 7: Identifying the Benefits of Modeling Software
n - t r 14
Activity 8: Identifying Diagram Types no 15
a
Solutions to Lab 3: Creating Use Case Diagrams
Activity 1: Identifying Use Case Symbols ) has eฺ 17
17
Activity 2: Creating a Use Case Diagram ฺ c om uid 18
Activity 3: Refining the Use Case Diagram
r a cle ent G 19
Solutions to Lab 4: Creating Use Case Scenarios and Forms
a @o Stud 25
Activity 1: Examining Use Case Scenarios
e r m this 25
Activity 2: Creating Use Case Forms
h ฺ vฺv use 28
Activity 3: Writing Glossary of Terms
i t e s t o 31
Solutions to Lab 5: Creating Activity Diagrams (h ens e 32
a lic
Actrivity1: Identifying Activity Diagram Symbols
Activity 2: Creating an Activity Diagram Verm 32
33
h
Solutions to Lab 6: Determing the Key Abstractions
Activity 1: Finding Candidate Key Abstractions H ites 36
36
Activity 2: Finding Key Abstractions Using CRC 38
Solutions to Lab 7: Constructing the Domain Problem 40
Activity 1: Identifying Class Diagram Elements 40
Activity 2: Domain Model Class Diagram 41
Activity 3: Identifying Object Diagram Symbols 42
Activity 4: Validating a Class Diagram 43
Solutions to Lab 8: Transitioning from Analysis to Design Using Interaction Diagrams 46
Activity 1: Identifying Communication Diagram Elements 46
Activity 2: Creating a Communication Diagram 47
Activity 3: Identifying Sequence Diagram Elements 48
Activity 4: Creating a Sequence Diagram 49
Solutions to Lab 9: Modeling Object State Using State Machine Diagrams 51
Activity 1: Identifying State Machine Diagram Elements 51
Activity 2: Creating a State Diagram 52
Solutions to Lab 10: Applying Design Patterns to the Design Model 53
Activity 1: Applying CRP 53

Page 1 of 83
Activity 2: Applying the Strategy Pattern 54
Activity 3: Applying the Observer Pattern 55
Activity 4: Applying the State Pattern 56
Solutions to Lab 11: Introducing Architectural Concepts and Diagrams 57
Activity 1: Identifying Tiers, Layers, and Systemic Qualities 57
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 2: Exploring Component Diagrams 59


Activity 3: Understanding Deployment Diagrams 61
Activity 4: Creating a High-Level Deployment Diagram 63
Solutions to Lab 12: Introducing the Architectural Tiers 64
Activity 1: Update and Extend a Tiers and Layers diagram 64
Activity 2: Create DAOFactory and DAO Classes 65
Solutions to Lab 13: Refining the Class Design Model 66
Activity 1: Refining Attributes ble 66
Activity 2: Refining Associations using Aggregation and Composition fe r a 67
Activity 3: Refining the Direction of Traversal ans 69
Activity 4: Refining Business Methods and Constructors n - t r 71
Activity 5: Checking your Class Diagram for High Cohesion and Low Coupling no 73
a
Activity 6: Creating Components with Interfaces
) has eฺ 75
Solutions to Lab 14: Overview of Software Development Processes
ฺ c om uid 76
Activity 1: Identifying Methodology Characteristics
Activity 2: Defining the Five Object-Oriented Methodologies r a cle ent G 76
78
Activity 3: Producing an Iteration Plan a @o Stud 79
Activity 4: Selecting Methodologies e r m this 80
Solutions to Lab 15: Overview of Frameworks
h ฺ vฺv use 81
Activity 1: Creating a Conceptual Framework
i t e s t o 81
Activity 2: Identifying Potential Frameworks (h ens e 82
a lic
Verm
h
H ites

Page 2 of 83
Activity 1: Using Abstraction
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

a) Used Car Lot Context b) Motor Racing Circuit


Game Context

Car Car
- actualSalePrice - currentSpeed
- make - maximumSpeed
ble
- model - positionOnTrack
fe r a
- purchasePrice
+ accelerate() ans
- requestedSalePrice
+ brake() n - t r
+ getProfit() n o
a
has eฺ
+ reducePrice()
+ sold() )
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
c) Vehicle Licensing
i t e s t o
(h ens
Registration Context e
rm a lic
V e Car
- s h
carbonDioxideEmissions
H ite
- make Note 1: These are just some possible
- model attributes and methods. You might have
- registrationPlate chosen other attributes and methods.
- status
- vehicleIDNumber Note 2: Some of these attributes can be
moved to another class. For example,
+ declareAsNotUsedOnPublicHighway() carbonDioxideEmissions, make, and model
+ registerAsScrapped() can be moved to a CarType class.
+ relicence()

Page 3 of 83
Activity 2: Using Inheritance

Account debit( amt : Money )


let balance equal balance minus amt
- accountNumber: String
- balance: Money credit( amt : Money )
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

let balance equal balance plus amt


+ credit(Money)
+ debit(Money)
getBalance()
+ getBalance() : Money
return balance

ble
fe r a
SavingsAccount CheckingAccount n
LoanAccount
a s
- overdraftLimit: Money
t r
- debited:n-boolean
+ debit(Money)
n o
+ debit(Money) +s a credit(Money)
) ha+ edebit(Money)

o m i d
l e ฺc t Gu
o rac udencredit( amt : Money )
a @ St
e r m this if amt plus returned value of

ฺ v ฺv use getBalance() is greater than zero


then reject credit operation
i t e sh to else call super class credit(amt)
( h s e
r m a licen debit( amt : Money )
e if debited is true
es hV then reject debit operation
H i t debit( amt : Money ) else call super class debit(amt)
if amt is greater than the amount set debited to true
returned by getBalance()
then reject debit operation
else call super class debit(amt)

TaxFreeSavingsAccount debit( amt : Money )


- unusedAnnualCreditLimit: int if amt is greater than the amount returned
by getBalance() plus overdraftLimit
+ credit(Money) then reject debit operation
else call super class debit(amt)

credit( amt : Money )


if amt is greater than unusedAnnualCreditLimit
then reject credit operation
else call the super class credit(amt) which if successful
then reduce unusedAnnualCreditLimit by the amt.

Page 4 of 83
Activity 3: Using Delegation and Cohesion
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Branch Bank
- banchCodeIdentifier: BranchCode 1..* - bankName: String

ble
fe r a
ans
Address
n - t r
-
-
building: String
City: String a no
- Street: String
) has eฺ
-
om uid Customer
ZipCode: String
ฺ c
r a cle ent G - name: String
0..*
a @o Stud
e r m this
Account
ฺ v se
vฺ1..*
- accountNumber: Strings h t o u
- balance: Moneyite
a (h ense
rm
+ credit(Money)
e lic
V
+ debit(Money)
+ hgetBalance() : Money
ite s
H

BusinessCustomer PersonalCustomer
- companyRegistrationNumber: String - taxReferenceNumber: TaxCode

Note 1:
This is just one possible solution.

Note 2:
The Address class would normally be a utility class shown as an attribute of type
Address in the Customer and Branch classes.

Page 5 of 83
Activity 4: Understanding the Benefits of Using Interfaces
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

This represents a collection of classes that


implement generic Trading behavior

«interface»
TradingService e
GenericTradingSoftware uses
+ buy() r a bl
s fe
+ sell()
- t r an
no n
a
PropertyTradingService
) has eฺ
+ buy()
ฺ c om uid
+ sell()
r a n tG
cle eStockMarketShareTradingService
a @o Stud + buy()
buy() and sell() e r m this + sell()
ฺv ฺ v e
These methods implement specific
s h t o us
PropertyTrading behaviorit e
a ( h
e n se
e rm lic
h V VehicleTradingService
buy() and sell()
i t es These methods implement specific
H + buy() StockMarketShare behavior
+ sell()

buy() and sell()


These methods implelement specific
VehicleTrading behavior

Page 6 of 83
Activity 5: Defining Object-Oriented Terminology

Activity 5: Defining Object-Oriented Terminology


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Match the object-oriented programming terms with their

✓ definitions.

Term Definition

polymorphism Identifying only those attributes and methods


ble
that are relevant to the class within the system.
fe r a
ans
object link The ability to derive new classes that acquire
n - t r
no
attributes and methods from a base class.
a
inheritance
as ฺ
The blueprint for an object.
) h
abstraction
om theuclass.
Hiding internal methods
c
access fromฺoutside
dedata from direct
iand
r a cle ebetween
n t G two objects (instances).
object
o tud
A relationship
@The
delegation
m a i s S of how much an entity (component
measure
r h
ฺ v ฺve use tor class) supports a singular purpose within a

i t e sh to system.

a (h ense
encapsulation The ability to determine the actual method called

e r m l i c based on the object’s subtype.

es h Vassociation An instance of a class.

H i t class Offloading some coherent responsibilities to


another component (one or more classes) or
method.
coupling A relationship between two classes.

cohesion The degree to which classes within our system


are dependent on each other.

Answers: abstraction, inheritance, class, encapsulation, object link, cohesion, polymorphism, object,
delegation, association, coupling

Examining Object-Oriented Concepts and Terminology 1-7


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 7 of 83
Activity 1: Defining Workflows

Activity 1: Defining Workflows


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Match each workflow with its description.


Term Definition

Requirements Model the high-level structure of the system,


ble
Gathering paying particular attention to the NFRs and
fe r a
mitigation of risk.
an s
- t r
Requirements on
Install the implementation into the production
n
Analysis environment.
s a
Architecture Build/Code the software a
) hcomponents
ฺ defined in
the Solution model. o m id e
e ฺ c G
l requirements u
Design Determine
r a cthe e n t of the system by
a @o theS
meeting
proposed
tud owner and users of the
business
system.
e r m this
Implementation
h ฺ vฺv usEnsure
e the implementation meets the
i t e s t o expectations defined in the requirements.
Testing
a (h ense Create a Solution model of the system that
e rm li c satisfies the functional requirements.
h V
e s Deployment Analyze, refine, and model the requirements of
Hit the system.

Answers: Architecture, Deployment, Implementation, Requirements Gathering, Testing, Design,


Requirements Analysis

2-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 8 of 83
Activity 2: Identifying Characteristics of the Requirements Gathering Workflow

Activity 2: Identifying Characteristics of the Requirements


Gathering Workflow
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the characteristics of the Requirements Gathering

✓ workflow mentioned during the lecture.

a. ___ This workflow includes meeting the business owner and


users of the proposed system to understand their
requirements.
bl e
b. ___ This workflow requires you to model the high-level system fe r a
structure to satisfy the non-functional requirements (NFRs).
a n s
n - trthe
c. ___ The purpose of this workflow is to determine
system must do. a nowhat
s
haclass
d. ___ You will create a business domain
m ) d ฺ
ediagram showing the
required business classesoduring
ฺc t Gu i
this workflow.
You will createa
l e
c UseeCase n diagrams during this
e. ___
workflow. o
r initial d
a @ Stu
e r m this
Answers: a, c, e.
h ฺ vฺv use

t
Answer b is wrong
i e sbecause titois a characteristic of the Architecture workflow.
● Answer d(h
a n se it is a characteristic of the Requirements Analysis workflow.
is wrong because
e
e rm lic
es hV
H i t

Introducing Modeling and the Software Development Process 2-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 9 of 83
Activity 3: Identifying Characteristics of the Requirements Analysis Workflow

Activity 3: Identifying Characteristics of the Requirements


Analysis Workflow
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the characteristics of the Requirements Analysis

✓ workflow mentioned during the lecture.

a. ___ This workflow includes recording Use Case scenarios.


b. ___ This workflow starts with analyzing and Use Case scenarios.
ble
c. ___ The purpose of this workflow is to model how the system
fe r a
will support the use cases.
a n s
d. ___ You will create a business domain class diagram showing n r
-t the
required business classes during this workflow. n o
s a
e. ___ You will create a detailed Deployment
) h adiagram
ฺ showing the
system architecture during this
ฺ c om uide
workflow.

r a cle ent G
Answers: b, d.
o tud
is @
Answer a is wrong because this activity a part of the S
Requirements Gathering workflow.

r m h i s
● Answer c is wrong because this
ฺ v ฺ veis the purpose
s e t of the Design workflow.

sh Deployment
Answer e is wrong because
t o u diagrams are created later in the process.
i t e
a (h ense
e rm lic
h V
ite s
H

2-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 10 of 83
Activity 4: Identifying Characteristics of the Architecture Workflow

Activity 4: Identifying Characteristics of the Architecture


Workflow
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the characteristics of the Architecture workflow

✓ mentioned during the lecture.

a. ___ You will create detailed Deployment diagram during this


workflow.
b. ___ The purpose of this workflow is to model the high-level ble
structure of the system to satisfy the NFRs. fe r a
ans
c. ___ You will create a tiers and layers diagram during this
n - t r
workflow.
a no
d. ___
a
The purpose of this workflow is to model
h s the high-level
) the dFRs.
structure of the system to satisfy
m eฺ
o
ฺc model i
u this workflow.
e. ___ e
You will refine the Design
l t G during

o rac uden
Answers: a, b, c.
a @ St
Answer d is wrong because e
m thithe
therfocus during
s Architecture workflow is on NFRs, not FRs.
vฺvthe Design

Answer e is wrong h ฺ
because u semodel is refined later in the process.

i t e s t o
(h ens e
rm a lic
e
es hV
H i t

Introducing Modeling and the Software Development Process 2-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 11 of 83
Activity 5: Identifying Characteristics of the Design Workflow

Activity 5: Identifying Characteristics of the Design


Workflow
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the characteristics of the Design workflow mentioned

✓ during the lecture.

a. ___ You will use an Activity diagram to verify Use Case


diagrams during this workflow.
b. ___ You will analyze the Use Case scenarios to determine ble
additional detail during this workflow. fe r a
ans
c. ___ You will create a Solution model during this workflow.
n - t r
d. ___ no
You might create a Statechart diagram during this workflow.
a
e. ___ The purpose of this workflow is to model
) h as how ฺ the system
will support the use cases.
ฺ c om uide
r a cle ent G
@theoRequirements
tud Analysis workflow.
Answers: c, d, e.
● a
Answer a is wrong because it is done during S
m duringththeisRequirements Analysis workflow.
e r
vฺv use
● Answer b is wrong because this is done

s h ฺ
i t e e t o
a (h ens
e rm lic
h V
ite s
H

2-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 12 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 6: Exploring the Benefits of Modeling

Front View Plan/Top View Side View


ble
fe r a
ans
n - t r
no
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
h
(may ns e
m a
Note: There
r l i c
be ealternative solutions.

h Ve
es
Hit

Page 13 of 83
Activity 7: Identifying the Benefits of Modeling Software

Activity 7: Identifying the Benefits of Modeling Software


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the benefits of modeling software mentioned during

✓ the lecture.

a. ___ Models give you only a starting point for a new system.
b. ___ Models help you only to understand what you have
developed.
c. ___ Models help you visualize new or existing systems. ble
fe r a
d. ___ Models are a concrete realization of a system.
a n s
e. ___ Models help you communicate decisions to project n -t r
n o
stakeholders.
a
) has eฺ
Answers: c, e.
ฺ c om uid

prototype might). r a c e enpartt ofGthe system (such as a
Answer a is wrong because models are not intended tolbecome

@
Answer b is wrong because models are meant
oto help youtuunderstand
d what you will develop (not what

a s S
erm thinot concrete.
has already been developed).
ฺ v
Answer d is wrong because models
ฺv e
are abstract,
us

e s h t o
( h it se
a e n
e rm lic
h V
e s
Hit

2-8 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 14 of 83
Activity 8: Identifying Diagram Types

Activity 8: Identifying Diagram Types


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Match the UML diagram with its description of the diagram

✓ type.

Diagram Name Definition

Use Case Represents changes in state or value along with state


ble
duration constraints
fe r a
ans
Class Represents a flow of tasks that might be performed by
n - t r
no
either a system or an actor
a
haorsmore
Object Represents a collection of components, and shows how
these are distributed across)one ฺ hardware nodes
m e
id of detailed object
o with fragments
Communication Represents a flow ofฺc
task u
interactions acl e n t G
r e
Sequence
a @o a collection
Represents S tud of objects that work together to
e r m tsome
support
h is system behavior
Activity h ฺ vฺv Represents
u se the internal structure of a class in terms of
i t e s t o parts
(h ens e
r m a
State Machine
l i c Represents a conceptual view of a collection of other
V e modeling elements and diagrams

es h
H i t Component Represents a collection of physical software components
and their interrelationships
Deployment Represents the set of states that an object might experience
along with triggers that transition the object from one
state to another
Package Represents a time-oriented perspective of an object
communication
Interaction Represents a runtime snapshot of software objects and
Overview their interrelationships
Timing Represents extensions to standard diagrams
Composite Structure Represents the set of high-level behaviors that the system
must perform for a given actor

Introducing Modeling and the Software Development Process 2-9


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 15 of 83
Activity 8: Identifying Diagram Types

Diagram Name Definition

Profile Represents a collection of software classes and their


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

interrelationships

Answers: Timing, Activity, Deployment, Interaction Overview, Communication, Composite Structure, Package,
Component, State Machine, Sequence, Object, Profile, Use Case, Class

ble
fe r a
ans
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

2-10 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 16 of 83
Activity 1: Identifying Use Case Symbols

Activity 1: Identifying Use Case Symbols


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Write the name of each Use Case diagram symbol in the

✓ space allotted next to each symbol.

Symbol Symbol Name

Human actor node


ble
 fe r a
ans
 

n - t r
System actor node o

 
a n
) has eฺ
ฺ c om uid
r a t Gnode
cleTimeenactor
a @o Stud
e r m this
ฺ v se
vฺGetEmployeeInfo
s h t o u Use case node
i t e
a (h ense
erm lic
h V 
 

ites
  
 
 Annotation
H  

Association

3-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 17 of 83
Activity 2: Creating a Use Case Diagram
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hotel: Initial Use Cases


«actor,device»
Travel Agent
System Generate
Nightly Status Nightly
Report Report
Manage
Promotions ble
fe r a
ans
n - t r
Online Booker
Retrieve
Reservation a noMarketing
Statistics
) has eฺ
Manage ฺ c om uid «actor,system»
Reservation
r a cle ent G Electronic Payment
System
@ o tud
Booking Agent
r m a is S
ฺ v e e th
v
ฺ In us
hCheck
i t e s t o
(h ens e
Customer
«actor,system»
rm a li c Telephone System
V e
h
Receptionist
H it s
e Check Out

Add Charge to
Customer's Bill Daily
Waiter Generate
Invoices «actor,system»
Email System

Page 18 of 83
Activity 3: Refining the Use Case Diagram
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hotel: Finance
ble
fe r a
ans
n - t r
Adjust
no
Customer's a
Bill
) has eฺ
ฺ c om uid
r a cle ent G
Night Auditor a @o Discrepancy
S tud
Generate

e r m this Report
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Page 19 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hotel: Front Desk

Register
Adjust
Customer
Customer's
Loyalty Card
Bill

bl e
fe r a
a n s
Check In condition: card payment
n r
-t required
extension points:
n oPayment Guarantee
Receptionist extension points: a
Payment Guarantee
) has eฺ
ฺ c om uid
cle «extend»
n t G
«include» o r a d e «actor,system»
a @ S t u Electronic Payment

e
Changerm thi s System

ฺ v
Roomฺ v s
Phone e Perform

s h Status t o u Payment Card


«actor,system»
it e Transaction
Telephone
a ( h
e n se
System
e rm lic «include» «extend»

h V condition: card payment required


ite s extension points: Payment
H Check Out
extension points: condition: cash payment required
Loyalty Points extension points: Payment
Payment
«extend» Perform
«actor,system» Payment Cash
Loyalty Points Transaction
System «extend»

Add Loyalty condition: Loyalty Card


Points Registered
extension points: Loyalty Points

Page 20 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

ble
Hotel: Housekeeping fe r a
ans
n - t r
no
a
Request ) haofs eฺ
List

ฺ c omRooms
Vacated
u id
e
cl ent G
Housekeeper r a
a @o Stud
e r m this Mark Room as
h ฺ vฺv use Ready for Use
s
ite se t o
( h
a licen
e r m
h V
H ites

Page 21 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

ble
Hotel: Marketing fe r a
ans
n - t r
Create
Promotion a no
) has eฺ
Modify om id
e ฺ c G u
r a cl ent
Promotion

@ o tud
m a i
Retrieve s S
r h
ฺ v ฺve uReservation
s et
Marketing
i t e sh to Statistics

a (h ense
e rm lic
es hV Publish Special «actor,system»

H i t Promotion to Email System


Customers

Page 22 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hotel: Reservation Services

ble
fe r a
an s
n - t r
a no
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o «actor,syste...
( h n s e Notify Guest of Text System
r m a lice Today's
Ve Reservation
h
H ites Morning
Reservation
Notification

Note: We have omitted the other


Reservation use cases that were
shown in the course examples.

Page 23 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Marketing Actors
+ Booking Agent e
+ Create Promotion
+ Manage Promotions + Daily
r a bl
+ Modify Promotion + Electronic Payment System
s fe
+ Publish Special Promotion to Customers + Email System
- t r an
+ Retrieve Reservation Statistics + Housekeeper
no n
+ Loyalty Points System
a
has eฺ
+ Marketing
)
+ Morning Reservation Notification
Front Desk ฺ c om uid
+ Night Auditor

+ PostCheckIn r a cle ent G


+ Nightly Report
+ Online Booker
+ Add Loyalty Points @ o tud + Receptionist
+ Change Room Phone Status m a i s S + Telephone System
r h
+ Check In
+ Check Out ฺ v ฺve use t + Text System
+ Travel Agent System
e
+ Perform Payment tCard
i shTransaction
t o + Waiter
(h Cash
+ Perform Payment s e
nTransaction
rm
+ Register a
Customer
li c e
Loyalty Card
V e
e s h Housekeeping

H it + Mark Room as Ready for Use


Finance + Request List of Vacated Rooms

+ Adjust Customer's Bill


+ Generate Discrepancy Report
Reservation Services
+ Notify Guest of Today's Reservation

Page 24 of 83
Activity 1: Examining Use Case Scenarios

Abstract of Scenarios for the Check In Use Case

The following are some sample scenarios. However, the lab activity required you to only
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

provide summaries.

Primary Scenario 1
The customer arrives at the hotel and is greeted by the receptionist. The customer informs the
receptionist that they have a reservation. The receptionist asks for either the reservation
number or customer name. The customer provides the reservation number. The receptionist
selects the check-in form from the menu. The receptionist enters the reservation number. The
system finds the requested reservation. The system displays the customer name, room IDs
ble
and room types that were reserved, dates of stay, and the price. The receptionist confirms the
fe r a
details with the customer. The receptionist accepts that the rooms are correct. Payment
ans
t r
guarantee is required for further room charges. Customer provides payment guarantee. The
n -
no
system marks the reservation as Checked-In. The system marks all rooms reserved as being
a
occupied. The system creates the room keys. The system enables the telephone in all the
has eฺ
reserved rooms. The system creates the bill. The system adds the quoted charge for the
)
ฺ c om uid
rooms to the bill as a chargeable item of quoted room charge type. The system marks the bill

r a cle ent G
as allowing additional charges.

Primary Scenario 2 a @o Stud


The customer arrives at the hotel e r
and mis greeted
t h isby the receptionist. The customer informs the
vฺv useThe receptionist asks for either the reservation
receptionist that they have aฺreservation.
h
number or customer name.
i t e s The customer
t o provides the reservation number. The receptionist
selects the check-in( hform fromn s e
the menu. The receptionist enters the reservation number. The
system finds
a
rmthe requested c e
li reservation. The system displays the customer name, room IDs
and roomV etypes that were reserved, dates of stay, and the price. The receptionist confirms the
i t esh with the customer. The receptionist accepts that the rooms are correct. Payment
details
H guarantee is required for further room charges. Customer does not provide payment
guarantee. The system marks the reservation as Checked-In. The system marks all rooms
reserved as being occupied. The system creates the room keys. The system enables the
telephone in all the reserved rooms. The system creates the bill. The system adds the quoted
charge for the rooms to the bill as a chargeable item of quoted room charge type. The system
marks the bill as not allowing additional charges.

Note: In the above scenario and in all of the remaining scenarios, the text in blue indicates the
difference in the particular scenario with respect to Primary Scenario 1.

Primary Scenario 3
The customer arrives at the hotel and is greeted by the receptionist. The customer informs the
receptionist that they have a reservation. The receptionist asks for either the reservation
number or customer name. The customer provides the reservation number. The receptionist
selects the check-in form from the menu. The receptionist enters the reservation number. The
system finds the requested reservation. The system displays the customer name, room IDs
and room types that were reserved, dates of stay, and the price. The receptionist confirms the
details with the customer. The receptionist accepts that the rooms are correct. No further
payment guarantee is required for further room charges. The system marks the reservation as

Page 25 of 83
Checked-In. The system marks all rooms reserved as being occupied. The system creates the
room keys. The system enables the telephone in all the reserved rooms. The system creates
the bill. The system adds the quoted charge for the rooms to the bill as a chargeable item of
quoted room charge type. The system marks the bill as allowing additional charges.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Primary Scenario 4
The customer arrives at the hotel and is greeted by the receptionist. The customer informs the
receptionist that they have a reservation. The receptionist asks for either the reservation
number or customer name. The customer provides the name. The receptionist selects the
check-in form from the menu. The receptionist enters the customer’s name. The system finds
only one matching reservation. The system displays the customer name, room IDs and room
types that were reserved, dates of stay, and the price. The receptionist confirms the details ble
with the customer. The receptionist accepts that the rooms are correct. Payment guarantee is
fe r a
an
required for further room charges. Customer provides payment guarantee. The system markss
- t r
the reservation as Checked-In. The system marks all rooms reserved as being occupied. The
n
no
system creates the room keys. The system enables the telephone in all the reserved rooms.
a
) has eฺ
The system creates the bill. The system adds the quoted charge for the rooms to the bill as a
chargeable item of quoted room charge type. The system marks the bill as allowing additional
charges. ฺ c om uid
r a cle ent G
Primary Scenario 5
The customer arrives at the hotel andm
@o Sthe
isagreetedsby
tudreceptionist. The customer informs the
receptionist that they have a reservation.
i
er eThethreceptionist asks for either the reservation
ฺ ฺ v
v customers
number or customer name.hThe
s t o u provides the name. The receptionist selects the
e
three matching a (hit menu.
check-in form from the
reservations.e n sThe
e receptionist enters the customer’s name. The system finds
The system displays a summary of each reservation. The
customere r m l i c
The h V confirms
system
which reservation is theirs. The receptionist selects the valid reservation.
displays the customer name, room IDs and room types that were reserved, dates
i t esstay, and the price. The receptionist confirms the details with the customer. The receptionist
of
H accepts that the rooms are correct. Payment guarantee is required for further room charges.
Customer provides payment guarantee. The system marks the reservation as Checked-In.
The system marks all rooms reserved as being occupied. The system creates the room keys.
The system enables the telephone in all the reserved rooms. The system creates the bill. The
system adds the quoted charge for the rooms to the bill as a chargeable item of quoted room
charge type. The system marks the bill as allowing additional charges.

Secondary Scenario 1
The customer arrives at the hotel and is greeted by the receptionist. The customer informs the
receptionist that they have a reservation. The receptionist asks for either the reservation
number or customer name. The customer provides the reservation number. The receptionist
selects the check-in form from the menu. The receptionist enters the reservation number. The
system finds the requested reservation. The system displays the customer name, room IDs
and room types that were reserved, dates of stay, and the price. The receptionist confirms the
details with the customer. The receptionist rejects that the rooms are correct. The receptionist
restarts the check-in process.

Page 26 of 83
Secondary Scenario 2
The customer arrives at the hotel and is greeted by the receptionist. The customer informs the
receptionist that they have a reservation. The receptionist asks for either the reservation
number or customer name. The customer provides the name. The receptionist selects the
check-in form from the menu. The receptionist enters the customer’s name. The system finds
three matching reservations. The system displays a summary of each reservation. The
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

customer confirms which reservation is theirs. The receptionist cannot find a valid reservation.
The receptionist restarts the check-in process.

ble
fe r a
ans
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Page 27 of 83
Activity 2: Creating Use Case Forms

Use Case Form


Use Case Name Check In
Description The Customer arrives at the hotel and provides information to find
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

an existing reservation. The customer is given the option to upgrade


or change rooms. A further payment guarantee may be required.
Upon successful check-in, an electronic room key is cut, the room
phone is enabled, the new bill is created, and the quoted price is
charged to the customer’s bill.
Actors Primary: Receptionist
Secondary: None
ble
Note: Primary actors are proxies for the Customer
fe r a
Priority Must have ans
Note: Essential to this system n - t r
n o
a
Risk Medium
) h as ฺ
Pre-conditions At least one room exists in the hotel m
& Assumptions Primary Actor can be identified ฺco u ide
r a cle ent G
Extension Rooms Upgrade o ud
Points Change Assigned a Rooms St
@
e r m this
Payment guarantee
h ฺ vฺv use
Extends
i t e s
None
t o
Trigger a (h AeCustomer
e
ns wishes to check into the hotel using an existing
erm c
li reservation.
V
eshMain Flow of 1: Use Case starts when Customer requests to check into the hotel
Hit Events 2: Receptionist enters reservation number [A1]
2.1: System searches for matching reservation [A2] [A3]
2.2: System notifies Receptionist of the reservation details
2.3: Extension Point( Change Assigned Rooms ) [A7]
2.4: Receptionist accepts that rooms are correct [A5]
3: Extension Point( Payment Guarantee )
3.1: System marks reservation status as being checked-in
3.2: System applies BR21 and marks assigned rooms as being
occupied
3.3: Include ( Create Electronic Keys)
3.4: Include ( Change Room Telephone Status ) [A8]
3.5: System creates bill for reservation
3.6: System applies BR22 to add quoted charge for the rooms to the
bill as a chargeable item of quoted room charge type
3.7: System marks bill as allowing additional chargeable items [A6]
4: System indicates that check-in is complete
Alternate Flow A1: Receptionist enters customer name, go to step 2.1
of Events (A) A2: No matching reservation found, notify Receptionist, go to step 2
A3: System finds more than one matching reservation, systems
displays summary of each reservation found. Receptionist selects

Page 28 of 83
the valid reservation, go to step 2.2 [A4]
A4: Receptionist enters that none of the reservations were valid, go
to step 2
A5: Receptionist doesn’t accept that rooms are correct, go to step
2.3
A6: No payment guarantee for additional charges, marks bill as not
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

allowing additional chargeable items, go to step 4.


A7: Rooms changed, go to 2.2
A8: No Payment Guarantee for additional charges, do not change
phone status to enabled, go to step 3.5
Steps 1 through 2.4: Actor may cancel the use case, use case ends
Post-conditions Reserved rooms are marked as being occupied
Reservation is marked as being check-in
Bill is marked with payment status ble
The initial room charge is added to the bill fe r a
a n s
Business Rules BR21: Reserved rooms must be marked as being occupied
n r
-tat
(BR) check-in o
n bill on check-
BR22: Quoted price for the stay must be added a
to the
in ) has eฺ
Non-Functional NFR32 (Simultaneous Users) eฺc
om uid
Requirements NFR33 (Duration of Use Case)
r a cl ent G
@o Stud
NFR6 (System Availability)
a
Notes e
Upgrade roomsr s
m can tbehiaccomplished using change rooms
v ฺ v e
e s hฺ to us
( h it se
a e n
e rm lic
h V
e s
Hit

Page 29 of 83
Abstract of Supplementary Specification Document

NFR32: The System must support 6 simultaneous check-in operations per property.
NFR33: The Check In use case must take no longer than 5 minutes to complete.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

NFR6: The System must be available “7 by 24 by 356”. However, the applications


can be shut down for maintenance once a week for one hour. This maintenance
activity should be scheduled between 3 a.m. and 6 a.m.

ble
fe r a
ans
n - t r
n o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Page 30 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 3: Writing Glossary of Terms

Abstract of Glossary of Terms e


r a bl
s fe
Term Definition
- t r an
Reservation Number A unique numeric identifier assigned to a reservation. n
no
a
Reservation Status Marks the status of a reservation. The statussincludes New, Held,
Confirmed, Checked-In, and Checked-Out. ) ha eฺ
Bill Contains a list of chargeable itemsฺ c omadded u
d
toi the reservation's bill.
e
clof chargeable
n G
t item.
Chargeable Item The amount, date, and r a
type
o tud e
Chargeable Item The type of chargea @made Sthe bill—for example, beverage, food,
to
r m h i s
Type
ฺ e use t
room, orvnewspaper.
ฺ v
Quote Room Charge The
i t e shamount t o quoted for the chosen room types for the duration of the

a (h stay.e n se
rm
Room Status
e licRecords the status of a room—for example, occupied, available, or
h V unserviceable.
ite s
H

Page 31 of 83
Actrivity1: Identifying Activity Diagram Symbols

Actrivity1: Identifying Activity Diagram Symbols


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Write the name of each Activity diagram symbol in the

✓ space allotted next to each symbol, in the following table.

Symbol Symbol Name

ble
Design Product Activity or Action fe r a
ans
n - t r
n o
a
has eฺ
Decision or Merge
)
ฺ c om uid
cle Activity
n t G
r a
o tude Inititial
@
a is S
r m
e e th
v ฺ v
e s hฺ to us Activity Final
i t
(h ens e
a lic
Verm
h
H ites Fork

Activity Flow

Join

5-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 32 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 2: Creating an Activity Diagram

ble
fe r a
CheckIn
ans
Start
n - t r
Pre CheckIn Restart
a no
) has eฺ
Pre CheckIn
ฺ c om Cancel
u id Pre CheckIn
Activities e
cl ent G Activity
r a
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
( h n s
Post
e CheckIn
Notify

r m a lice Activiities Receptionist


Restart the
to

Ve CheckIn
h
H ites

ActivityFinal

Page 33 of 83
Receptionist System

Post
CheckIn
Start
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Change
Reservation
Status to
Checked-In
Change Status
ble
of Reserved
fe r a
Rooms to
a n s
Occupied
Includen -t r
(Create
o
n Room
Electronic
a
s Keys)
h a
Include (Change ) e ฺ
o m i d
l e ฺc t Gu
Room Telehpone

rac uden
Status)
o
@ St
r a
m this
e
h ฺ vฺv use Create Bill for Add Quoted
s
ite se t o Reservation Charge to Bill
( h
a licen
e r m
h V
H ites [Payment Guarantee for Additional
Chargeable Items]

[No Payment Guarantee for Additional


Chargeable Items]

Notify Change Bill


Receptionist the Status to
Check-In is Chargeable
Complete

Post
CheckIn End

Page 34 of 83
Receptionist System

Pre
[No matches]
CheckIn
Start
Notify
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Receptionist that
[Request no Matching
Reservation Number Reservation
Search] Found
[Req. Name Search]

Enter Search for


Reservation Matching
Enter Number Reservation
ble
Customer r
[One Matching]
fe a
Name
ans
[No Valid Reservation Selected]
[More than One Matching]
n - t r
Select Matching a no
Notify Receptionsist of
Reservation has eฺ
Summary of Matching
)
ฺ c om uid
Reservations

r a cle ent G Notify


@ So t u d Receptionist of
[Valid Reservation
r m aSelected]
i s Reservation
ฺ v e e th[Rooms Changed] Details
h ฺ v u s
i t e s t o
(h ens e
a lic[Rooms not Changed]
V erm
h
H ites Respond Extension Point
(Change Assigned
Rooms)
[Rooms Not Accepted]

[Rooms Accepted]

Extension Point
(Payment Guarantee)
End of Pre
CheckIn

Page 35 of 83
Activity 1: Finding Candidate Key Abstractions

Candidate Classes Form

Candidate Candidate Class/Object Eliminated Selected Class Name


Class/Object for the Following Reason
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Customer (actor)

Hotel

Reservation

Room e
r a bl
Payment Guarantee s fe
- t r an
Room Key
n on
a
Room Phone
) has eฺ
c o m uid

Bill
r a cle ent G
Chargeable Item
a @o Stud
e r m this
Receptionist
h ฺ vฺv use
i t e s t o
System (h ens e
rm a lic
Rooms
V e Upgrade
e s h
Hit Assigned Rooms

Reservation Number

Customer Name

Room Id

Room Type

Dates of Stay

Price

Checked-In Status

Room Occupied Status

Quoted Charge

Page 36 of 83
Additional Chargeable
Items Allowed Status
Initial Room Charge
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Chargeable Item Type

Customer

Basic Rate

Promotion
ble
fe r a
ans
n - t r
no
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Page 37 of 83
Activity 2: Finding Key Abstractions Using CRC

Candidate Classes Form

Candidate Candidate Class/Object Eliminated Selected Class Name


Class/Object for the Following Reason
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Customer (actor) Actor

Hotel Property

Reservation Reservation

Room Room
ble
Payment Guarantee PaymentGuarantee fe r a
ans
Room Key External n - t r
a no
Room Phone External
) has eฺ
Bill ฺ c om uiBill
d
e
cl ent G
r a
Chargeable Item
a @o Stud ChargeableItem

erm e thi s
Receptionist ฺ v
Actor
ฺv
s h t o us
System h it e e system
The
(
a lice n s
Roomse r m
Upgrade Reassignment of rooms
V
esh
Hit Assigned Rooms Assignment of Room

Reservation Number Attribute of Reservation

Customer Name Attribute of Customer

Room Id Attribute of Room

Room Type RoomType

Dates of Stay Synonym for Arrival Date and


Departure Date
Price Synonym for Quoted Price

Checked-In Status Attribute of Reservation

Room Occupied Status Attribute of Room

Quoted Charge Attribute of Reservation

Page 38 of 83
Additional Chargeable Attribute of Bill
Items Allowed Status
Initial Room Charge Synonym for Chargeable Item

Chargeable Item Type ChargeableItemType


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Customer Customer

Basic Rate Attribute of Room Type

Promotion Promotion

ble
fe r a
ans
n - t r
no
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm
h
H ites

Page 39 of 83
Activity 1: Identifying Class Diagram Elements

Activity 1: Identifying Class Diagram Elements


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Write the name of each Class diagram symbol in the space

✓ allotted next to each symbol.

Symbol Symbol Name

Account Class node


ble
fe r a
Account ans
firstName:String
n - t r
Class node with members
no
lastName:String
Amount:BigDecimal
a
has eฺ
getAmount()
setFirstName()

)
ฺ c om u id label
Mulitiplicity
1..*
e
cl ent G
r a
a @o Stud
e r m this
employs
Unidirectional association
ฺv ฺ v e
s h t o us
h e
it ClassAse ClassB
(
a lice n
e r m Association class
h V
H ites ClassX

7-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 40 of 83
Activity 2: Domain Model Class Diagram
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Reservation Customer
Bill arrival date made for address
has departure date first name
allowAddCharges 1 1 quoted price 1..* 1
last name
reservation number phone number
1 status
1 1..* e
assigned
r a bl
0..*
guaranteed by
allocated to n s fe
RoomType
a
-trdescription
ChargeableItem
n on
has
1
amount s a0..* 1
date
PaymentGuarantee a
) h deฺ
1..*
amount
c m
o Roomui located at
e ฺ G
0..*
r a cl room e n t id
Property

describes @ o tudstatus 1..* 1 address


r m a is S name
1
ฺve use t h 1..* 1..*
ฺ v
ChargeableItemType
i t e sh to
description
a (h ense CardPaymentGuarantee seasonally adjust

e rm li c card number
price for a

h V
e s
Hit adjusts price for a

PurchaseOrderGuarantee
po number
0..*
0..*
1..* SeasonalPriceAdjustment
provides
1 Promotion
description
end date description
Company
percentage discount offer end date
address start date offer start date
company name voucher code
telephone number calculateDiscount(Reservation)

Page 41 of 83
Activity 3: Identifying Object Diagram Symbols

Activity 3: Identifying Object Diagram Symbols


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Write the name of each Object diagram symbol in the space

✓ next to each symbol.

Symbol Symbol Name

Bryan:Account Named object node


ble
fe r a
ans
n - t r
:Account
a no Unnamed object node

) has eฺ
:Account c m uid
oObject
ฺ t Gnode
r a cle eattribute
firstName:Bryan
n
lastName:Smith
with
values
@o Stud
Amount:10.29

r a
m this
e
h ฺ vฺv use
i t e s t o
(h Self-Check e
ns – Select the statement or statements about UML Object
a c e
V✓erm i
ldiagrams that are TRUE.

es h
H i t a. ___ Object diagrams can be validated using Class
diagrams.
b. ___ Object diagrams show runtime links.
c. ___ Object symbols can have three
compartments: name, attribute, and an
operations compartment.
d. ___ Object diagrams often show object state.
e. ___ An Object diagram is an instance of a class
diagram.

Answers: b, d, e.

Constructing the Problem Domain Model 7-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 42 of 83
Activity 4: Validating a Class Diagram
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Assume that the date is


December 23, 2009 and John
Smith has not checked in yet.
ble
fe r a
ans
n - t r
:CardPaymentGuarantee :Customer no
:Room
a
amount = 800
card number = 5004123456789
first name = John
last name = Smith h a sroom id = 319

m ) deฺ = available
status

ฺ c o u i
e
cl ent G
r a
:Reservation a
@o Stud :RoomType
e r m= 1346901
t h is :Property

arrival h ฺ
datev=v12/23/2009
reservation ฺnumber
u se description = double room

i t e s dateto= 12/27/2009
departure
a se
(hstatuse=nconfirmed
lic price = 800
erm quoted
h V
ites
:Room
H room id = 302
status = available

Page 43 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Assume that the date is December 23, 2009 and John Smith has checked in.
He has extended his payment guarantee amount to cover additional charges.

:CardPaymentGuarantee :Customer :Room


amount = 1400 first name = John room id = 319 ble
card number = 5004123456789 last name = Smith status = occupied
fe r a
ans
n - t r
a no
:Reservation has eฺ
:RoomType
) :Property
reservation number = 1346901
arrival date = 12/23/2009 ฺ c om u=iddouble room
description

departure date = 12/27/2009 acl


e nt G
status = checked-in r
o tude
quoted price = 800 a @ S
r m h i s
ฺ v ฺve use t :Room
e s h t o room id = 302
i t
(h ens e status = occupied
a lic
V erm
h
ites
:Bill
H allowAddCharges = true

:ChargeableItem
:ChargeableItemType
date = 12/23/2009
amount = 800 description = Quoted Room Charge

Note: During this modeling review with the client, you might discover that a
reservation can have a second payment guarantee. In that case, the Domain class
diagram as well as the Use Case forms will need to be modified.

Page 44 of 83
This is not part of the lab, but may be of interest. Assume date is 24 Dec 2009, and John
Smith and his party have a meal in the restaurant and purchase beverages twice.
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

:CardPaymentGuarantee :Customer :Room


amount = 1400 first name = John room id = 319
card number = 5004123456789 last name = Smith status = occupied

ble
fe r a
a n s
:Reservation :RoomType
n-t r :Property
reservation number = 1346901
arrival date = 12/23/2009 no
description = double room
a
departure date = 12/27/2009
status = checked-in ) has eฺ
quoted price = 800 ฺ c om uid
r a cle ent G :Room
o t u d
r m a@ is S room id = 302

ฺ v e e th status = occupied

s h ฺv us
i t e t o :Bill

a (h ense allowAddCharges = true


:ChargeableItemType
e r m l i c description = Meal
h V
ite s :ChargeableItem :ChargeableItem
H date = 12/24/2009 date = 12/24/2009 :ChargeableItem
amount = 29 amount = 34 amount = 94
date = 12/24/2009

:ChargeableItem :ChargeableItemType
date = 12/23/2009 description = Quoted Room Charge
amount = 800

:ChargeableItemType
description = Beverages

Page 45 of 83
Activity 1: Identifying Collaboration Diagram Elements

Activity 1: Identifying Collaboration Diagram Elements


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Write the name of each Collaboration diagram symbol in the

✓ space next to each symbol.

Symbol Symbol Name

ble
fe r a
ans
:Account Object node
n - t r
n o
a
) has eฺ
om uid
2.1: getAccountInfo()
Message link
ฺ c
r a cle ent G
o Createtuobject
<<create>>

@ d message
r m a is S
ฺ v e e th
v
hฺ:MainUIto us
i t e s Boundary component
(h ens e
a lic
Verm
h
H ites :AccountSvc Service component

Bill:Customer Entity component

8-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 46 of 83
Activity 2: Creating a Communication Diagram
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

2.1: frag Payment Guarantee


1.4: frag ChangeAssignedRooms
1.2: frag getResDetails
2: accept rooms

2.3: reservation complete


1: enter(resNum)
ble
1.3: resDetails
fe r a
ans
Receptionist :CheckInUI
n - t r
1.1: findReservation(resNum) a no
2.2.9: [Payment Guarantee for Additonal Items]:frag ICRPS
s
haCreateRoomKey
2.2.4: frag Include
1.1.1: res
m ) d eฺ
o
ฺc t2.2.1: i
ucheckedIn
l e G
2.2: acceptCheckIn o rac uden 2.2.2: getRooms
2.2.11: complete a @ St
e r m this 2.2.2.1: roomList

h ฺ vฺv :ReservationService
u se
i t e s t o 2.2.6.1: price
res
2.2.7: <<create>>(price,type)
( h s e 2.2.6: getQuotedPrice

r m a licen :Reservation

h Ve
H ites 2.2.3: *occupied
2.2.5: <create>>
:ChargeableItem
2.2.10: [Payment Guarantee for Additional Item]:chargeAllowed

2.2.8: addChargeableItem

:Room
b :Bill

Key:
frag ICRPS : frag Include Change Room Phone Status

Page 47 of 83
Activity 3: Identifying Sequence Diagram Elements

Activity 3: Identifying Sequence Diagram Elements


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Write the name of each Sequence diagram symbol in the

✓ space next to each symbol.

Symbol Symbol Name

Actor node
ble
Customer fe r a
ans
n - t r
:Account n Object node o
a
) has eฺ
ฺ c om uid
r a cle ent G
a @o StudActivation bar
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
Verm Lifeline
h
H ites Return arrow

message()
Message arrow

8-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 48 of 83
Activity 4: Creating a Sequence Diagram
res :Room
:Reservation
Receptionist :CheckInUI :
enter(resNum) ReservationService

findReservation(resNum)
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

res

seq frag GetReservationDetails


resDetails

seq frag ChangeAssigned Rooms


accept rooms

ble
seq frag Payment Guarantee
fe r a
acceptCheckIn
ans
n - t r
checkedIn
a no
getRooms
) has eฺ
roomList
ฺ c om uid
loop a cle ent G
occupied
r
[foreach room in
o tud
@roomList]
m a i s S
r
ve Include t h
ฺ v ฺfrag s e
e s h to u
seq Create Room Keys

( h it se
a c e n <<create>> b :Bill
e r m l i
h V getQuotedPrice
H ites price

<<create>>(price,type) c
:ChargeableItem
addChargeableItem(c)

opt
[Payment Guarantee for Additional Items]
seq frag Include (Change Room Phone Status)

chargeAllowed

complete

reservation complete

Note 1: The Include (Change Room Phone Status) could have been an extend
stereotype due to its optional nature.
Note 2: The Include (Change Room Phone Status) was moved from being
earlier in the sequence so it could share the optional fragment.
Page 49 of 83
res cust :Room type :Room
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

:Reservation :Customer Type


:CheckInUI
getCustomer

cust
Get Reservation Details Fragment
getLastName

last name ble


fe r a
getRooms
ans
n - t r
roomList no
a
) has eฺ
ฺ c om uid
loop
[foreach room in roomlist] r a cle ent G
getRoomId @o tud
a
mid this S
e r
h ฺ vฺv use
room

i t e s getRoomType
t o
(h ens e
rm a lic type
e
es hV getDescription
H i t
description

getArrivalDate

arrival date
getDepartureDate

departure date
getQuotedPrice

price

Page 50 of 83
Activity 1: Identifying State Machine Diagram Elements

Activity 1: Identifying State Machine Diagram Elements


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Write the name of each State Machine diagram symbol in

✓ the space allotted next to each symbol.

Symbol Symbol Name

ble
AcctOverdrawn State node
fe r a
ans
n - t r
n o
AcctOverdrawn
s a
State node
entry / notifyCustomer
) h awith
internal
m events eฺ
entry / doNotAllowSpending

c o
exit / allowSpending
ฺ u id
e
cl ent G
r a
o tudStart state
@
a is S
r m
e e th Stop state
v ฺ v
e s hฺ to us Transition arrow
i t
(h ens e
a lic
Verm
h
H ites

9-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 51 of 83
Activity 2: Creating a State Diagram
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

when(balance < 0 &&


Account is balance >= overdraft)
open
Active when(balance >= 0)
Withdrawn
ble
fe r a
s

&&
an
wh ot

t)
/n

r
en if

r s) ft

af
if ba ana on erd &&
n -

ge th ra

dr
(b Ma

m v 0

er
al a

/n en ify 3 = o <
y
wh

ov
a
an ge

wh ot >= > nce


when(account is closed)

en

has eฺ
ce r

=
/n me nce la
(b

er <
<

ti la (ba
al

ag e
=
an

om uid

an nc
ba en
ov

M
ce

yM la
ฺ c wh
er

cle ent G
>=

dr

ot (
a
af

r
0)

@o Stud
) t

r a
m this
e
h ฺ vฺv use Frozen
s
ite se t o
( h
a licen
e r m
h V
ites
Account is
closed
H Closed

Page 52 of 83
Activity 1: Applying CRP

«interface» Vehicle «interface»


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Terrain moves on powered by PowerSource


- dimensions
1..* - type 1..*
- weight

ble
Air
fe r a
- airworthinessCertificate ans
- maxSpeed n - t r
n oNatural
a
) has eฺ
c o m uid

Water
r a cle ent G
@o Stud
- maxSpeed
- seaworthinessCertificate
r a
m this
ฺ v e e
Tide Wind

s h ฺv us
e t o
Land(hit se
a e n
r m l ic
- landVehicleInspectionCertificate
e
V
- maxSpeed
h
ite s NuclearFuel FossilFuel
H

Fission Fusion Kerosene Petrol Diesel

Note1: Terrain can be a class, in which case maxSpeed can be stored in the base class Terrain.
However, if the units of measurement are different, this might not be the best approach.
Note 2: You need subclasses of PowerSource only if each subclass has different attributes or
behaviour.

Page 53 of 83
Activity 2: Applying the Strategy Pattern
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Promotion
Hotel - end date
has
- start date
0..* - voucherCode
+ calculateDiscount(Reservation)
bl e
fe r a
ans
n - t r
a no
FreeNightWeekendOnlyOffer
) as ฺ
hPercentageDiscountOffer
+ calculateDiscount(Reservation)
ฺ c om u ide
- percentageDiscount

r a cle en+t G calculateDiscount(Reservation)

a @o Stud
e r m this
h ฺ vฺvFreeNightAnyTimeOffer
u se
i t e s- numberOfNightsFree
t o
e
(h e-nsnumberOfNightsToQualify
rm a lic + calculateDiscount(Reservation)
V e
e s h
Hit
Note 1: It may be possible to have FreeNightAnyTimeOffer and FreeNightWeekendOnlyOffer as the
same class or share a common FreeNightOffer class.
Note 2: CalculateDiscount is passed the Reservation object, so it can get any information it needs that
may affect whether the offer is valid for a reservation, for example the dates of the stay.
Note 3: Although the Promotion class has a voucher code, the default value could be that no voucher
is needed.

Page 54 of 83
Activity 3: Applying the Observer Pattern
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Observable «interface»
+ attach(Observer) Observer
+ detach(Observer) + update()
+ notify()

ble
fe r a
Room
ans
- roomId
n - t r
- status
a no
+ vacated()
) has eฺ
ฺ c om uid
a cle ent G
HandHeldDeviceNotification
r StatusDisplay
o
@ Stu
+ aupdate()
d + update()
vacated(): r m
e e th i s
v ฺ v
hฺ to us
status := vacated
call notify()
it e s
( h n s e update():

r m a lice Refresh all rooms currently on display

h Ve
H ites
update():
identify roomId
Send message that includes roomId to hand held device

Note 1:
It is possible to send an object as a parameter to the update method. This object can be the Room
object, in which case it will be easier to identify the room.

Note 2:
JavaTM uses different methods.

Page 55 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 4: Applying the State Pattern

Account AcctStatus
ble
Deposit()
Withdrawl()
Deposit()
fe r a
Transfer()
Withdrawl()
Transfer()
an s
n - t r
n o
a
AcctActive AcctOverdrawn
) has eฺ
AcctFrozen AcctClosed
Deposit()
om uid
Deposit() Deposit() Deposit()
Withdrawl()
ฺ c
Withdrawl() Withdrawl() Withdrawl()

cle ent G
Transfer() Transfer() Transfer() Transfer()

r a
@o Stud
withdrawl
amount up to
currentBalance a
m this
displayMessage()
r displayMessage()
e
withdrawl
vฺv use
+ overdraftLimit
amount up to

s h ฺ currentBalance

i t e t o
+ overdraftLimit
e
a (h ens
erm lic
h V
H ites

Page 56 of 83
Activity 1: Identifying Tiers, Layers, and Systemic Qualities

Activity 1: Identifying Tiers, Layers, and Systemic Qualities


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Match the layers with their definitions.

✓ Layer Definition
Application Provides the APIs that application
components implement
Virtual Platform Consists of the operating system
ble
Upper Platform Includes computing components such as fe r a
servers, storage, and network devices
ans
n - t r
Lower Platform
no
Provides a concrete implementation of
a
components to satisfy the functional
has eฺ
requirements
)
Hardware
c om
Consists of
ฺ productsid
u such as web and
Platform e
cl ent
containers and G
middleware
r a
a @oPlatform,
Answers: Virtual Platform, Lower Platform, Hardware S ud Upper Platform
tApplication,
e r m this
h ฺ vฺv use
i t e s – Match
Self-Check t o the tiers with their definitions.
e
✓erma (hTierlicens
h V Definition

H ites Client Provides services and entities


Presentation All back-end components, such as a Database
Management System (DBMS) or Enterprise
Information System (EIS)
Business Usually described as “thin”; often is a web
browser.
Integration Provides the Hyper Text Markup Language
(HTML) pages and forms sent to a web browser
and process the user’s requests
Resource Provides components that tie the business tier to
the resource tier

Answers: Business, Resource, Client, Presentation, Integration

11-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 57 of 83
Activity 1: Identifying Tiers, Layers, and Systemic Qualities

Self-Check – Match the systemic qualities with their definitions.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Systemic Quality Definition

Developmental Addresses the requisite qualities as the


system evolves
Manifest Addresses the qualities reflected in the
execution of the system
Evolutionary Addresses the requisite qualities in
production ble
fe r a
Operational Addresses the requisite qualities during
ans
system development
n - t r
n o
a
Answers: Evolutionary, Manifest, Operational, Developmental ) has eฺ
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
rm a lic
e
es hV
H i t

Introducing Architectural Concepts and Diagrams 11-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 58 of 83
Activity 2: Exploring Component Diagrams

Activity 2: Exploring Component Diagrams


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Write the name of each Component diagram symbol in the

✓ space next to each symbol.

Symbol Symbol Name

<<JAR>>

PayrollSystemJAR Component node


ble
fe r a
ans
n - t r
<<reside>>
a no
Dependency arrow

) has eฺ
c omiconuid
Interface

r a cle ent G
*o
a @ S tud
e r m this Executable file component
h ฺ vฺv use
i t e s t o
(h ens e *
a c
Verm li
DBMS component
h
ites
DBMS
H
DrawApp
*
Application component

11-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 59 of 83
Activity 2: Exploring Component Diagrams

Self-Check – Select the statement or statements about UML Component

✓ diagrams that are TRUE.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

a. ___ A component represents a software unit.


b. ___ There are descriptor and instance forms of
Component diagrams.
c. ___ Components cannot be abstract.
d. ___ Component diagrams show the organizations and
dependencies among components.
ble
fe r a
e. ___ You can create your own component icons to extend
ans
the UML.
n - t r
n o
a
has eฺ
Answers: a, d, and e

)
ฺ c om uid
r a cle ent G
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
rm a lic
e
es hV
H i t

Introducing Architectural Concepts and Diagrams 11-5


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 60 of 83
Activity 3: Understanding Deployment Diagrams

Activity 3: Understanding Deployment Diagrams


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Write the name of each Deployment diagram symbol in the

✓ space next to each symbol.

Symbol Symbol Name

Communication link
<<FTP>>
ble
fe r a
<<JAR>> ans
n - t r
Component node o
PayrollSystemJAR
a n
) has eฺ
ฺ c om uid
PC
cleHardware
n t G
r a
o tude node
@
a is S
r m
e e th
v ฺ v
e s hฺ to us
( h it s e Dependency arrow

r m a licen
Ve
h
H ites

11-6 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 61 of 83
Activity 3: Understanding Deployment Diagrams

Self-Check – Select the statement or statements about UML Deployment

✓ diagrams that are TRUE.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

a. ___ You can assign your own icons to represent


hardware in Deployment diagrams.
b. ___ There are descriptor and instance forms of
Deployment diagrams.
c. ___ Descriptor Deployment diagrams show a particular
deployment of a system.
ble
d. ___ The «deploy» stereotype can be used to document
fe r a
components within a node.
an s
- t r
e. ___ on
There is only a descriptor form of Deployment
n
diagrams.
s a
a
) h deฺ
Answers: a, b, and d
c o m u i
e ฺ G
r a cl ent
a @o Stud
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
rm a lic
e
es hV
H i t

Introducing Architectural Concepts and Diagrams 11-7


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 62 of 83
Activity 4: Creating a High-Level Deployment Diagram
Travel Agent System
Customer's Electronic Payment
Machine Machine
Travel
Agency
Browser Booking Electronic
Software Card Payment
Software
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

«http(s)» «tcp/ip/internet» «tcp/ip/internet»


«soap»
«tcp/ip/extranet»
Web Interface Machine «soap»

Web Server Email Client


ble
fe r a
a n s
r
-tMachine
External Loyalty
n Points
n o
Scheme
a
«tcp/ip/intranet» «rmi»
) has eฺ Loyalty Points
«rmi»
ฺ c om u id Admin Software
e
cl ent G
«tcp/ip/internet»
Hotel Staff Machines r a
o Servertud
a @
Application
S
Hotel e r m i
Machine
t h s «soap»
Interface
ฺ v ฺv use Database Server
Software
e s h to Hardware

( h it «rmi» se
a c e n «tcp/ip/intranet»
e r m l i Hotel «sql»
Database

h V «tcp/ip/intranet» Application

ite s Software
H
«wifi/IEEE 802.11»
«wifi/IEEE 802.11»
«soap»
«device» «soap»
Department Display Screens «tcp/ip/intranet» «soap»
«soap»
Display «device»
Software «soap» «soap»
Hand Held Device

Hotel Telephone Exchange


Micro Hotel
System
This is one possible Software
Call Monitor
architecture. The distribution Software
of software components and
the protocols between the
software components may
Room Phone
differ in your solution. Text
Control
Software Software

Page 63 of 83
Activity 1: Update and Extend a Tiers and Layers diagram
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Client Presentation Business Integration Resource

Hotel System Hotel System Hotel System


App Client UI
Web Components Business Services Entities
DB Schema
t h is
u se
e t o
e n s
c
JavaServerTM Faces bl e li
e r a
sf
components v2.0
EJB technology Java Persistence
VP HTML v4.0
TM
Java Servlet API v2.5
v3.0
tr a n
API
SQL/DDL
TM
JavaServer Pages
n -
technology v2.1
a no
a s
h eฺ
)
ฺ c om uid
c n t G
leSun GlassFish
a
r Enterprise
de Server v2
ORACLE® 11g
Java SE 6 @o
Any Tomcat 6.0
UP Browser t u JDBC Driver ORACLE® 11g

m a S Java SE 6 Java SE 6
r
ฺ v ฺve
s h
( h ite
a
V erm Solaris 10 Solaris 10
LP hAny OS Solaris 10

ites AMD Sparc AMD


H

Sun Blade Sun Blade Sun Blade


HP Any PC
X6240 T6340 X6240

Page 64 of 83
Activity 2: Create DAOFactory and DAO Classes

«interface»
ReservationDAO
+ create(Reservation)
+ delete(Reservation)
+ retrieve(ReservationNumber) : Reservation
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

+ update(Reservation)

ReservationDAO_RDBMS ReservationDAOWebService

+ create(Reservation) + create(Reservation)
+ delete(Reservation) e
+
+
delete(Reservation)
retrieve(ReservationNumber) : Reservation + retrieve(ReservationNumber) : Reservation
r a bl
+ update(Reservation) + update(Reservation)
s fe
- t r an
no n
a
«interface»
CustomerDAO ) has eฺ
+ create(Customer) ฺ c om uid
+ delete(Customer)
r a cle ent G
a @o Stud : Customer
+ retrieve(CustomerNumber)
+ update(Customer)
e r m this
h ฺ vฺv use
i t e s t o
(h ens e
a lic
CustomerDAO_RDBMS
+
erm
Vcreate(Customer)
CustomerDAO_WebService

s h + create(Customer)
H ite + delete(Customer)
+ retrieve(CustomerNumber) : Customer
+
+
delete(Customer)
retrieve(CustomerNumber) : Customer
+ update(Customer) + update(Customer)

«interface»
DAOFactory
+ makeCustomerDAO() : CustomerDAO
+ makeReservationDAO() : ReservationDAO

DAOFactory_RDBMS DAOFactory_WebService
+ makeCustomerDAO() : CustomerDAO + makeCustomerDAO() : CustomerDAO
+ makeReservationDAO() : ReservationDAO + makeReservationDAO() : ReservationDAO

Page 65 of 83
Activity 1: Refining Attributes

Bill RoomType Customer


- allowAddCharges: boolean - description: String - address: Address
- /total: Money - firstName: String {readOnly}
1 - lastName: String {readOnly}
+ canChargesBeAdded() : boolean - phoneNumber: PhoneNumber
+ getTotal() : Money has
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

1 0..* + getLastName() : String


1
1
Room
assigned
- roomId: RoomId
- status: RoomStatus
0..*
+ getRoomId() : RoomId
ChargeableItem + setRoomId(roomId :RoomId)
- amount: Money 1..* ble
- date: Date {readOnly} made for
fe r a
has
ans
+ getAmount() : Money
n - t r
+ getDate() : Date
a no allocated to
0..*
describes
) h as ฺ
1
ฺ c om uide
ChargeableItemType G
c1 le ent 1..*
- description: String
r a
o tud 1..*
@
a is S Reservation
+ getDescription() : String r m h
e e t - datesOfStay: DateRange
+ setDescription(desc :String) vฺv
e s h to us - quotedPrice: Money

( h it s e - reservationNumber: ReservationNumber
a lice n - status: ReservationStatus = new
r m
Vea sample of the possible
Note 1: Only
h + checkedIn()

i e s definitions, accessor methods,


attribute
t + confirmed()
H and mutator methods have been provided. + getDatesOfStay() : DateRange
+ getQuotedPrice() : Money
+ getReservationNumber() : ReservationNumber
+ held()
1
guaranteed by
1
Company
PaymentGuarantee
- address: Address
- companyName: String - amount: Money
- telephoneNumber: PhoneNumber
+ getAmount() : Money
1 + setAmount(amt :Money)

provides
1..*
CardPaymentGuarantee
PurchaseOrderGuarantee
+ cardNumber: CardNumber {readOnly}
- poNumber: PurchaseOrderNumber
+ getCardNumber() : CardNumber

Page 66 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 2: Refining Associations using Aggregation and Composition

DateRange
- endDate: Date
ble
- startDate: Date
fe r a
+ getDaysDuration() : int ans
+ getDaysGap(secondDateRange :DateRange) : int n - t r
+ n
getDaysOverlap(secondDateRange :DateRange) : int o
a
has eฺ
+ getEndDate() : Date
+ getStartDate() : Date )
+ om uid
isDateRangeContained(secondDateRange :DateRange) : boolean
ฺ c
+
+ r a cle ent G
isGap(secondDateRange :DateRange) : boolean
isOverlap(secondDaterange :DateRange) : boolean
+ @o Stud
setDurationEndDates(endDate :Date, duration :int)
a
+ m this
setStartDurationDates(duration :int, startDate :Date)
e r
vฺv use
+ setStartEndDates(endDate :Date, startDate :Date)

s h ฺ
i t e e t o
a (h ens
erm lic
h V Note 1: The solution shows only a subset of methods that will be useful in the

H ites Hotel System domain and in other domains.

Note 2: You can also have class (static) methods for many of these methods.

Page 67 of 83
Bill Customer
RoomType
- allowAddCharges: boolean - address: Address
- /total: Money - description: String - firstName: String {readOnly}
- lastName: String {readOnly}
+ canChargesBeAdded() : boolean 1 - phoneNumber: PhoneNumber
+ getTotal() : Money
+ getLastName() : String
1 has
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

0..* 1
1

assigned Room
- roomId: RoomId
- status: RoomStatus
has
0..* + getRoomId() : RoomId
+ setRoomId(roomId :RoomId)
ChargeableItem made for
ble
- amount: Money
1..*
fe r a
- date: Date {readOnly}
ans
allocated to n - t r
+ getAmount() : Money
n o
+ getDate() : Date
1 1..* s a
) ha eฺ 1..*
0..*
c m uid
oReservation
ฺ tG
describes r a cle eDateRange
- datesOfStay: n
o tudMoney
- quotedPrice:
@
m a s S
- reservationNumber:
i ReservationNumber
v r
e et - h
status: ReservationStatus = new
1
v ฺ
e s hฺ to us + checkedIn()
( h it
ChargeableItemType
s e + confirmed()
a lice
- description: String n + getDatesOfStay() : DateRange
e r m + getQuotedPrice() : Money
V
+ getDescription() : String
+h setDescription(desc :String)
+ getReservationNumber() : ReservationNumber
ite s + held()
H
1
guaranteed by
1
PaymentGuarantee
PurchaseOrderGuarantee - amount: Money
- poNumber: PurchaseOrderNumber
+ getAmount() : Money
+ setAmount(amt :Money)

1..*
CardPaymentGuarantee
+ cardNumber: CardNumber {readOnly}
provides
+ getCardNumber() : CardNumber
1
Company
Note 1: Only a sample of the possible attribute definitions,
- address: Address accessor methods, and mutator methods have been provided.
- companyName: String Note 2: This is just one possible interpretation of aggregation
- telephoneNumber: PhoneNumber and composition.

Page 68 of 83
Activity 3: Refining the Direction of Traversal
RoomType Room
- description: String - roomId: RoomId
has - status: RoomStatus
+ addRoom(room :Room)
+ deleteRoom(res :Reservation) 1 0..* + addReservation(res :Reservation) : void
+ findRooms() : List<Room> + getReservations() : List<Reservation>
+ removeReservation(res :Reservation) : RoomId
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

+ setRoomId(roomId :RoomId)
1..*

Customer
- address: Address
- firstName: String {readOnly} allocated to
- lastName: String {readOnly}
- phoneNumber: PhoneNumber
ble
+ addReservation(res :Reservation) made for
fe r a
+ getLastName() : String
1
1..*
an s
1..*
n - t r
a no
Reservation
- datesOfStay: DateRange
) h as ฺ
ฺ c
- reservationNumber: u ide
omReservationNumber
- quotedPrice: Money

- status: c
a le nt G = new
ReservationStatus
PaymentGuarantee
+@
r
o tude:Room)
addRoom(room
- amount: Money
m i s S
a+ changeRoom(oldRoom :Room, newRoom :Room)
e r + t h
v s+e confirmed()
checkedIn()
1 vฺ
+ getAmount() : Money
+ setAmount(amt :Money) hฺ 1 u + getDatesOfStay() : DateRange
i t e s t o
a n se by ++ getPaymentGuarantee()
(h eguaranteed getQuotedPrice() : Money
: PaymentGuarantee

e rm lic + getReservationNumber() : ReservationNumber


h V + held()
ite s + setPaymentGuarantee(pg :PaymentGuarantee)
H
1
CardPaymentGuarantee
+ cardNumber: CardNumber {readOnly}
+ getCardNumber() : CardNumber
Note 1: The solution contains
only a sample of the direction
of traversal and link attribute
PurchaseOrderGuarantee methods than could have been
- poNumber: PurchaseOrderNumber discovered.

+ getCompany() : Company
has

provides 1..*
1
Company
- address: Address
- companyName: String
- telephoneNumber: PhoneNumber

Page 69 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Bill
- allowAddCharges: boolean
- /total: Money ble
fe r a
+ addChargeableItem(item :ChargeableItem)
ans
+ canChargesBeAdded() : boolean
n - t r
+ o
deleteChargeableItem(item :ChargeableItem)
n
+ a
getChargeableItems() : List<ChargeableItem>
+ has eฺ
getTotal() : Money
)
ฺ c om uid
ChargeableItemType
r a cle ent G1
- description: String
a @o Stud
+ getDescription() : String erm t h is
h ฺ vฺv use
+ setDescription(desc :String)

i t e s 1 to
a (h ense assigned
rm li c
h Ve
i t es describes
H
0..*
0..*

ChargeableItem
- amount: Money
- date: Date {readOnly}
+ getAmount() : Money
+ getChargeableItemType() : ChargeableItemType
+ getDate() : Date
+ setChargeableItemType(t :ChargeableItemType)

Page 70 of 83
Activity 4: Refining Business Methods and Constructors
Room
RoomType - roomId: RoomId
- status: RoomStatus
- description: String
has
+ addReservation(res :Reservation) : void
+ addRoom(room :Room)
+ deleteRoom(res :Reservation) 1 0..* + getReservations() : List<Reservation>
+ removeReservation(res :Reservation) : RoomId
+ findRooms() : List<Room>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

+ Room(id :RoomId, type :RoomType)


+ setRoomId(roomId :RoomId)
1..*
Customer
- address: Address
- firstName: String {readOnly}
- lastName: String {readOnly}
- phoneNumber: PhoneNumber allocated to
ble
+ addReservation(res :Reservation)
fe r a
+
+
Customer(fn :String, ln :String, addr :Address)
Customer(fn :String, ln :String, addr :Address, phone :PhoneNumber) an s
+ getLastName() : String
n - t r
1..*

1 a no
made for ) h as ฺ
Reservation

c
1..* - quotedPrice: Money
ฺ om uide
- datesOfStay: DateRange

- reservationNumber:
r a t G= new
cle enReservationNumber
PaymentGuarantee @ o tud
- status: ReservationStatus

m a
+ S :Room)
addRoom(room
i s
- amount: Money
v r + t h
e + echeckedIn()
changeRoom(oldRoom :Room, newRoom :Room)
v ฺ
+ getAmount() : Money
e s hฺ1 to us+ confirmed()
( h it
+ setAmount(amt :Money)
s e 1 by ++ getDatesOfStay() : DateRange
a lice n
guaranteed getPaymentGuarantee() : PaymentGuarantee
r m + getQuotedPrice() : Money

h Ve + getReservationNumber() : ReservationNumber

ites
+ held()
+ Reservation(dates :DateRange, rtr :List<RoomTypes>)
H + setPaymentGuarantee(pg :PaymentGuarantee)

CardPaymentGuarantee
1
+ cardNumber: CardNumber {readOnly}
+ getCardNumber() : CardNumber checkedIn:
if status != confirmed
then
throw InvalidChangeOfStateException
PurchaseOrderGuarantee else
- poNumber: PurchaseOrderNumber set status = checkedIn

+ getCompany() : Company
has
1..* Note: The solution contains
provides
only a sample of the
1
constructors and the method
Company annotations that could have
been discovered.
- address: Address
- companyName: String
- telephoneNumber: PhoneNumber

Page 71 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

1
getTotal:
set total := 0 Bill
foreach ChageableItem - allowAddCharges: boolean
call getPrice and add to - /total: Money ble
total
fe r a
return total + addChargeableItem(item :ChargeableItem)
an s
+ Bill(initalCharge :ChargeableItem)
n - t r
+
+
canChargesBeAdded() : boolean
a no
deleteChargeableItem(item :ChargeableItem)
+
+ )
getTotal() : Money
has eฺ
getChargeableItems() : List<ChargeableItem>

ฺ c om uid
ChargeableItemType
r a cle1 ent G
- description: String
a @o Stud addChargeableItem:
if allowAddCharges = false
r
+ ChargeableItemType(descr :String)m
e et h i s then
+ getDescription() : String vฺv
h ฺ u s throw CannotChargeException
s
+ setDescription(desc :String)
ite se1 t o assigned else

a ( h n add item to ChargeableItemList


rm lic e
V e
s h
H ite describes

0..*
0..*

ChargeableItem
- amount: Money
- date: Date {readOnly}
+ ChargeableItem(amt :Money, date :Date, itemType :ChargeableItemType)
+ getAmount() : Money
+ getChargeableItemType() : ChargeableItemType
+ getDate() : Date
+ setChargeableItemType(t :ChargeableItemType)

Page 72 of 83
Activity 5: Checking your Class Diagram for High Cohesion and Low Coupling
Room
RoomType - roomId: RoomId
- status: RoomStatus
- description: String
has
+ addReservation(res :Reservation) : void
+ addRoom(room :Room)
+ deleteRoom(res :Reservation) 1 0..* + getReservations() : List<Reservation>
+ removeReservation(res :Reservation) : RoomId
+ findRooms() : List<Room>
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

+ Room(id :RoomId, type :RoomType)


+ setRoomId(roomId :RoomId)
1..*
Customer
- address: Address
- firstName: String {readOnly}
- lastName: String {readOnly}
- phoneNumber: PhoneNumber allocated to
ble
+ addReservation(res :Reservation)
fe r a
+
+
Customer(fn :String, ln :String, addr :Address)
Customer(fn :String, ln :String, addr :Address, phone :PhoneNumber) an s
+ getLastName() : String
n - t r
1..*

1 a no
made for ) h as ฺ
Reservation

c
1..* - quotedPrice: Money
ฺ om uide
- datesOfStay: DateRange

- reservationNumber:
r a t G= new
cle enReservationNumber
PaymentGuarantee @ o tud
- status: ReservationStatus

m a
+ S :Room)
addRoom(room
i s
- amount: Money
v r + t h
e + echeckedIn()
changeRoom(oldRoom :Room, newRoom :Room)
v ฺ
+ getAmount() : Money
e s hฺ1 to us+ confirmed()
( h it
+ setAmount(amt :Money)
s e 1 by ++ getDatesOfStay() : DateRange
a lice n
guaranteed getPaymentGuarantee() : PaymentGuarantee
r m + getQuotedPrice() : Money

h Ve + getReservationNumber() : ReservationNumber

ites
+ held()
+ Reservation(dates :DateRange, rtr :List<RoomTypes>)
H + setPaymentGuarantee(pg :PaymentGuarantee)

CardPaymentGuarantee
1
+ cardNumber: CardNumber {readOnly}
+ getCardNumber() : CardNumber checkedIn:
if status != confirmed
then
throw InvalidChangeOfStateException
PurchaseOrderGuarantee else
- poNumber: PurchaseOrderNumber set status = checkedIn

+ getCompany() : Company
has
Note 1: This diagram has optimum
1..* cohesion.
provides
1 Note 2: This diagram has more than
optimum coupling because of the
Company bidirectional association. For
Example, there is bidirectional
- address: Address association between Room and
- companyName: String Reservation, RoomType and Room,
- telephoneNumber: PhoneNumber and Customer and Reservation.

Page 73 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

1
getTotal:
set total := 0 Bill
foreach ChageableItem - allowAddCharges: boolean
call getPrice and add to - /total: Money ble
total
fe r a
return total + addChargeableItem(item :ChargeableItem)
an s
+ Bill(initalCharge :ChargeableItem)
n - t r
+
+
canChargesBeAdded() : boolean
a no
deleteChargeableItem(item :ChargeableItem)
+
+ )
getTotal() : Money
has eฺ
getChargeableItems() : List<ChargeableItem>

ฺ c om uid
ChargeableItemType
r a cle1 ent G
- description: String
a @o Stud addChargeableItem:
if allowAddCharges = false
r
+ ChargeableItemType(descr :String)m
e et h i s then
+ getDescription() : String vฺv
h ฺ u s throw CannotChargeException
s
+ setDescription(desc :String)
ite se1 t o assigned else

a ( h n add item to ChargeableItemList


rm lic e
V e
s h
H ite describes

0..*
0..*

ChargeableItem
- amount: Money
- date: Date {readOnly}
+ ChargeableItem(amt :Money, date :Date, itemType :ChargeableItemType)
+ getAmount() : Money
+ getChargeableItemType() : ChargeableItemType
+ getDate() : Date
+ setChargeableItemType(t :ChargeableItemType)

Page 74 of 83
Activity 6: Creating Components with Interfaces
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

RoomPhoneControl

RoomPhoneControlService

ReservationService
RoomPhoneControlService
ble
fe r a
Customer ReservationService Reservation
ans
AdditonalCharges
n - t r
n o
a
has eฺ
BillingService RoomService
)
ฺ c
BillingServiceom uid
BillingService
r a cle ent G
a @o Stud
e r
Billing
m this
h ฺ vฺv use
i t e s t o
(h ens e
rm a lic
V e
es h Housekeeping
RoomService
H i t RoomService

Room

Note 1: This is a subset of the


possible components.
Note 2: Alternative component
configurations are possible.

Page 75 of 83
Activity 1: Identifying Methodology Characteristics

Activity 1: Identifying Methodology Characteristics


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Select the statement or statements about Use-Case-driven

✓ methodologies that are true.

a. ___ Focus on relationships between actors and the system


b. ___ Based on the notion that software performs activities for
users
c. ___ Uses non-functional requirements to drive structure of the ble
system fe r a
ans
d. ___ Must be iterative
n - t r
e. ___
a no
Focus on the systemic qualities, such as reliability and
scalability
) has eฺ
ฺ c om uid
cle ent G
Answers: a, b
Answer c is wrong because NFRs are not relevantra to use cases.

@ o tud

m a
Answer d is wrong because a methodology
i s S is independent of being Use-Case-driven.
that is iterative
● r
e qualities
Answer e is wrong because systemic
v thare NFRs and are not relevant to use cases.
v ฺ e
e s hฺ to us
( h it se
a e n
e rm lic
h V
ite s
H

14-2 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 76 of 83
Activity 1: Identifying Methodology Characteristics

Self-Check – Select the statement or statements about Architecture-centric

✓ methodologies that are true.


Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

a. ___ Focus on relationships between actors and the system


b. ___ Based on the notion that software performs activities for
users
c. ___ Uses non-functional requirements to drive the architecture
of the system
d. ___ Must be iterative
ble
fe r a
e. ___ Focus on the systemic qualities, such as reliability and
ans
scalability
n - t r
n o
a
hasqualities,
Answers: c, e

m )
Answer a is wrong because Architecture-centric is focused on systemic
d eฺ not actors and their
use cases. o
ฺc t Gu i
l e
rabec Architecture-centric
Answer b is wrong for the same reason as answer a.

Answer d is wrong because a methodologyo can d e n without being iterative.



@
a is S t u
r m
e e th
v ฺ v
e s hฺ to us
( h it se
a e n
e rm lic
es hV
H i t

Overview of Software Development Processes 14-3


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 77 of 83
Activity 2: Defining the Five Object-Oriented Methodologies

Activity 2: Defining the Five Object-Oriented


Methodologies
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Self-Check – Match the object-oriented software development

✓ methodology terms with their definitions.

Term Definition
ble
fe r a
Waterfall An iterative software development process,
ans
created by Booch, Jacobson, and Rumbaugh, that
is freely available for use. n - t r
a no
eXtreme Programming
) hakeys activities
Coding and testing are the
e ฺ within
this methodology. m id
(XP)
ฺ c o u
e
cl ent G
Unified Software r a
o tuframework,
Team-oriented d where each Sprint
Development Process @
a is S
produces a working version of the software.
(UP) r m
e e th
v ฺ v
e s hฺ to us
h it
Rational Unified Process
( s e This methodology uses a single phase in which all
(RUP) a lice n workflows proceed in a linear fashion.
r m
Ve
hScrum
i t es A commercial implementation of the UP
H methodology.

Answers: UP, XP, Scrum, Waterfall, RUP

14-4 Object-Oriented Analysis and Design Using UML


Copyright 2010 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision E

Page 78 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 3: Producing an Iteration Plan

t h is
Abstract of a Suggested Hotel System Iteration Plan u s e
e t o
Note: Your plan might vary as the assessment of risk and priority is subjective. e n s
c
bl e li
Elaboration Construction
f e r a
Iter#2 Iter#3 Iter#4 Iter#5 Iter#6 a n
Iter#7
s Iter#8 Iter#9
n-t r
Create Perform Perform Update Delete oRequest List of
Retrieve Publish Special
Reservation Card Payment Payment Cash Reservation
s an
Reservation Vacated Rooms Reservation Promotions to
Transaction Transaction
) ha eฺ Statistics Customers
Simulation Add Charge to Create
ฺ c omCreateuid
Identify Existing Mark Room Modify Notify Guest of
Customer Data Customer's Bill Customer Reservation
c t G
le nPromotion Ready for Use Promotion Today's
a
or tude Reservation
Check In Check Out Change Room @
a AdjustS Register Generate Generate Modify
Customer Customer Phone e r m
Status Customer's Bill Customer Nightly Reports Discrepancy Customer
ฺ v ฺv Loyalty Card Report
s h
( h ite
Simulation e rma Add Loyalty
hV
Change Room
es
Points
i t
Phone Status
H

Page 79 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Activity 4: Selecting Methodologies

Exercise Solution for Module 14, Activity 4 ble


fe r a
Methodology Selection : UP, SunTone AM, or RUP ans
Justification: Members have flexible jobs, medium/large scale project, company isn - t r
process-oriented (ISO ).
a no
Methodology Selection: XP or Waterfall ) has eฺ
Justification: Company culture favors experimentation, c m areuiindclose proximity, and
oteams

e use
lCould t G because similar
the company has two experienced programmers.
r a c n waterfall
system has already been built by the engineers
@ de company.
o attauprevious
r m a is S
Methodology Selection: RUP or
ฺ v UP
e jobs, e thmedium/large scale project, company is
Justification: Members have v flexibles for Rational Rose.
hฺand ittohasulicense
process-oriented (PLC),
it e s
a ( h
e n se
e rm lic
h V
e s
Hit

Page 80 of 83
Activity 1: Creating a Conceptual Framework
«interface»
DateRange GenericDateRange
+ getDateRange(start :Date, end :Date) : Date + getDateRange(start :Date, end :Date) : Date
+ getStartDate() : Date + getStartDate() : Date
0..1
«interfa... Room
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Resource
- roomId: RoomId
- status: RoomStatus
«interface»
Event + available()
0..* + getRoomId() : RoomId
+ addResource(resource :Resource) 0..*
+ deleteResource(resource :Resource) : void 1 + occupied()
+ getDateRange() : DateRange
+ getDescription() : String GenericEvent
+ getParty() : Party
- description: String
ble
+
+
getResources() : List<Resource>
setDateRange(dateRange :DateRange) fe r a
+ setDescription(desc :String)
+ addResource(resource :Resource)
ans
+ setParty(party :Party)
+
+ getDateRange() : DateRange n r
deleteResource(resource :Resource) : void
- t
a
0..1
no 0..*
+ getDescription() : String

has eฺ
+ getParty() : Party
+ getResources() : List<Resource>
«interface» )
Party
ฺ c om uid +
+
setDateRange(dateRange :DateRange)
setDescription(desc :String)
+ getAddress() : Address
a c le nt G + setParty(party :Party)
+ getPhoneNumber(phone :PhoneNumber) r
o tude
+ setAddress(addr :Address) @
a is S
+ setPhoneNumber(phone :PhoneNumber) r m
e e th
v ฺ v
e s hฺ to us Reservation

( h it s e - quotedPrice: Money
a lice
GenericParty n - resNumber: ReservationNumber
e r m - status: ReservationStatus
V
- address: Address
-shphoneNumber: PhoneNumber + checkedIn()
e
Hit + getAddress() : Address + confirmed()
+ getQuotedPrice() : Money
+ getPhoneNumber() : PhoneNumber + getReservationNumber() : ReservationNumber
+ setAddress(addr :Address) + setQuotedPrice(price :Money) : void
+ setPhoneNumber(phone :PhoneNumber) + setReservationNumber(resNum :ReservationNumber)

Company Person
- companyName: String - firstName: String
- lastName: String
+ getFirstName() : String
+ getLastName() : String
+ setFirstName(firstName :String)
+ setlastName(lastName :String) : void

Note 1: This is an abstract of the attributes and methods.


Note 2: The framework is shown in yellow, and the Hotel Customer
specific classes are shown in blue.
+ addReservation(res :Reservation)
Note 3: We could have created a more generic version which
would have allowed multiple date ranges and multiple parties.
The generic version would also have allowed replacing
DateRange with TimeRange.
Page 81 of 83
Activity 2: Identifying Potential Frameworks

TimePeriod
ResourceUser

0..1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

1
used by
1..* 1
Event has ReourceAllocation
1 0..*

0..* e
1
r a bl
0..1 s fe
- t r an
Charges
n o n
a
) has eฺ
1 ฺ c om uid
r a cle ent G
@o Stud
0..*

ChargeableItem r a
m this 1
ฺ v e e
s h ฺv us Resource
it e t o
a ( h
e n se
e rm lic
h V
i t es describes
1..*
H
ChargeableItemType 1

ResourceType

Note 1: This is one possible solution.


Note 2: In a Private Hospital System, you may need multiple resources for different
TimeRanges, for example: your room, the operating theatre, an intensive care nurse.
Note 3: Some resources, such as medication, may not need to be allocated for a
TImeRange. Therefore, the TimeRange is optional.
Note 4: In some cases, it might be useful to assocate ChargeableItem with
ResourceAllocation.

Page 82 of 83
Abstract of a Private Hospital System using a Generic Framework
TimePeriod
HospitalStay

0..1
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

1
ResourceUser used by Event has ReourceAllocation
1 1..* 1 0..*

1 0..*
ble
fe r a
0..1
an s
Charges n - t r
Patient
a no 1

) has eฺ Resource

1 ฺ c om uid
r a cle ent G
@ o tud 1..*
a s S
erm e thi
0..* describes
HospitalBill
ฺ v
ฺv ChargeableItem
s h t o us 1
it e
a ( h
e n se ResourceType

erm li c HospitalResource
V
esh
Hit
ChargeableItemType

HospitalResourceType

Note 1: This is one possible solution.


Note 2: The Framework classes are shown in Yellow, and the specific Private Hospital
classes are shown in Blue.
Note 3: In a Private Hospital System, you may need multiple resources for different
TimeRanges, for example: your room, the operating theatre, an intensive care nurse.
Note 4: Some resources, such as medication, may not need to be allocated for a
TImeRange. Therefore, the TimeRange is optional.
Note 5: In some cases, it might be useful to assocate ChargeableItem with
ResourceAllocation.

Page 83 of 83
Unauthorized reproduction or distribution prohibitedฺ Copyright© 2020, Oracle and/or its affiliatesฺ

Hites
Vh
erm
a
i t e
lic
s h ฺ
(h ens e t
e
o
r a
vฺv use
r
m this
a
ฺ c
@o Stud
)
cle ent G
om uid
a
has eฺ
o n n
- t r an
sfe r a bl
e

You might also like