Unit 3 RequirementAnalysis Usecase
Unit 3 RequirementAnalysis Usecase
Unit 3 RequirementAnalysis Usecase
ANALYSIS
Problem Analysis
• “ The goal of object oriented analysis is to
understand the domain of the problem and
system responsibilities in order to meet the
user’s requirements.”
• The OOA process doesn’t begin with a
concern for objects. Rather, it begins with an
understanding of the manner in which the
system will be used-by the people, if the
system is human-interactive.
Problem Domain Classes
• Object Oriented domain analysis is the
identification, analysis, and specification of
common requirements from a specific
application domain, typically for reuse on
multiple projects within that application
domain.
• Domain analysis is performed when an
organization wants to create a library of
reusable classes (components) that will be
broadly applicable to an entire category of
applications.
Technical Literature
Existing applications
Source of Domain
Customer surveys Domain
Domain Analysis Analysis
Knowledge Expert advice
Model
Current/future
Requirements
The domain analysis model will serve as the basis for design
and construction of the domain objects. These domain
objects can be used to create a new application.
Analysis Process
• Elicit customer requirements for the system
• Identify scenarios or use-cases
• Select classes and objects using basic
requirements as a guide
• Identify attributes and operations for each
system object
• Build an analysis model
• Review the OO analysis model against use-
cases or scenarios
Problem Statement
• Analysis begins with a problem statement generated
by clients and the developers.
• The problem statement should state what is to be
done and not how it is to be done.
• The user should avoid describing system internals, as
this restricts implementation flexibility.
• The statement maybe incomplete or informal;
analysis makes it more precise and exposes
ambiguities and inconsistencies.
Object Modeling
• The first step in analyzing the requirements is
to construct an object model. It shows the
static data structure of the real world system
and organizes it into workable pieces.
• Information for the object model comes from
the problem statement, expert knowledge of
the application domain, and general
knowledge of the real world.
• The following steps are performed in
constructing an object model:-
– Identify objects and classes:- from the detailed
statement of the problem, classes and objects can
be a visible thing, physical entities, concepts as
seating assignments, materials, events,
interaction, places, organization, devices etc.
Discard unnecessary and incorrect classes, if two
classes express the same information, the most
descriptive name should be kept. Names that
primarily describe individual objects should be
restated as attributes. The name of a class should
reflect its intrinsic nature and not a role that
plays in an association.
– Preparing a Data Dictionary:- From detail
statement of the problem
– (1) write a paragraph describing each object class
– (2) describe association, attributes and operations
in each class
– (3) describe the scope of the class within the
current problem, including any assumptions or
restrictions on its use.
• Identifying Associations:- Identify associations
between classes. Any dependency between two or
more classes is an association.
• If one of the classes in the association has been
eliminated, then the association must be eliminated
or restated in terms of other classes. Names should
define the association. Specify multiplicity but keep it
flexible as it often changes during analysis. Add any
missing associations that are discovered. Add role
names where appropriate.
– Identifying attributes:- Attributes are properties of
individual objects. An instance can have one value
for any attribute. Composite attribute should be
divided into smaller fields. Eliminate the
unnecessary and incorrect attributes. If the value
of an attribute depends on a particular context,
then consider restating the attribute as a qualifier.
If an attribute describes the internal state of an
object that is invisible outside the object, then
eliminate it from the analysis.
If a property depends on the presence of a link,
then the property is an attribute of the link and
not of a related object.
– Refining with Inheritance:- The next step is to
organize classes by using inheritance to share
common structure. Either the common aspects of
existing classes can be generalized into a super-
class, or existing classes can be refined into
specialized sub-classes. Avoid excessive refinement.
When the same association name appears more
than once with substantially the same meaning, try
to generalize the associated classes.
– Identify Operations to be included in a class:-
Behavior is how an object acts and reacts in terms
of its state changes and message passing.
Operations that are included in a class can be:-
Modifier:- alters the state of an object
Selector:- Accesses the state of an object but
does not alter the state.
Iterator:- Accessing parts of an object in some
well defined order.
Constructor:- creates an object and/or
initializes its state.
Destructor:- Frees the state of an object
Create, update, retrieve, delete include all the
operations for all the classes.
• Testing Access Paths:- Trace access path through the
object model diagram to see if they yield sensible
results. If something that seems simple in the real
world appears complex in the model, it indicates
error in the diagram.
• Iterating Object modeling:- An object model is rarely
correct after a single pass. The entire software
development process is one of continual iteration;
different parts of a model are often at different
stages of completion. Some refinements can only
come after the dynamic and functional models are
completed.
• Grouping Classes into modules:- The last step
of object modeling is to group classes into
sheets and models, diagrams may be divided
into sheets of uniform size for convenience in
drawing and viewing.
Use-Case driven Object Oriented
Analysis
• A Use Case diagram is a diagram that help
system analyst to discover the requirements of
the target system from the user’s perspective.
• Use cases represent typical sets of scenarios
that help to structure, relate and understand
the essential requirements.
• It provides graphical description of the users of
a system and what kinds of interactions to
expect within that system.
Elements of Use Case diagram
• Actors:- Actor is direct external user of system
• An actor portrays any entity (or entities) that
performs certain roles in a given system. An actor
in a use case diagram interacts with a use case.
Withdraw money
<<extend>>
Excess money
Pay Bill
By Post By Internet
Difference between generalization and
Extend
• When we establish a generalization
relationship between use cases, this implies
that the parent use case can be replaced by the
child use case without breaking the business
flow.
• An Extend relationship between use cases
implies that the parent use case cannot be
replaced by the child use case. It represent the
exceptional cases.
Guidelines for use case models
• Use case identify the functionality of the system and organize it
according to the perspective of users.
• Guidelines for constructing use cases:
• First determine the system boundary
• Ensure that actors are focused
– Each actor should have single coherent purpose
– If real world object embodies multiple purposes, capture them with
separate actors
– Example: owner of PC can install software, set up database, send email
– These functions differ greatly in their impact on computer system and
potential for system damage
– So, they can be broken into 3 actors as
• System administrator
• Database administrator
• Computer user
• Identify actors by following questions:
– Who will use the main functionality of the system?
– Who will need to maintain, administrate, and keep
the system working?
– Who will need support from the system to do their
daily tasks?
– What other systems does the system need to
interact?
– Who has an interest in the results produced?
• Each use case must provide value to users
Issue Book
Librarian
Return Book
Student
Use case Diagram for a vending machine
Vending machine
Buy beverage
Customer
Perform
scheduled
maintenances
Repair technician
Make repairs
Load items
Stock Clerk
• System Startup Use Case
• The system is started up when the operator turns the
operator switch to the "on" position. The operator will be
asked to enter the amount of money currently in the cash
dispenser, and a connection to the bank will be established.
Then the servicing of customers can begin.
• System Shutdown Use Case
• The system is shut down when the operator makes sure that
no customer is using the machine, and then turns the
operator switch to the "off" position. The connection to the
bank will be shut down. Then the operator is free to remove
deposited envelopes, replenish cash and paper, etc.
• Session Use Case
• If the bank reports that the customer's PIN is invalid, the Invalid PIN
extension will be performed and then an attempt will be made to
continue the transaction. If the customer's card is retained due to
too many invalid PINs, the transaction will be aborted, and the
customer will not be offered the option of doing another.
• If a transaction is cancelled by the customer, or fails for any reason
other than repeated entries of an invalid PIN, a screen will be
displayed informing the customer of the reason for the failure of the
transaction, and then the customer will be offered the opportunity
to do another.
• The customer may cancel a transaction by
pressing the Cancel key as described for each
individual type of transaction below.
• All messages to the bank and responses back
are recorded in the ATM's log.
• Withdrawal Transaction Use Case
• A withdrawal transaction asks the customer to choose a type of
account to withdraw from (e.g. checking) from a menu of possible
accounts, and to choose a dollar amount from a menu of possible
amounts. The system verifies that it has sufficient money on hand
to satisfy the request before sending the transaction to the bank. (If
not, the customer is informed and asked to enter a different
amount.) If the transaction is approved by the bank, the
appropriate amount of cash is dispensed by the machine before it
issues a receipt. (The dispensing of cash is also recorded in the
ATM's log.)
• A withdrawal transaction can be cancelled by the customer pressing
the Cancel key any time prior to choosing the dollar amount.
• Deposit Transaction Use Case
55
Example- Money Withdraw
• Use Case: Withdraw Money
• Author: ZB
• Date: 1-OCT-2004
• Purpose: To withdraw some cash from user’s bank account
• Overview: The use case starts when the customer inserts his credit card
into the system. The system requests the user PIN. The system validates
the PIN. If the validation succeeded, the customer can choose the
withdraw operation else alternative 1 – validation failure is executed. The
customer enters the amount of cash to withdraw. The system checks the
amount of cash in the user account, its credit limit. If the withdraw
ניתוח מערכות מידע
amount in the range between the current amount + credit limit the
system dispense the cash and prints a withdraw receipt, else alternative 2
– amount exceeded is executed.
• Cross References: R1.1, R1.2, R7
56
Example- Money Withdraw (cont.)
• Actors: Customer
• Pre Condition:
– The ATM must be in a state ready to accept transactions
– The ATM must have at least some cash on hand that it can dispense
– The ATM must have enough paper to print a receipt for at least one
transaction
• Post Condition:
ניתוח מערכות מידע
– The current amount of cash in the user account is the amount before
the withdraw minus the withdraw amount
– A receipt was printed on the withdraw amount
– The withdraw transaction was audit in the System log file
57
Example- Money Withdraw (cont.)
2. Customer inserts a Credit card into ATM 3. System verifies the customer ID and status
58
Example- Money Withdraw (cont.)
• Alternative flow of events:
– Step 3: Customer authorization failed. Display an error
message, cancel the transaction and eject the card/ re-
enter the pin.
– Step 8: Customer has insufficient funds in its account.
Display an error message, and go to step 6.
– Step 8: Customer exceeds its legal amount. Display an
ניתוח מערכות מידע
59
Example- Money Withdraw (cont.)
One method to identify use cases is actor-based:
- Identify the actors related to a system or organization.
- For each actor, identify the processes they initiate or participate in.
A second method to identify use cases is event-based:
- Identify the external events that a system must respond to.
- Relate the events to actors and use cases.
The following questions may be used to help identify the use cases for a
system:
- What are tasks of each actor ?
-
ניתוח מערכות מידע
Will any actor create, store, change, remove, or read information in the system ?
- What use cases will create, store, change, remove, or read this information ?
- Will any actor need to inform the system about sudden, external changes ?
- Does any actor need to be informed about certain occurrences in the system ?
- Can all functional requirements be performed by the use cases ?
60
Creating Class diagram by using Use Case
Analysis method
• Use Case diagram contains different
functionalities of the system from user’s point of
view. These functionalities can be directly
converted to class diagram.
• The entities or the actors that are participating in
a use case are modeled as classes.
• Relationship between different use cases and
actors represents the association among classes.
• It involves the following steps:-
– Determine the goal of use case: Identify the functions
– Identify Entities or Actors
– Specify Entities as Classes and their features as
Attributes of the Classes in object modeling
– Specify reference between entities as relationships
between Classes
– Identify Collaboration between Use cases and Entities:
classes that will be performing specific functions,
specified in use case
– Specify collaboration as Operation of Classes
– Test Use Case Entity diagram and the Class diagram
Class-Responsibility-Collaborator Modeling