Académique Documents
Professionnel Documents
Culture Documents
Real and Essential use cases Essential use case: Real use case:
Use case degree of design commitment very abstract very concrete
Essential
Essentialuse
usecase
casesvery abstract
- created during earlyreal veryof eliciting the requirements
stage
concrete
- independent of the design decisions
Essential
Actor action System response
1. cashier records identifier for each item 2. Determine the item price and add the item info
If there is more than one of the same to the running sales transaction description
The cashier enters quantity price of the current item in item presented
Real
1. For each item cashier types UPC 2. Display item price and add the item information
In the UPC input field of window then to the running sales transactions the description
They press “enter item” button and price of current item are displayed
with the mouse or keyboard
There are three types of transactions, Withdraw Funds, Get Balance are part of
all three use cases;
Description (continued) :
– Customer selects Withdraw Funds, selects the account number, and enters the
amount.
– System checks that the account is valid, makes sure that customer has enough
funds in the account, makes sure that the daily limit has not been exceeded,
and checks that the ATM has enough funds.
– If all four checks are successful, the system dispenses the cash.
– System prints a receipt with a transaction number, the transaction type, the
amount withdrawn, and the new account balance.
– System ejects card.
– System displays the idle welcome message.
Alternatives :
– If the system cannot recognize the card, it is ejected and the welcome
message is displayed.
– If the current date is past the card's expiration date, the card is confiscated
and the welcome message is displayed.
– If the card has been reported lost or stolen, it is confiscated and the welcome
message is displayed.
– If the customer entered PIN does not match the PIN for the card, the system
prompts for a new PIN.
– If the customer enters an incorrect PIN three times, the card is confiscated and
the welcome message is displayed.
– If the account number entered by the user is invalid, the system displays an
error message, ejects the card and the welcome message is displayed.
– If the request for withdraw exceeds the maximum allowable daily withdrawal
amount, the system displays an apology message, ejects the card and the
welcome message is displayed.
– If the request for withdraw exceeds the amount of funds in the ATM, the
system displays an apology message, ejects the card and the welcome message
is displayed.
– If the customer enters Cancel, the system cancels the transaction, ejects the
card and the welcome message is displayed.
Postcondition :
Funds have been withdrawn from customer's account.
The heart of this solution is the creation of interaction diagrams, which illustrate how
objects collaborate to fulfill the requirements.
Design class diagrams can be drawn after or in parallel with drawing interaction
diagrams.
These summarize the definition of the software classes (and interfaces) that are to
be implemented in software.
In terms of the UP, these artifacts are part of the Design Model.
Business Model
Op. Contract
Method( ) Operation
Starting events
Domain Model Sys. Seq. Diagram Post-conditions
Use Case
Suggestions for names Title
Functional
1. …
requirements
2. …
method1( )
method2( )
method3( ) Item details
Glossary
Interaction Diagrams Domain rules
Non-functional Supplementary
requirements Specification
Design Class Diagram
Design Model
timeStamp
Domain Model
Process Sale
1. Customer arrives
conceptual makeNewSale( )
Process Sale
classes in 2. Cashier makes
the new sale…. System Events
Cashier
domain enterItem(id,quantity )
inspire the
names of Use Case
some Use Case Model Sys. Seq. Diagram Use Case Diagrams
software
classes in :Register :ProductCatalogue
the design
makeNewSale( ) create( )
:Sale
enterItem(id,quantity )
spec:=getSpecification(id)
addLineItem(spec, quantity)
the design
classes
Register ProductCatalogue discovered
while designing
1 1
UCRs can be
makeNewSale( ) getSpecification( ) summarized in
class diagrams
enterItem(id,quantity )
…………………..
Design Model
Saroj Shakya, OOSE, Nepal College of
8/1/2010 10
Information Technology
interaction diagram
enterItem
Operation : enterItem (UPC, qty)
enterItem
Post-conditions
endSale
If a new sale, a new sale :Register
makePayment created.
Collaboration
System Sequence Contract
Diagram
Diagram
A name can be used to uniquely identify the instance. If none is used, a ":"
precedes the class name.
The UML has adopted a simple and consistent approach to illustrate instances vs.
classifiers:
spec := getProductSpect(id)
spec := getProductSpect(id:ItemID)
Messages
Each message between objects is represented with a message expression and small
arrow indicating the direction of the message.
Many messages may flow along this link .
A sequence number is added to show the sequential order of messages in the
current thread of control.
Iteration notation: If the details of the iteration clause are not important to the
modeler, a simple ’*’ can be used.
Example:
Either 1a or 1b could execute after msg1. Both are sequence number 1 since either
could be the first internal message.
Note that subsequent nested messages are still consistently prepended with their
outer message sequence. Thus Ib. 1 is nested message within Ib.
Messages may be sent to a class itself, rather than an instance, to invoke class or
static methods.
A message is shown to a class box whose name is not underlined, indicating the
message is being sent to a class rather than an instance .
Links
Unlike collaboration diagrams, sequence diagrams do not show links.
Messages
Each message between objects is represented with a message expression on an
arrowed line between the objects.
The time ordering is organized from top to bottom.
sequence diagrams may also show the focus of control using an activation box. The
box is optional, but commonly used by UML practitioners.
Illustrating Returns
the return from a message is shown as a dashed open-arrowed line at the end of an
activation box (Optional). Some annotate the return line to describe what is being
returned (if anything) from the message.
Conditional Messages
The POST can be chosen as the controller for handling the events
enterItem() 1: ???()
:POST
endSale() 1: ???()
:POST
makePayment() 1: ???()
:POST
startUp() 1: ???()
:POST
Responsibility: Enter (record) sale of an item and add it to the sale. Display the item description
and price.
Type System, System Functions: R1.1, R1.3, R1.9
Cross References: Use Cases: Buy Items
Exceptions: If UPC is not valid, indicate that it was an error.
Pre-conditions:
Relevant responsibilities related to "knowing" are often inferable from the domain
model, because of the attributes and associations it illustrates.
the Sale class might define one or more methods to know its total; say, a method
named getTotal.
To fulfill that responsibility, the Sale may collaborate with other objects, such as
sending agetSubtotal message to each SalesLineltem object asking for its subtotal.
Sale objects have been given a responsibility to create Payments, which is invoked
with a makePayment message and handled with a corresponding makePayment
method.
Patterns are named problem/solution pairs that codify good advice and
principles often related to the assignment of responsibilities.
For example:
Pattern Name:
Solution:
Problem It Solves:
Only sales instance in conceptual model knows the information about the grand total
by having the all the information about the SalesLineItem in the Sale and the sum of
their subtotals. Hence sale in information expert
- B aggregates A objects.
- B contains A objects.
- B records instances of A objects.
- B closely uses A objects.
B has the initializing data that will be passed to A when it is created (thus B is an
Expert with respect to creating A).
B is a creator of A objects.
If more than one option applies, prefer a class B which aggregates or contains
class A.
Such classes are undesirable; they suffer from the following problems
- hard to comprehend
- hard to reuse
- hard to maintain
- delicate; constantly effected by change
Low cohesion classes often represent a very "large grain" of abstraction, or have
taken on responsibilities that should have been delegated to other objects
A class with low cohesion does many unrelated things, or does too much work.
Such classes are undesirable; they suffer from the following problems:
- hard to comprehend
- hard to reuse
- hard to maintain
- delicate; constantly effected by change
Low cohesion classes often represent a very "large grain" of abstraction, or have
taken on responsibilities that should have been delegated to other objects
Since a Register "records" a Payment in the real-world domain, the Creator pattern
suggests Register for creating the Payment.
makePayment 1:create()
:Register p: Payment
2: addPayment(p)
:Sale
makePayment 1:makePayment
:Register :Sale
1.1: create()
Lessens coupling
hence better!!
: Payment
Use the same controller class for all system events in the same use case
scenario.
Informally, a session is an instance of a conversation with an actor.
Sessions can be of any length, but are often organized in terms of use cases
For a Sender Object to send message to a receiver object, the sender must be
visible to the receiver or sender must have some kind of reference or pointer to the
receiver object
Q. What is visibility?
A. Visibility is the ability of one object to see or have reference to another.
The ability of one object to see or have reference to another object
It is related to the issue of scope
Four common ways that visibility can be achieved from Object A to Object B.
Public:
Any outside classifier with visibility to the given classifier can use the feature;
specified by pre-pending the symbol “+”
Protected:
Any descendant of the classifier can use the feature; specified by pre-pending
the symbol “#”
Private:
Only the classifier itself can use the feature; specified by pre-pending the
symbol “-”
functional (behavioral)
calculations, technical details, data manipulation and processing and other specific
functionality
non-functional (everything else);
(also known as quality requirements), which impose constraints on the design or
implementation (such as performance requirements, security, cost and reliability).
Interaction Diagram: this tells the designer about the software classes that
participate in the solution
Identify all the classes participating in the software solution by analyzing the
interaction diagram
Duplicate the attributes from the associated concepts in the conceptual model
DCDs:
Design Classes express the definition of classes as software components. In these
diagrams, a Sale represents a software class
These can be found by scanning all the interaction diagrams and listing the classes
mentioned.
For the POS application, these are:
Register Sale
ProductCatalog ProductSpecification
Store SalesLineItem
Payment
The following special issues must be considered with respect to method names
- Interpretation of the create() message
- Depiction of accessing methods
- Interpretation of messages to multiobjects
- Language dependent syntax
Thus the find() method is not a part of the ProductSpecification class; rather it is
part of the hash table or dictionary class definition.
Navigability is a property of the role that indicates that it is possible to navigate uni-
directionally across the association from objects of the source to target class.
For instance Register class will define an attribute that references a Sale instance.
From the collaboration diagram we see that the Store should have an ongoing
connection to the Register and Product Catalogue instance that is created.