Chapter 5
Chapter 5
Chapter 5
1
Outline
– Introduction
– An overview of Analysis
– Analysis concepts and activities
• Entity, boundary and Control objects
• Association Multiplicity, Qualified Associations,
Generalization.
• Identifying Entity objects, Boundary objects,
Control objects
• Modeling interaction between objects
• Identifying Associations and Attributes
2
Introduction...
3
Introduction...
7
Analysis Concepts
• In this section, we describe the main analysis
concepts used in this chapter. In particular, we
describe:
– Association
– Multiplicity Have already been discussed in
modelling with UML.
– Generalization.
8
Entity, Boundary, and Control Objects
10
Analysis Activities: From Use Cases to Objects
• In this section, we describe the activities that transform the use cases
and scenarios produced during requirements elicitation into an
analysis model.
12
Identifying Entity Objects...
14
Identifying Entity Objects...
– FieldOfficer also describes possible responses to
the emergency situation.
– Once the form is completed, the FieldOfficer
submits the form, at which point the Dispatcher is
notified.
– The Dispatcher reviews the submitted information
and creates an Incident in the database by invoking
the OpenIncident use case.
– The Dispatcher selects a response and
acknowledges the emergency report.
– The FieldOfficer receives acknowledgment.
– The Usecase ends.
15
16
Identifying Entity Objects...
• Heuristics for identifying initial analysis objects:
17
Identifying Objects…
18
Identifying Entity Objects...
Some of the entity objects for ReportEmergeny use
case are:
• Dispatcher -- Police officer who manages Incidents.
A Dispatcher opens documents, and closes Incidents
in response to EmergencyReports.
• EmergencyReport-- Initial report about an Incident
from a FieldOfficer to a Dispatcher.
An EmergencyReport usually triggers the creation of
an Incident by the Dispatcher.
• FieldOfficer-- Police or fire officer on duty.
• Incident -- Situation requiring attention from a
FieldOfficer.
19
Identifying Boundary Objects
• Boundary objects represent the system interface with the actors.
• The boundary object collects information from the actor and
translates it into an interface that can be used by the entity
objects and also by the control objects.
20
Identifying Boundary Objects...
• These are some of boundary objects by examining the
ReportEmergency use case:
AcknowledgmentNotice - Notice used for displaying
the Dispatcher’s acknowledgment to the FieldOfficer.
DispatcherStation - Computer used by the Dispatcher.
ReportEmergencyButton- Button used by a
FieldOfficer to initiate the ReportEmergency use case.
ReportEmergencyForm- Form used for the input of the
ReportEmergency form.
FieldOfficerStation - Mobile computer used by the
FieldOfficer.
21
Identifying Control Objects
22
A control object is usually created at the
beginning of a use case and ceases to exist at its end.
23
Identifying control objects…
24
ReportEmergencyControl - Manages the report
emergency reporting function on the FieldOfficerStation.
– This object is created when the FieldOfficer selects the
“Report Emergency” button.
– It then creates an EmergencyReportForm and presents it
to the FieldOfficer.
25
Modelling Interactions Between Objects
Sequence Diagrams
• A sequence diagram ties use cases with objects.
– It shows how the behaviour of a use case (or scenario) is
distributed among its participating objects.
26
Modelling Interactions Between Objects
Sequence Diagrams...
27
Sequence diagram for the ReportEmergency use case
(initiation from the FieldOfficerStation side).
28
Sequence diagram for the ReportEmergency use case
(DispatcherStation).
29
Sequence diagram for the ReportEmergency use case
(acknowledgment on the FieldOfficerStation).
30
Heuristics for drawing sequence diagrams:
31
Modelling Interactions Between Objects
Sequence Diagrams...
• A name, to describe the association between the two classes (e.g., Writes)
• A role at each end, identifying the function of each class with respect to the
associations (e.g., author is the role played by FieldOfficer in the Writes
association).
• A multiplicity at each end, identifying the possible number of instances
e.g.,
- * indicates a FieldOfficer may write zero or more
EmergencyReports.
- 1 indicates that each EmergencyReport has exactly one FieldOfficer
as author.
34
Identifying Attributes
• Attributes are properties of individual objects.
• When identifying properties of objects, only the attributes relevant to the
system should be considered.
• For example,
• FieldOfficers are identified by badge number, represented by the
badgeNumber property.
36
Modelling the Behaviour of Individual Objects
38
Modelling Generalization Relationships Between Objects
39
• FieldOfficers and Dispatchers are both
PoliceOfficers who are assigned different functions.
• To model explicitly this similarity, we introduce an
abstract PoliceOfficer class from which the
FieldOfficer and Dispatcher classes inherit.
fig: An example of
inheritance relationship
(UML class diagram).
40
OO Analysis Summary
• The requirements activity is highly iterative and
incremental.
• Chunks of functionality are sketched and proposed to
the users and the client.
• The client may add:
- additional requirements
- criticizes existing functionality
- modifies existing requirements.
41
Analysis activities (UML activities diagram)
42
Managing Analysis
43
Documenting Analysis
• requirements elicitation and analysis activities are
documented in the Requirements Analysis
Document (RAD)
44
Assigning Responsibilities
• Analysis requires the participation of a wide range of
stakeholders.
• User:
– provides application domain knowledge
– generates information about the
• current system,
• environment of the future system, and
• the tasks it should support
• Client:
– funds the project and coordinates the user side of the effort
– serves as an integrator of application domain information and resolves
inconsistencies in user expectations
– defines the scope of the system based on user requirements
• Analyst:
– Elicits/extracts application domain knowledge and formalizes it.
– models the current system and generates information about the future
system 45
Assigning Responsibilities…
• Architect:
– plays the role of integration, unifies the use case and object models from
a system point of view
– provide a system model and identify missing informations (tasks,
behaviors, objects) in the requirements
• Developers:
– provide feedback on feasibility and cost
47
Communicating about Analysis
• communicating information is most challenging during
requirements elicitation and analysis
– Different background of participants
– Different expectations of stakeholders
– New teams
• team members must learn how to work together
– Existed system
• team members have experience working together
49
Iterating Over the Analysis Model
• Analysis occurs iteratively and incrementally, often
in parallel with other development activities such
as
– system design and
– implementation
• Unrestricted modification and extension of the
analysis model can only result in confusion
• Iterations and increments need to be carefully
managed, otherwise it will enter into infinite list of
interests/ requirments
50
Exercise/Quiz
Software System for Library Management System
Possible requirements
The librarian can use the system in four ways. Firstly it is
possible to add a new book to the system. Secondly, if a
book is out of loan, it is possible for the librarian to make a
reservation for a customer. It should also be possible to
loan books. Finally, a librarian should also be able to
return a book to the system when a customer hands a
previously borrowed book in. Before performing anyone of
the above operation, librarian should login to the system.
Students and staff members can borrow books.
51
Exercise/Quiz
Software System for Library Management
System
Requirements elicitation activities:
• identifying actors
• identifying scenarios
• identifying use cases
• identifying relationships among use cases
• identifying initial participating objects (class diagram)
• identifying non-functional requirements
• Sequence diagram for one use case
• State chart diagram for one object (Book)
52
Library System: UML use case diagram
53
Library System: UML class diagram
• From the problem description and use case diagrams it is easy
to identify the objects involved in the system: The library, the
books, and the librarian, and login service.
• We specify the objects by specifying the classes with their
attributes and services (methods) they provide.
• In UML this is done by a class diagram. This diagram also
includes specifications of relations between the objects.
• The next class diagram shows the four classes Book, Library,
LoginService and Librarian and how they are related to each
others.
• Internal attributes and methods are also shown in the figure.
54
Library System: UML class diagram
55
Library System: UML sequence diagram for loan book use case
56
Library System: UML state chart diagram
57
Exercise: Analyze class Model for Bank Accounts Management System
58
Exercise: Analyze class Model for OCBank System
• This system provides the basic services to manage bank accounts at a bank called
OCBank. OCBank has many branches, each of which has an address and branch
number. A client opens accounts at a branch. Each account is uniquely identified
by an account number; it has a balance and a credit or overdraft limit. There are
many types of accounts, including: A mortgage account (which has a property as
collateral), a chequing account, and a credit card account (which has an expiry
date and can have secondary cards attached to it). It is possible to have a joint
account (e.g. for a husband and wife). Each type of account has a particular
interest rate, a monthly fee and a specific set of privileges (e.g. ability to write
cheques, insurance for purchases etc. OCBank is divided into divisions and
subdivisions (such as Planning, Investments and Consumer), the branches are
considered subdivisions of the Consumer Division. Each division has a manager
and a set of other employees. Each customer is assigned a particular employee as
his or her ‘personal banker’.
Marking nouns: potentially good classes, definitely bad classes,
and classes we are unsure about 59
Exercise: Analyze class Model for Bank Accounts
Management System
Client
1..2
accountHolder
Draft Class Diagram with classes Client
and Account, and their association
*
Account
accountNumber
type
x60
Exercise: Analyze class Model for OCBank System
*
Account
accountNumber
openedDate
closedDate
interestRate
monthlyFee
balance
creditOrOverdraftLimit
61
Exercise: Analyze class Model for OCBank System
Client
Draft Class Diagram with * 1..2
accountHolder
CreditCard and attributes of
Account subclasses
*
Account
accountNumber
openedDate
closedDate
interestRate
monthlyFee
balance CreditCard
creditOrOverdraftLimit
name
1..*
62
Exercise: Analyze class Model for OCBank System
Classes Associations Attributes Generalizations
• This system provides the basic services to manage bank accounts at a bank
called OCBank. OCBank has many branches, each of which has an address
and branch number. A client opens accounts at a branch. Each account is
uniquely identified by an account number; it has a balance and a credit or
overdraft limit. There are many types of accounts, including: A mortgage
account (which has a property as collateral), a chequing account, and a credit
card account (which has an expiry date and can have secondary cards attached
to it). It is possible to have a joint account (e.g. for a husband and wife). Each
type of account has a particular interest rate, a monthly fee and a specific set
of privileges (e.g. ability to write cheques, insurance for purchases etc.
OCBank is divided into divisions and subdivisions (such as Planning,
Investments and Consumer), the branches are considered subdivisions of the
Consumer Division. Each division has a manager and a set of other
employees. Each customer is assigned a particular employee as his or her
‘personal banker’. 63
Exercise: Analyze class Model for OCBank System
Employee Client
* 1..2
Draft Class Diagram with personalBanker accountHolder
64
Exercise: Analyze class Model for OCBank System
Classes Associations Attributes Generalizations
• This system provides the basic services to manage bank accounts at a bank
called OCBank. OCBank has many branches, each of which has an address
and branch number. A client opens accounts at a branch. Each account is
uniquely identified by an account number; it has a balance and a credit or
overdraft limit. There are many types of accounts, including: A mortgage
account (which has a property as collateral), a chequing account, and a credit
card account (which has an expiry date and can have secondary cards attached
to it). It is possible to have a joint account (e.g. for a husband and wife). Each
type of account has a particular interest rate, a monthly fee and a specific set
of privileges (e.g. ability to write cheques, insurance for purchases etc.
OCBank is divided into divisions and subdivisions (such as Planning,
Investments and Consumer), the branches are considered subdivisions of the
Consumer Division. Each division has a manager and a set of other
employees. Each customer is assigned a particular employee as his or her
‘personal banker’. 65
Exercise: Analyze class Model for OCBank System
worksFor
subdivision
*
OrganizationalUnit 0..1
manager
0..1 *
0..1
Employee Client
* 1..2
personalBanker accountHolder
Branch
* *
Account
accountNumber
openedDate
closedDate
Draft Class Diagram interestRate
monthlyFee
with
balance CreditCard
creditOrOverdraftLimit
name
OrganizationalUnit 1..*
x66
Exercise: Analyze class Model for OCBank System
Classes Associations Attributes Generalizations
• This system provides the basic services to manage bank accounts at a bank
called OCBank. OCBank has many branches, each of which has an address
and branch number. A client opens accounts at a branch. Each account is
uniquely identified by an account number; it has a balance and a credit or
overdraft limit. There are many types of accounts, including: A mortgage
account (which has a property as collateral), a chequing account, and a credit
card account (which has an expiry date and can have secondary cards attached
to it). It is possible to have a joint account (e.g. for a husband and wife). Each
type of account has a particular interest rate, a monthly fee and a specific set
of privileges (e.g. ability to write cheques, insurance for purchases etc.
OCBank is divided into divisions and subdivisions (such as Planning,
Investments and Consumer), the branches are considered subdivisions of the
Consumer Division. Each division has a manager and a set of other
employees. Each customer is assigned a particular employee as his or her
‘personal banker’. 67
Exercise: Analyze class Model for OCBank System
Classes Associations Attributes Generalizations
• This system provides the basic services to manage bank accounts at a bank
called OCBank. OCBank has many branches, each of which has an address
and branch number. A client opens accounts at a branch. Each account is
uniquely identified by an account number; it has a balance and a credit or
overdraft limit. There are many types of accounts, including: A mortgage
account (which has a property as collateral), a chequing account, and a credit
card account (which has an expiry date and can have secondary cards attached
to it). It is possible to have a joint account (e.g. for a husband and wife). Each
type of account has a particular interest rate, a monthly fee and a specific set
of privileges (e.g. ability to write cheques, insurance for purchases etc.
OCBank is divided into divisions and subdivisions (such as Planning,
Investments and Consumer), the branches are considered subdivisions of the
Consumer Division. Each division has a manager and a set of other
employees. Each customer is assigned a particular employee as his or her
‘personal banker’. 68
Exercise: Analyze class Model for OCBank System
worksFor
subdivision
*
OrganizationalUnit 0..1
manager
0..1 *
0..1
AccountType Employee Client
* 1..2
interestRate personalBanker
monthlyFee accountHolder
checksAllowed
insuranceAvailable
Branch *
* *
Account
accountNumber
openedDate
closedDate
interestRate
monthlyFee
Draft Class Diagram balance
creditOrOverdraftLimit
CreditCard
Person
subdivision name
*
OrganizationalUnit 0..1
manager
0..1 *
0..1
AccountType Employee Client
* 1..2
interestRate personalBanker
monthlyFee accountHolder
checksAllowed
insuranceAvailable
periodicFee
period
Branch *
* *
address Account
number accountNumber
openedDate
x70
Company database
• The company is organized into departments. Each department has a unique
name, a unique number and a particular employee who manages the
department. We keep track of the start date when that employee began
managing the department. A department may have several locations.
• A department controls a number of projects, each of which has a unique
name, a unique number and a single location.
• An Employee can be Technician, Engineer, or typist.
• An Employee can also be salaried employee or hourly pay. employee
• We store each employee’s name, Social Security number, address, salary, sex
and birth date. An employee is assigned to one department but may work on
several projects, which are not necessarily controlled by the same
department. We keep track of the number of hours per week that an
employee works on each project. We also keep track of the direct supervisor
of each employee.
• A project can be Hydropower, Wind, and Solar Energy.
72