Requirements Modelling
Requirements Modelling
REQUIREMENTS ANALYSIS
Behavioral elements depict how external events change the state of the system or the
classes that reside within it. Finally,
Flow-oriented elements represent the system as an information transform, depicting
how data objects are transformed as they flow through various system functions.
SCENARIO-BASED MODELING
Scenario-based elements depict how the user interacts with the system and the
specific sequence of activities that occur as the software is used.
Creating a Preliminary Use Case
Alistair Cockburn characterizes a use case as a “contract for behavior”, the “contract”
defines the way in which an actor uses a computer-based system to accomplish some goal. In
essence, a use case captures the interactions that occur between producers and consumers of
information and the system itself.
A use case describes a specific usage scenario in straightforward language from the point of
view of a defined actor. These are the questions that must be answered if use cases are to
provide value as a requirements modeling tool.
(1) what to write about,
(2) how much to write about it,
(3) how detailed to make your description, and
(4) how to organize the description?
To begin developing a set of use cases, list the functions or activities performed by a
specific actor.
Safe Home Example
Identifies the following functions that are performed by the homeowner actor :
Select camera to view.
Request thumbnails from all cameras.
Display camera views in a PC window.
Control pan and zoom for a specific camera.
Selectively record camera output.
Replay camera output.
Access camera surveillance via the Internet.
Actor: homeowner
Actor: homeowner
10. The system displays a viewing window that is identified by the camera ID.
11. The system displays video output within the viewing window at one frame
per second.
Answers to these questions result in the creation of a set of secondary scenarios that are
part of the original use case but represent alternative behavior.
SafeHome Example :
Consider steps 6-7:
6. The homeowner selects “pick a camera.”
7. The system displays the floor plan of the house.
1) Can the actor take some other action at this point?
• The answer is “yes.” the actor may choose to view thumbnail snapshots of all cameras
simultaneously.
- One secondary scenario might be “View thumbnail snapshots for all cameras.”
2) Is it possible that the actor will encounter some error condition at this point?
Any number of error conditions can occur as a computer- based system
operates.
The answer is “yes.”
A floor plan with camera icons may have never been configured.
selecting “pick a camera” results in an error condition: “No floor plan
configured for this house.”- a secondary scenario.
3) Is it possible that the actor will encounter some other behavior at this point?
The answer is “yes.”
the system may encounter an alarm condition.
This would result in the system displaying a special alarm notification (type,
location, system action) and providing the actor with a number of options
relevant to the nature of the alarm.
It will not become part of the ACS-DCV use case.
Rather, a separate use case—Alarm condition encountered—would be
developed and referenced from other use cases as required.
Use-case exception
Exception: Describes a situation (either a failure condition or an alternative chosen by
the actor) that causes the system to exhibit somewhat different behavior.
The informal use cases presented are sometimes sufficient for requirements modeling.
However, when a use case involves a critical activity or describes a complex set of steps
with a significant number of exceptions, a more formal approach may be desirable.
The typical outline for formal use cases can be in following manner
• The goal in context identifies the overall scope of the use case.
• The precondition describes what is known to be true before the use case is initiated.
• The trigger identifies the event or condition that “gets the use case started”
• The scenario lists the specific actions that are required by the actor and the
appropriate system responses.
• Exceptions identify the situations uncovered as the preliminary use case is refined
Additional headings may or may not be included and are reasonably self-explanatory.
Every modeling notation has limitations, and the use case is no exception. A use case focuses
on functional and behavioral requirements and is generally inappropriate for nonfunctional
requirements.
Simple Use Case Diagram
CLASS-BASED MODELLING
Class-based modeling represents the objects that the system will manipulate, the
operations that will be applied to the objects to effect the manipulation, relationships
between the objects, and the collaborations that occur between the classes that are
defined. The elements of a class-based model include classes and objects, attributes,
operations, class responsibility- collaborator (CRC) models, collaboration diagrams,
and packages.
Identifying Analysis Classes
We can begin to identify classes by examining the usage scenarios developed as
part of the requirements model and performing a “grammatical parse” on the use cases
developed for the system to be built.
Specifying Attributes
Attributes describe a class that has been selected for inclusion in the
requirements model. In essence, it is the attributes that define the class—that clarify
what is meant by the class in the context of the problem space.
To develop a meaningful set of attributes for an analysis class, you should study
each use
case and select those “things” that reasonably “belong” to the class.
Defining Operations
Operations define the behavior of an object. Although many different types of
operations exist, they can generally be divided into four broad categories: (1) operations
that manipulate data in some way (e.g., adding, deleting, reformatting, selecting), (2)
operations that perform a computation, (3) operations that inquire about the state of an
object, and (4) operations that monitor an object for the occurrence of a controlling
event.
Fig : Multiplicity
Fig : Dependencies
the name of the class. In the body of the card you list the class responsibilities on the
left and the collaborators on the right.
The CRC model may make use of actual or virtual index cards. The intent is to develop
an organized representation of classes. Responsibilities are the attributes and operations
that are relevant for the class. i.e., a responsibility is “anything the class knows or does”
Collaborators are those classes that are required to provide a class with the information
needed to complete a responsibility. In general, a collaboration implies either a request
for information or a request for some action. A simple CRC index card is illustrated in
following figure.
• Boundary classes are used to create the interface that the user sees and interacts
with as the software is used. Boundary classes are designed with the
responsibility of managing the way entity objects are represented to users.
• Controller classes manage a “unit of work” from start to finish. That is,
controller classes can be designed to manage (1) the creation or update of entity
objects, (2) the instantiation of boundary objects as they obtain information
from entity objects, (3) complex communication between sets of objects, (4)
validation of data communicated between objects or between the user and the
application. In general, controller classes are not considered until the design
activity has begun.
Responsibilities: Wirfs-Brock and her colleagues suggest five guidelines for
allocating responsibilities to classes:
1. System intelligence should be distributed across classes to best address the
needs of the problem. Every application encompasses a certain degree of
intelligence; that is, what the system knows and what it can do.
2. Each responsibility should be stated as generally as possible. This
guideline implies that general responsibilities should reside high in the class
hierarchy
3. Information and the behavior related to it should reside within the same
class. This achieves the object-oriented principle called encapsulation. Data
and the processes that manipulate the data should be packaged as a cohesive
unit.
4. Information about one thing should be localized with a single class, not
distributed across multiple classes. A single class should take on the
responsibility for storing and manipulating a specific type of information. This
responsibility should not, in general, be shared across a number of classes. If
information is distributed, software becomes more difficult to maintain and more
challenging to test.
5. Responsibilities should be shared among related classes, when appropriate.
There are many cases in which a variety of related objects must all exhibit the same
behavior at the same time.
Collaborations: Classes fulfill their responsibilities in one of two ways:
1. A class can use its own operations to manipulate its own attributes, thereby
fulfilling a particular responsibility, or
2. A class can collaborate with other classes.
When a complete CRC model has been developed, stakeholders can review the
model using the following approach :
1. All participants in the review (of the CRC model) are given a subset of the CRC
model index cards. Cards that collaborate should be separated (i.e., no reviewer
should have two cards that collaborate).
2. All use-case scenarios (and corresponding use-case diagrams) should be
organized into categories.
3. The review leader reads the use case deliberately. As the review leader comes to
a named object, she passes a token to the person holding the corresponding class
index card.
4. When the token is passed, the holder of the card is asked to describe the
responsibilities noted on the card. The group determines whether one (or more)
of the responsibilities satisfies the use-case requirement.
5. If the responsibilities and collaborations noted on the index cards cannot
accommodate the use case, modifications are made to the cards. This may
include the definition of new classes (and corresponding CRC index cards) or
the specification of new or revised responsibilities or collaborations on existing
cards.
Reviewing the CRC Model
All participants in the review (of the CRC model) are given a subset of the
CRC model index cards.
Cards that collaborate should be separated (i.e., no reviewer should
have two cards that collaborate).
All use-case scenarios (and corresponding use-case diagrams) should be
organized into categories.
The review leader reads the use-case deliberately.
As the review leader comes to a named object, she passes a token to the
person holding the corresponding class index card.
When the token is passed, the holder of the class card is asked to describe the
responsibilities noted on the card.
The group determines whether one (or more) of the responsibilities
satisfies the use-case requirement.
If the responsibilities and collaborations noted on the index cards cannot
accommodate the use-case, modifications are made to the cards.
This may include the definition of new classes (and corresponding
CRC index cards) or the specification of new or revised responsibilities
or collaborations on existing cards.
Functional Modelling
The functional model addresses two application processing elements, each
representing a different level of procedural abstraction:
(1) user-observable functionality that is delivered by the app to end users, and
(2) the operations contained within analysis classes that implement behaviors
associated with the class.
A Procedural View
Allows the modeler to represent the flow of activities described by the use-
case and at the same time indicate which actor (if there are multiple actors
involved in a specific use-case) or analysis class has responsibility for the
action described by an activity rectangle.
Three analysis classes—Homeowner, Camera, and Interface—have direct or
indirect responsibilities in the context of the activity diagram
UML Sequence Diagrams
Each of the arrows represents an event (derived from a use case) and indicates
how the event channels behavior between SafeHome objects.
Time is measured vertically (downward), and the narrow vertical rectangles
represent time spent in processing an activity. States may be shown along a
vertical time line.
The first event, system ready, is derived from the external environment and
channels behavior to the Homeowner object.
Once a complete sequence diagram has been developed, all the events that
cause transitions between system objects can be collated into a set of input
events and output events (from an object).
Behavioral Modeling
The behavioral model indicates how software will respond to internal or
external events .
UML activity diagrams can be used to model how system elements
respond to internal events. UML state diagrams can be used to model how
system elements respond to external events.
To create the model, the analyst must perform the following steps:
• Evaluate all use-cases to fully understand the sequence of
interaction within the system.
• Identify events that drive the interaction sequence and
understand how these events relate to specific objects.
• Create a sequence for each use-case.
• Build a state diagram for the system.
• Review the behavioral model to verify accuracy and
consistency.
Behavioral Modeling
1. make a list of the different states of a system (How does the system behave?)
2. indicate how the system makes a transition from one state to another (How
does the system change state?)
a. indicate event
b. indicate action
3. draw a state diagram or a sequence diagram or activity diagram