Unit 02 (C)
Unit 02 (C)
A software engineer or analyst defines all data objects that are processed
within the system, the relationships between the data objects, and other
information that is pertinent(relevent) to the relationships.
The description of the data object incorporates the data object and all of its
attributes.
Data attributes define the properties of a data object and take on one of three
different characteristics. They can be used to
(1) name an instance of the data object, (2) describe the instance, or (3) make
reference to another instance in another table.
the identifier attribute becomes a “key” when we want to find an instance of the
data object.
In some cases, values for the identifier(s) are unique, although this is not a
requirement.
DATA MODELING CONCEPTS
❑ Relationships :
A connection is established between person and car because the two objects
are related.
But what are the relationships? To determine the answer, you should
understand the role of people (owners, in this case) and cars within the context
of the software to be built.
You can establish a set of object/relationship pairs that define the relevant
relationships. For example
manipulation,
the collaborations that occur between the classes that are defined.
CLASS-BASED MODELING
The elements of a class-based model include
attributes,
operations,
class responsibility,
collaborator
(CRC) models,
packages
CLASS-BASED MODELING
❑ Identifying Analysis Classes:
Things (e.g., reports, displays, letters, signals) that are part of the information
domain for the problem.
Places (e.g., manufacturing floor or loading dock) that establish the context of
the problem and the overall function of the system.
CLASS-BASED MODELING
❑ Identifying Analysis Classes:
Attributes are the set of data objects that fully define the class within the
context of the problem.
Attributes describe a class that has been selected for inclusion in the
requirements model.
(4) operations that monitor an object for the occurrence of a controlling event.
CRC modeling provides a simple means for identifying and organizing the
classes that are relevant to system or product requirements.
One purpose of CRC cards is to fail early, to fail often, and to fail
inexpensively.
Along the top of the card you write the name of the class.
In reality, 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. simply, 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.
Entity classes, also called model or business classes, are extracted directly
from the statement of the problem These classes typically represent things
that are to be stored in a database and persist throughout the duration of
the application.
Boundary classes are used to create the interface (e.g., interactive screen
or printed reports) that the user sees and interacts with as the software is
used. Entity objects contain information that is important to users, but
they do not display themselves. Boundary classes are designed with the
responsibility of managing the way entity objects are represented to users.
CLASS-BASED MODELING
Classes :
Controller classes manage a “unit of work” from start to finish. That is,
controller classes can be designed to manage
(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.
CLASS-BASED MODELING
Responsibilities :
Information and the behavior related to it should reside within the same
class.
Information about one thing should be localized with a single class, not
distributed across multiple classes.
1) A class can use its own operations to manipulate its own attributes,
thereby fulfilling a particular responsibility, or
All participants in the review are given a subset of the CRC model index
cards. Cards that collaborate should be separated
When the token is passed, the holder of the Sensor card is asked to describe
the responsibilities noted on the card.
CLASS-BASED MODELING
Collaborations :
When the token is passed, the holder of the Sensor card is asked to describe
the responsibilities noted on the card.
This continues until the use case is finished. When all use cases have been
In many instances, two analysis classes are related to one another in some
fashion, much like two data objects may be related to one another. In
UML these relationships are called associations.
Bank have Branch The bank should have at least one branch.
1 1..*
CLASS-BASED MODELING
❑ Analysis Packages:
Class modeling is used to specify the structure of the objects, classes, or components that exist
in the problem domain or system.
Class diagram provides a graphic notation for modeling classes and their relationships.
An object is a concept, abstraction, or thing with an identity that has meaning for an
application.
Class diagrams represent an overview of the system like classes, attributes, operations, and
relationships.
ELEMENTS OF CLASS DIAGRAM (CLASS NAME)
Account is an abstract class and saving account and the current account is a subclass of Account.
Abstract class
italic font
Account
Normal class
non italic font
SavingAccount CurrentAccount
ELEMENTS OF CLASS DIAGRAM (ACCESS MODIFIERS)
Public (+): Member accessible by all classes, whether these classes are in
the same package or in another package.
The UML notation is to list operations in the third compartment of the class box.
Class
Name The operation name in the regular face, left align the name in the box, and use a
Attributes lowercase letter for the first character.
Operations Optional detail, such as an argument list and result type, may follow each operation
name.
+ changePhoneNumber(phoneNumber:String):int
GENERALIZATION & SPECIALIZATION
Generalization is the process of extracting Vehical
shared characteristics from two or more + no of wheels:int
classes and combining them into a
+start() : void
generalized superclass +stop() : void
+applyBreak() : void
Specialization
Shared characteristics can be attributes or
Generalization
+refilllFule() : int
methods.
Represents an "is-a" relationship
For example, a car is a vehicle and a truck
is a vehicle. In this case, vehicle is the
general thing, whereas car and truck are the Car Truck
more specific things.
Specialization is the reverse process of +parkAtHome() : void + loadGoods() : void
Generalization means creating new + unloadGoods() : void
sub-classes from an existing class.
GENERALIZATION & SPECIALIZATION
For example in a bank, any
Customer opens an account. Account
+ accountNo:long
The account can be either a + balance:double
+debitAmount(amount:double): void
savings account or a current +creditAmount(amount:double) : int
+getBalance(accountNo:long) : double
account. In saving account,
customer earns fixed interest
on the deposit. But this SavingAccount CurrentAccount
+ interestRate:double
facility is not available in the + isTransactionLimitOut(accountNo:long) : int
current account.
LINK AND ASSOCIATION CONCEPTS
Link and associations are the means for establishing relationships among objects and
classes.
Aggregation and Composition are the two forms of association. It is a subset of association.
Means they are specific cases of association. In both aggregation and composition object of
one class "owns" object of another class, but there is a minor difference.
AGGREGATION
Aggregation is a subset of association. it is a collection of
different things.
It is more specific than an association.
* 1..*
ATM Branch Account
- location : string manage - branchName : string 1 have 1..* ~ accountNumber: string
- manageBy: string * * - branchCode: string - balance: number
+transaction(); + manageAccount():void +debitAmount(amount:double): void
+ transaction():init 1..2 +creditAmount(amount:double) : int
*
* +getBalance(accountNo:long) : double
e
tra
ag
an
ns
ve
ac
m
ha
tio
*
n
Customer
- name: string 1 CurrentAccount SavingAccount
- address: string
* - dob: date - interestRate:double
- panNumber: string + isTransactionLimitOut(accountNo:long) :
+ manageAccount():void int
+ transaction():init
REQUIREMENTS MODELING
(FLOW, BEHAVIOR, PATTERNS AND WEBAPPS)
The requirements model has many different dimensions.
the special requirements analysis considerations that come into play when
WebApps are developed.
Each of these modeling representations supplements the use cases, data models,
and class based models.
FLOW-ORIENTED MODELING
Although the data flow diagram (DFD) and related diagrams and information are
not a formal part of UML, they can be used to complement UML diagrams
and provide additional insight into system requirements and flow.
Subsequent data flow diagrams refine the context diagram, providing increasing detail
with each subsequent level.
FLOW-ORIENTED MODELING
Creating a Data Flow Model: The data flow diagram enables you to develop models
of the information domain and functional domain.
As the DFD is refined into greater levels of detail, you perform an implicit functional
decomposition of the system.
(1) the level 0 data flow diagram should depict the software/system as a single bubble;
(3) refinement should begin by isolating candidate processes, data objects, and data
stores to be represented at the next level;
(4) all arrows and bubbles should be labeled with meaningful names;
FLOW-ORIENTED MODELING
(5) information flow continuity must be maintained from level to level,2 and
(6) one bubble at a time should be refined. There is a natural tendency to overcomplicate the data
flow diagram. This occurs when you attempt to show too much detail too early or represent
procedural aspects of the software in lieu of information flow.
Creating a Control Flow Model: For some types of applications, the data model and the
data flow diagram are all that is necessary to obtain meaningful insight into software
requirements.
However, a large class of applications are “driven” by events rather than data, produce control
information rather than reports or displays, and process information with heavy concern for
time and performance.
Such applications require the use of control flow modeling in addition to data flow modeling.
FLOW-ORIENTED MODELING
An event or control item is implemented as a Boolean value (e.g., true or false,
on or off, 1 or 0) or a discrete list of conditions (e.g., empty, jammed, full).
Recalling the noun/verb parse that was applied to the processing narrative,
review all “control items” as possible control specification inputs/outputs.
FLOW-ORIENTED MODELING
To select potential candidate events, the following guidelines are suggested:
Describe the behavior of a system by identifying its states, identify how each
state is reached, and define the transitions between states.
Figure 7.4 depicts a preliminary state diagram for the level 1 control flow model
for SafeHome.
FLOW-ORIENTED MODELING
FLOW-ORIENTED MODELING
The Process Specification: The PSPEC is a “minispecification” for each
transform at the lowest refined level of a DFD.
The process specification (PSPEC) is used to describe all flow model processes
that appear at the final level of refinement.
The content of the process specification can include narrative text, a program
design language (PDL) description of the
The behavioral model indicates how software will respond to external events or stimuli.
1. Evaluate all use cases to fully understand the sequence of interaction within the
system.
2. Identify events that drive the interaction sequence and understand how these events
relate to specific objects.
The use case represents a sequence of activities that involves actors and the system.
In general, an event occurs whenever the system and an actor exchange information. A
use case is examined for points of information exchange.
An actor should be identified for each event; the information that is exchanged should be
noted, and any conditions or constraints should be listed.
Once all events have been identified, they are allocated to the objects involved.
Objects can be responsible for generating events or recognizing events that have occurred
elsewhere.
CREATING A BEHAVIORAL MODEL
State Representations: In the context of behavioral modeling, two different
characterizations of states must be considered:
(1) The state of each class as the system performs its function and
(2) The state of the system as observed from the outside as the system performs its
function.
The active state of an object indicates the current status of the object as it undergoes a
continuing transformation or processing.
An event (sometimes called a trigger) must occur to force an object to make a transition
from one active state to another.
CREATING A BEHAVIORAL MODEL
State Representations:
Two different behavioral representations are discussed in the paragraphs that follow.
1) The first indicates how an individual class changes state based on external events
The state diagram is a standard computer science concept that relates events and state.
All objects in a class execute the state diagram for that class, which models their common behavior.
The UML notation for a state diagram is a rectangle with object name in a small pentagonal tag in the
upper left corner.
COMPONENTS OF STATE DIAGRAM
Initial State
A solid circle with an outgoing arrow shows the initial state.
Final State OR
A bull’s eye – a solid circle surrounded by a hollow circle/encircled X
shows the termination point.
State
State
Drawn as a rounded box containing the name of the state.
State names must be unique within the scope of the state diagram.
Our convention is to list state name in boldface, center the name near the top of the box, and
capitalize the first letter.
event(attribs) [condition]
Transition/Event
Step 2: Identify the possible states in which the object can exist.
Step 3: Identify the initial state and the final terminating states.
– Available
– Issue
– Return
– Renew
EXAMPLE: STATE DIAGRAM OF BANK AUTOMATED TELLER
MACHINE (ATM)
This is an example of UML behavioral state diagram showing Bank Automated Teller Machine
(ATM) top level state machine.
ATM is initially turned off. After the power is turned on, ATM performs startup action and enters
Self Test state.
If the test fails, ATM goes into Out of Service state, otherwise there is trigger less transition to the
Idle state. In this state ATM waits for customer interaction.
The ATM state changes from Idle to Serving Customer when the customer inserts banking or credit
card in the ATM's card reader.
On entering the Serving Customer state, the entry action readCard is performed.
Note, that transition from Serving Customer state back to the Idle state could be triggered by cancel
event as the customer could cancel transaction at any time.
Serving Customer state is a composite state with sequential substates Customer Authentication,
Selecting Transaction and Transaction.
STATE DIAGRAM OF BANK AUTOMATED TELLER
MACHINE (ATM)
Bank ATM
turn off / turn off /
shut-down off shut-down
startup
turn on
/
successfully Self failure
Test
turn on
restart
/
failure
service Maintenanc Out of
Idle
e Service
service
cancel
Customer
Selecting
Authenticatio Transaction
Transaction
n
CREATING A BEHAVIORAL MODEL
State Representations:
Sequence diagrams. The second type of behavioral representation, called a sequence diagram in
UML, indicates how events cause transitions from object to object.
Once events have been identified by examining a use case, the modeler creates a sequence
diagram—a representation of how events cause flow from one object to another as a function of
time.
It represents key classes and the events that cause behavior to flow from class to class.
Figure 7.7 illustrates a partial sequence diagram for the SafeHome security function.
CREATING A BEHAVIORAL MODEL
SEQUENCE DIAGRAM
A sequence diagram shows the interaction of a system with its actors to perform
all or part of a use case.
Each use case requires one or more sequence diagram to describe its behavior.
Each sequence diagram shows a particular behavior sequence of the use case.
It is best to show a specific portion of a use case and not attempt to be too general.
Lifeline
Synchronous message
Represented by a solid line with a solid arrowhead.
This symbol is used when a sender must wait for a response to a message before it
continues.
The diagram should show both the call and the reply.
Asynchronous message
Represented by a solid line with a lined arrowhead
Asynchronous messages don't require a response before the sender continues.
Only the call should be included in the diagram.
CONT.
Reply message
Delete message X
Step-2 Identify the necessary set of the objects. Who is taking part ?