CBOP3103 - Object-Oriented Approach in Software Development (V Feb 2011)
CBOP3103 - Object-Oriented Approach in Software Development (V Feb 2011)
OBJECT–ORIENTED
APPROACH
IN SOFTWARE
DEVELOPMENT
Karin Kolbe
Dr Geoffrey Phipps
Project Directors: Prof Dr Mansor Fadzil
Prof Dr Muhammed Yusoff
Open University Malaysia
Coordinator: Dr S L Chung
OUHK
Adapted for
Open University Malaysia by: Nantha Kumar Subramaniam
Faculty of Information Technology and
Multimedia Communication, OUM
All rights reserved. No part of this work may be reproduced in any form or by any means without
the written permission of the President, Open University Malaysia (OUM).
INTRODUCTION
CBOP3103 Object-Oriented Approach in Software Development is one of the
courses offered by Faculty of Information Technology and Multimedia
Communication at Open University Malaysia (OUM). This course is worth 3
credit hours and should be covered over 8 to 15 weeks.
STUDY SCHEDULE
It is a standard OUM practice that learners accumulate 40 study hours for every
credit hour. As such, for a three-credit hour course, you are expected to spend 120
study hours. Table 1 gives an estimation of how the 120 study hours could be
accumulated.
x X COURSE GUIDE
STUDY
STUDY ACTIVITIES
HOURS
Online Participation 12
Revision 15
LEARNING OUTCOMES
At the end of this course, you should be able to:
COURSE SYNOPSIS
This course is divided into 5 topics. The synopsis for each topic is presented
below:
Topic 2 we closely examine who the users of the system will be. We will study
approaches to ascertaining and capturing the requirements for the system.
Topic 3 is the first of four units devoted to various aspects of object modelling.
Specifically, Topic 3 is about determining the correct objects for a system.
Topic 4 looks more closely at the requirements of the system and adds this
information to our models.
Topic 5 is about designing the messages that are sent between objects. In
addition, you will also learn about inheritance in detail and other related
concepts. The principles of good object-oriented design will be last section of this
topic.
There will be a number of additional „short‰ readings for certain topics as shown
in the table below. These readings are provided as part of your course package in
myVLE.
Topic Reading
Topic 1 ă
Topic 2 Reading 2.1 ă Reading 2.6
Topic 3 Reading 3.1 ă Reading 3.10
Topic 4 ă
Topic 5 Reading 5.1 ă Reading 5.3
It is compulsory for the students to read these readings as it will give them a solid
understanding of the particular concepts related to the course. These readings is
part of the syllabus. Hence, it can be tested for the tests and final examination.
xii X COURSE GUIDE
Learning Outcomes: This section refers to what you should achieve after you
have completely gone through a topic. As you go through each topic, you should
frequently refer to these learning outcomes. By doing this, you can continuously
gauge your progress of digesting the topic.
Summary: You can find this component at the end of each topic. This component
helps you to recap the whole topic. By going through the summary, you should
be able to gauge your knowledge retention level. Should you find points inside
the summary that you do not fully understand, it would be a good idea for you to
revisit the details from the module.
Key Terms: This component can be found at the end of each topic. You should go
through this component to remind yourself of important terms or jargons used
throughout the module. Should you find terms here that you are not able to
explain, you should look for the terms from the module.
COURSE GUIDE W xiii
ASSESSMENT METHOD
Please refer myVLE.
Case studies are a useful and increasingly popular form of learning and
assessment in the OUMÊs Faculty of Information Technology & Multimedia
Communication. Please read Apendix 1 which will look at why case studies are
used and then suggest some learning strategies that you can use to approach case
studies. We will also briefly discuss some problems that you may encounter as
you learn from case studies.
CONCLUSION
Design is difficult. Good design is even more difficult, and requires practice and
time. Unlike accounting, there is often more than one correct answer. If you ask
your tutor questions, they may frequently answer with Âit dependsÊ. This can be
very frustrating at first, but with the repeated practice involved in the case study,
self-tests and tutorials, you should gain confidence, and, we hope, enjoy the
course. Good luck!
xiv X COURSE GUIDE
INTRODUCTION
Welcome to Topic 1 of the course CBOP3103 - Object Oriented Approach in
Software Development. This topic is an introduction to the whole course. We
will begin with the most important concept: what is an object? It is very
important for you to understand the concept of object. Later we will see how
object is related to a class.
At the basic level, an object is a set of data together with some operations that can
be performed on that data. An example of an object is a bank account. The data
consists of the account number, the name of the account and the branch where
the account is held. Operations that can be performed on a bank account include
2 TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT
DonÊt worry if youÊre not sure what these are, as itÊs unlikely that you will need
to deal with them these days especially in large system/software development
projects. The important thing to note is that these models separate the data and
the process or functions that were done on the data throughout all the analysis
and design processes. The resulting systems were generally hard to maintain
over time. One reason that maintenance was hard was that all the data and
processing relating to one entity could be spread throughout the system, so a
change required a lot of work. For example, say we wanted to change the
employee ID field from six to eight digits. This would mean looking at every
screen or report to see what the impact would be. The Year 2000 problem is
another example where date-based calculations were spread throughout a
system, each needing to be manually checked. From all these models the
programs were then written.
Later in this topic and later in this course you will see that object-oriented
modelling keeps the data and processes together.
As you will see, one of the key characteristics of object-oriented systems design is
that it uses an iterative SDLC.
From the results of the tests we may need to make changes. Once we are satisfied
that everything is working well, we then add some more functionality and repeat
the whole process. Each iteration may either improve or add some functionality.
EXERCISE 1.1
Take the organization where you work as an example. What is the role of
IT in the organization? What IT applications can be categorized as
ÂsupportÊ? What IT applications can be categorized as Âenabling businessÊ?
Talk to the IT personnel in your organization to find out about the different
uses of IT in these two categories. Post a summary of your findings on the
myLMS discussion board. Compare your findings with your coursemates.
There are few important terms to object orientation that are explained in this section:
(i) class and object
(ii) encapsulation of data and methods
(iii) support for polymorphism
(iv) inheritance within class hierarchies.
(v) object interface
A class is a blueprint that defines the variables (or attributes) and the methods
common to all objects of a certain kind. In the real world, we often have many
objects of the same kind. For example, your car is just one of many cars in the
world. In object-oriented context, we say that your car object is an instance of the
class of objects known as cars. Cars have some state (current gear, current speed,
four wheels) and behavior (change gears, change speed) in common. However,
each car's state is independent of and can be different from that of other cars.
When building them, manufacturers take advantage of the fact that cars share
characteristics, manufacturing many cars from the same blueprint. It would be
very inefficient to produce a new blueprint for every car manufactured. In object-
oriented software, it's also possible to have many objects of the same kind that
share characteristics: employee records, video clips, students record and so on.
Like car manufacturers, you can take advantage of the fact that objects of the
same kind are similar and you can create a blueprint for those objects.
TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT 7
Object
Explanation
Characteristic
State Each object has properties that collectively represent the state. State can
have dynamic values or permanent values. Examples of state that are
dynamic are total money in the machine, number of can drinks that
are not yet sold, age, etc. Examples of permanent state which does not
change are name, birth date, etc. In programming, state are
represented by attributes.
Behaviour Object behavior is an objectÊs response when the object receives a message.
There are probably two types of actions that occurs which change the state
of the object that receives the message or the state of the object that sends
the message.
Example: Consider the vending machine object. One of the messages that
it probably receives is: release the can drink selected by the buyer. This
message will be sent to the vending machine when the buyer pushes a
button on the machine. The message received causes the object to show a
behavior, that is drink can selected by the buyer is released. Besides
showing behavior, an object can also send messages to other objects in
response to a received message.
There is a close relationship between behavior and state. An objectÊs
behavior is influenced by the objectÊs state. For example, assume that the
number of cans in the machine is zero, that is all the cans in the machine
are sold out. If the machine received the message to release a can drink,
the object certainly cannot fulfill this request because of its state where the
number of cans is zero. In programming, methods is used to define the
behaviors that an object can perform.
Identity Identity is the property that distinguishes an object from all other
objects. Each objects has their own unique identity. For example, a
group of student objects could be identified with their unique identity
such as StudentA, StudentB, studentC, etc.
8 TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT
You are entering a restaurant. After going through the menu, you ordered a plate
of fried rice from the server. Then, the server will go straight to the kitchen to
convey your order to the cook. After ten minutes, the server will come back to
you with the food you have ordered‰.
In the above scenario, you donÊt bother how the fried rice has been cooked. You
just want the fried rice to be served. This is an example of encapsulation.
Encapsulation is the term given to the process of hiding all the details of an object
that do not contribute to its essential characteristics. Encapsulation hides the
implementation details of the object and the only thing that remains externally
visible is the interface of the object. (i.e.: the set of all messages the object can
respond to). Once an object is encapsulated, its implementation details are not
immediately accessible any more. Instead they are packaged and are only
indirectly accessible via the interface of the object. The only way to access such an
encapsulated object is via message passing: one sends a message to the object,
and the object itself selects the method by which it will react to the message,
determined by methods. All objects are associated by the list of messages
understood by them. These list of messages is collectively becomes the interface
of the object. For example, the interface for ATM machine object is all the valid
messages an user can send to it such as withdraw money, check balance, funds
transfer, etc. Invalid messages send by the user which is not part of the ATM
machine object interface will not be accepted by the object.
of inheritance greatly enhances the ability to reuse code as well as making design
a much simpler and cleaner process.
EXERCISE 1.2
Add the following labels to the diagram or the sentences below:
In later topics you will see other examples of objects, such as transactions, processes,
and calculators. In an object-oriented system, every piece or building block is an
object. Further, each object needs to fulfill exactly one purpose or role. Over the past
decade, object technology specialists have learned that systems in which this rule is
adhered to are more adaptable to change and have fewer defects.
Now we are ready to see how object-oriented technologies are applied in
application development projects. You have already encountered the iterative
SDLC. Now we are going to look at the methodologies and notations used to
develop object-oriented systems. If you need to remind yourself what these
terms refer to, review the previous section.
Phase Purpose
Inception The primary goal of the inception phase is to establish the case for the
viability of the proposed system.
Elaboration Elaboration phase is a phase where the project starts to take shape. In
this phase the problem domain analysis is made and the architecture of
the project gets its basic form.
Construction In construction the main focus goes to the development of components
and other features of the system being designed. This is the phase when
the bulk of the coding takes place.
Transition In the transition phase the product has moved from the development
organization to the end user. The activities of this phase include
training of the end users and maintainers and beta testing of the system
to validate it against the end users' expectations.
It is important for you to take note that all these phases above are subdivided
into iterations.
The following figure illustrates the changing relative effort of disciplines with
respect to the phases in UP as suggested by Larman (2002). As highlighted by
the diagram, during one iteration of a phase work are carried out in most or
all the disciplines but the relative effort across these disciplines changes over
the time. Early iterations in a phase tend to focus on requirements and
design, and later ones less so, as the requirements and design stabilize
through a process of feedback and adaptation (Larman (2002)).
You have been alerted in the beginning of this section that each disciplines
have their own artifacts. In UP, artifact is the keyword used for any work
product such as code, text documents, diagrams, etc. The artifacts chosen
for a system development project could be written up in a brief document
12 TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT
In the diagram you could see some of the common atrifacts used for the
disciplines in UP. Please take note that different software/system developmet
projects may need different artifacts. The focus of this course will be on the
disciplines of business modeling, requirements and design. So, try to remember
the artifacts used in these disciplines.
EXERCISE 1.3
The Unified Process makes extensive use of the Unified Modeling Language
(UML). At the core of the UML is the model, which in the context of a software
development process is a simplification of reality that helps the project team
understand certain aspects of the complexity inherent in software. The UML was
designed to help the participants in software development efforts build models
that enable the team to visualize the system, specify the structure and behavior of
that system, construct the system, and document the decisions made along the
way. Many of the tasks that the Unified Process defines involve using the UML
and one or more models.
Now letÊs look at the notation that is used with the UP methodology.
1.2.4 Notation
In this course we will be using the industry standard notation called Unified
Modelling Language (UML). This standard was the result of the collaboration
between three methodologists: Jim Rumbaugh, Grady Booch and Ivar Jacobson.
What they published in 1994 was an amalgamation of their own notations plus
the notations of several other authors.
UML defines standardised models and notations for expressing different aspects
of an OO design. Version 1.1 was submitted to the Object Management Group
(OMG) in 1997 and they published it as version 1.2. Version 1.4 is current. Listed
are the other versions of UML:
UML 2.0 released in July 2005
UML 2.11 released in August 2007
UML 2.12 released in November 2007 (latest version)
While this standard is not perfect for all situations, it does mean that all
practitioners are able to read each otherÊs diagrams. Most IT professionals use
only a tiny part of UML. (please refer to Figure 1.5)
14 TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT
In the next section we will briefly introduce to you some of the UML notations to
be used intensively in this course.
Source:
http://www.apl.jhu.edu/Classes/605404/stafford/oointro/process_overview/sld004.htm
Source: http://www.cs.gordon.edu/courses/cs211/ATMExample/Interactions.html
Source: http://www.comptechdoc.org/independent/uml/begin/umldcd.html
16 TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT
As you work through this course you will see how the diagrams shown in this
section fit together. Topics 2 to Topic 5 will look at these notations in detail.
You might first think that, since Fowler is quite dismissive of UML, a systems
design process that uses it canÊt be adaptive. However, UML is just a notation; it
is how it is used that counts. Fowler is discussing UML as used in a formal
methodology. You can elaborate UML to draw a twenty-page model that gets
formally reviewed. You can also use very sparse UML notation on a whiteboard
to quickly communicate a few ideas. This is quite likely to be the way itÊs used in
the UP.
Note too that there is nothing intrinsically iterative about object orientation. The
two approaches work very well together, but you could do non-object orientation
development iteratively, as you can also do object-oriented development non-
iteratively.
So while the concepts of heavy and light methodologies, predictive and adaptive
processes are useful for understanding processes, you have to be careful not to
take them too far.
EXERCISE 1.4
Traditional Object-oriented
Approach to data and Consider separately
functions
System development life Waterfall
cycle (SDLC)
TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT 17
During object oriented analysis, the emphasis is on finding the objects- or concepts
ă in the problem domain. For example, in the case of the Library Information
System, some of the concepts include Book, Library and Patron. Object-Oriented
Analysis (OOA), then, is the process of defining the problem in terms of objects:
real-world objects with which the system must interact, and candidate software
objects used to explore various solution alternatives. The natural fit of
programming objects to real-world objects has a big impact here: you can define all
of your real-world objects in terms of their classes, attributes, and operations.
During object oriented design, the emphasis is on defining software objects and
how they collaborate to fulfill the requirements. For example, in the case of the
Library Information System, a Book software object may have a title attribute and
a getChapter method. Object-Oriented Design (OOD), then, is the process of
defining the components, interfaces, objects, classes, attributes, and operations
that will satisfy the requirements. You typically start with the candidate objects
defined during analysis, but add much more rigor to their definitions. Then you
add or change objects as needed to refine a solution. In large systems, design
usually occurs at two scales: architectural design, defining the components from
which the system is composed; and component design, defining the classes and
interfaces within a component.
You will recall that in the waterfall model there was supposed to be a clear
distinction between analysis and design. In the iterative model you may be
18 TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT
wondering where the distinction lies. It is a very fine line, and during a project or
even one conversation, you may find that you are doing both.
While it is useful to keep analysis and design separate when we are splitting a
large problem into small pieces, it is also helpful to consider other ideas that
might not fit too neatly in at present.
Some design is visible, some is hidden. Consider a car. In a car we can see and
touch the driverÊs controls. Is the steering wheel easy to grip? Can you quickly
find the horn in an emergency? Other design elements are revealed through use.
How long does the air-conditioning take to cool the car on a hot day? How well
do the brakes work in the rain? Some design elements are internal so that only an
expert will be able to appreciate the design and be able to predict the future.
How does the engine wear over many years? How will the car perform in a
crash? Nothing in a car is accidental; a person has designed everything. So it is
with software. The external aspect is the user interface. The internals are
concerned with reliability, ability to change, resilience to new technology.
If an error is possible, someone will make it. The designer must assume that
all possible errors will occur and design so as to minimize the chance of the
error in the first place, or its effects once it gets made. Errors should be easy
to detect, they should have minimal consequences, and, if possible, their
effects should be reversible.
Always remember that users of a system are people. Good design requires an
understanding of the underlying basic principles and trade-offs. Good design
TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT 19
requires experience. Good design is not about right or wrong, but about being
better in certain circumstances than others. For all these reasons learning to
design well can be frustrating. But equally, when you have created a good design
it is very satisfying.
A vital part of the vision for the project is the scope. Exactly what will and what
will not be in the system? If the scope is too large then most likely the project will
fail. The scope needs to be as small as possible while still meeting the core needs.
The 80/20 rule, or ParetoÊs principle (named after a 19th century Italian
economist) explains why every feature does not need to be built. This rule states
that 80% of the value of a group of items is generally concentrated in 20% of the
items. Examples include phone bills (80% of the calls are only to 20% of the
people) and restaurant meals (80% of orders are for 20% of the dishes in the
menu). And in software 80% of the users of word processors use only 20% of all
the features.
Of course the more stakeholders you consult the bigger the scope tends to be. But
it is crucial to firmly articulate and stick with the central vision. (One useful
technique is to have an appendix to your vision of all the things that are not being
currently considered, but could be later. This means that ideas are not lost, but
neither is the vision.)
The scope of a system is really the sum of its parts. Some of the parts provide
functionality, liking accepting a customer order, and others are what we call non-
20 TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT
functional requirements. These are things like speed of the system, quality,
adherence to standards. (Topic 2 has more on this topic.)
Functional requirements are best described with use cases. Use cases were
invented by Ivar Jacobsen, one of the three authors of UML. A use case is a
description of some interaction of the system. It is written in simple everyday
language, English or whichever language the users are most comfortable with. It
can be a simple, casual narrative describing how a userÊs goal is satisfied.
Here is an example of a use case. Suppose we were writing a system to rent out
videos.
Borrow a video · use case · simple story
The customer takes the videos they have selected and goes to the checkout
counter. There the clerk confirms their membership and checks for any
overdue videos. The total cost is calculated, the customer pays, and leaves
with their videos.
Always remember that use case describes the interaction between the user and
the system. It doesnÊt tell us anything about how the system works. That is done
later.
DonÊt worry if you are still blur with use case. Topic 2 covers use cases in more
detail · determining who the users are, working out their goals, using different
use case formats, etc.
EXERCISE 1.5
Be cautious when considering the artifacts for a particular project as every artifact
adds to the total cost. For each artifact:
ensure that it has a real purpose, either now or in the future; and
establish how ÂgoodÊ it needs to be · again think of the 80/20 rule.
The following table contains a list of artifacts that the UP specifies for the
inception phase. Remember that all these artifacts can start as very simple
sketches or documents. Depending on the size and nature of the project they may
evolve to be more detailed and/or more formal.
Artifact Comment
Vision and business case This can start as a simple 1ă2 page document, perhaps
with some diagrams. Topic 2 discusses other material that
can be included.
Use case model Discussed further in Topic 2. Really what is needed in the
Inception Phase is a list of the main use cases that need to
be covered, plus maybe some details for the key use cases.
Supplementary This is anything that is considered necessary but not
specification included elsewhere. More details in Topic 2.
Glossary Every project has special words and terms that everyone
needs to be familiar with. To save needless repetition, it is
useful to have all the terms gathered in one place.
Risk list and risk Every project has risks. Risks can be categorized as
management plan technical, people or political. Some are common to every
project, like key people leaving, and others are specific to
the project.
The risk list and risk management plan can be a simple
document that lists the risks and how they will be
reduced. Regular review of risks is vital.
Prototypes and proof-of- Prototypes can be produced for a number of reasons. It
concepts could be to demonstrate what the user interface will look
like, or it could be to demonstrate that the selected
technology works and that 2,000 transactions can be
stored in the database in under two minutes.
22 TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT
This topic sets the scene for the rest of the course. Object-orientation allows
us to combine data and functions when analysing real-world and software
entities.
Approaches to application development move from waterfall to iterative
development.
We introduced two standards: the Unified Process (UP) and Unified
Modelling Language (UML). UP is a methodology for iteratively developing
object-oriented systems. UML is a standardized set of notations for modeling
various aspects of an object-oriented system.
System development is both an engineering and creative venture, and there
are many differing opinions on how best to proceed.
We then commenced the inception phase of the case study by looking at the
vision, the stakeholders and some initial plans.
Now we are going to introduce the case study used in this course.
VictoriaÊs Videos is a large video shop with thousands of members and videos. It
is a single shop and Victoria has no plans to expand to multiple branches.
The length of time that a video can be borrowed depends on the video. New
releases are only lent out overnight, current releases are for three-day hire, and
the rest are for a week.
MembersÊ birthdays are marked with a special letter inviting them to borrow any
video of their choice for a week for free.
Every three months the shop does a stocktake. Any missing videos are updated
to show them as ÂMissingÊ.
The system Victoria has three very good intelligent cash register terminals to
handle all the financial transactions. These terminals handle the credit card
facilities, cash reconciliation, banking and interface with the accounting system.
However, the current computer system runs on very old hardware (Windows 95)
and is written in an obscure programming language that nobody understands. It
is a very slow and unfriendly system that requires a fair bit of training for new
staff. So Victoria has decided to invest in a completely new system with current
hardware, operating system and software. Hardware and operating system
decisions have not been made.
While sheÊs doing this, she wants to add a data warehouse so that management
can get various statistical reports. For example, they would like to see which
types of videos are most popular or unpopular, who are the best customers, how
many overdue videos there are, etc.
24 TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT
In addition, in the current system a barcode reader is required to scan the videos,
and members need to present their ID cards to take the video out. This causes
problems when members forget to bring their cards, so Victoria would like to
explore other options.
The following is the functional decomposition of the targeted new system for
VictoriaÊs Video:
As there are always new staff members joining the Shop, the new system has to
be easy to learn and use.
The case study is the NextGen point-of-sale (POS) system. In this case study we
shall see that there many interesting requirement and design problems to solve.
This is a realistic problem as organizations really do write POS system using
object technologies. A POS system is a computerized application used (in part) to
record sales and handle payments and it is typically used in a retail store. It
includes hardware components such as computer and bar code scanner and
software to run the system. It is interfaced to various service applications such as
third party tax calculator and inventory control. These system must be relatively
fault-tolerant. A POS system increasingly must support multiple and varied
client-side terminals and interfaces. These include Web browser, a regular PC
TOPIC 1 INTRODUCTION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT 25
which supports graphical user interface (GUI), touch screen input, wireless
PDAÊs, and so forth.
Attribute Method
Class Object
Construction Polymorphism
Elaboration Stakeholder
Inception Subclass
Superclass
Inheritance
Transition
Instance Unified Modelling Language (UML)
Iterative development Variable
Message Waterfall
LEARNING OUTCOMES
By the end of this topic, you should be able to:
1. Differentiate between different types and levels of requirements;
2. List standard non-functional requirements;
3. Recognize that change in requirements is inevitable, and outline
strategies for dealing with such change;
4. Identify the actors for a system;
5. Define a use case, levels of use cases and describe how use cases fit
with goals;
6. Identify the use cases for a system;
7. Draw a UML use case diagram to show the scope of a system; and
8. Draw a correct UML activity diagram for a set of use cases.
INTRODUCTION
This topic is all about finding and then recording and analysing the requirements
for a system. Badly defined requirements are a major cause of system failures.
The requirements for a system cover a large spectrum, from business needs, to
specific technologies, as well as what the system Âmust doÊ, such as calculate tax.
This topic starts with a discussion of the different levels and types of
requirements. We then focus on what the system Âmust doÊ, or its functional
requirements.
28 TOPIC 2 REQUIREMENT AND USE CASES
Functional requirements are described by use cases. Use cases are the core of
object-oriented analysis and design. Consequently the bulk of this topic is about
writing use cases, which you were briefly introduced in Topic 1. Use cases look
simple · very simple · until you try to write some. The activities for this topic
will help you practise this skill.
In addition to use cases, you will learn about three UML diagrams that are used
in conjunction with use cases. Use case diagrams give a pictorial view of the
actors and use cases. Activity diagrams show how some use cases interact to
achieve a business task or process. Use case package diagrams logically group
the use cases to make it easier to understand the big picture.
The requirements for the system are the outcome of this process and represent an
agreement between the system development team members, customers and
users. Note that the requirements will tell what the system will do, rather than
how it will do it. Writing the requirements involves:
TOPIC 2 REQUIREMENT AND USE CASES 29
The requirements may also involve Âproof of conceptÊ prototypes, which early on
in the life cycle of the development process confirm or shape the direction of the
solution. The prototypes can be an implemented mockup of some function in the
system, or could simply be sketches of the GUI through which scenarios can be
navigated and confirmed.
sit down to discuss your requirements. How many rooms do you require? Do
you want the dining room next to the kitchen? How big should the garden be?
We can consider these as the functional requirements of the house. And there are
other requirements too · such as the quality of the bathroom taps, amount of
natural light, and the total budget for the project. These are non-functional
requirements. From the system development perspective, non-functional
requirements can be further divided into different categories. In the UP context,
requirements are categorized according to the FURPS+ model which refers to:
functional, usability, reliability, performance, supportability and Â+Ê for
everything else (such as implementation, operations, packages, legal...), as
depicted in Figure 2.1.
Alistair Cockburn, in Writing Effective Use Cases, suggests that only a third of
requirements are functional. Some requirements can be regarded as both functional
and non-functional.
EXERCISE 2.1
Characterize the following requirements as functional, non-functional or
both.
(a) Customers receive a special discount on their birthdays.
(b) Use the Java J2EE architecture.
(c) Each POS terminal is able to process 100 sales items per minute.
(d) Produce a report on demand of all transactions greater than $100,000.
(e) Each user is able to see personalised menu options.
TOPIC 2 REQUIREMENT AND USE CASES 31
EXERCISE 2.2
In this topic, we will use VictoriaÊs Videos system, which you were
introduced to in Topic 1 as the basis for some activities.
Have another look at the case study, which was included in Topic 1, and
list two functional requirements and two non-functional requirements for
the system.
Person-to-person Communication
You need effective communication in order to extract information from clients
and users about the problem domain; to obtain information from clients and
users about the system requirements; to convey your understanding of the
system back to clients and users for their affirmation; to convey requirements
information to developers, managers and testers; and finally to convey the need
for changes to the requirements which may have been established. For successful
requirements analysis, groups involved need to convey information to one
another effectively.
32 TOPIC 2 REQUIREMENT AND USE CASES
Constant Change
As weÊve said already, changing requirements are an inevitable aspect of the
software development life cycle. Even though requirements may be frozen at a
particular point, a system and peopleÊs understanding of it will continue to
evolve. This evolution may be due to improved understanding of the problem
domain by analysts and developers; improved understanding of the system
solution on the part of users, or simply competition, regulators, approvers,
technologies or politics. Recognizing that requirements will always change is a
core concept of iterative development.
Writing Requirements in UP
As you know, the goal of requirements analysis is to describe what the system
should do (the requirements) and get developers and the customer to agree on
that description. To achieve this, we define the system and its surroundings and
the behaviour it is supposed to perform. Customers and potential users are
important sources of information.
As been said in Topic 1, the Use Case Model is important for both the customer,
who needs the model to validate that the system will become what is expected, and
for the developers, who need the model to get a better understanding of the
requirements for the system. A Use Case Model is written so that both the
customer and the developers understand it.
The Use Case Model consists of actors and use cases. Actors represent the entities
external to the system, either users or other systems. Use cases represent the
functional behaviour of the system. Actors help define the system and give you a
clearer picture of what it is supposed to do. WeÊll look at actors further in the
next section.
TOPIC 2 REQUIREMENT AND USE CASES 33
As you know from Topic 1, a use case represents events triggered by actors and
describes how the system must respond. Because use cases are developed
according to the actorsÊ needs, the system is more likely to be relevant to the
users.
Figure 2.3 shows the main steps of the iterative process of building and delivering
some functionality. Use cases live through the entire system life cycle and act as a
unifying thread. The same Use Case Model is used during all subsequent
workflows. This topic covers the first three steps in more detail. Step 4 is covered
in later topics.
Another way of thinking about roles is wearing different hats. One person can
wear different hats, or play many different roles, as they go through a day or a
34 TOPIC 2 REQUIREMENT AND USE CASES
3. External · Any system that receives or generates data for the system ·
these are external systems, e.g. tax office system, bank, accounts system,
etc.
Note that this taxonomy differs slightly from UML and in Larman (2002). In
particular, in UML users and external systems are treated the same. It is true that
they are both external to the system, but treating people and computers in the same
way is not conducive to building usable systems. Further, our experience shows
that frequently the needs of the secondary actors are often omitted. Often the need
for reporting is known, but instead of the needs being closely examined, the
standard response is to simply add an end-user reporting tool. Very rarely does
this simplistic approach satisfy. If senior management does not receive any benefits
from a system then the project may be terminated.
EXERCISE 2.3
Here are two very different roles for two very different systems.
(a) Clerk for a small investment company. This company has only 30
clients and there are only a few transactions per day, but the
amount of money in each transaction can be large.
(b) Teenager at a Kylie Minogue fan club website. This website has
photos, lyrics and samples of KylieÊs songs. There are facilities for
online discussion and chat.
For each, consider what would be important to a person in that role and
assign a priority (1, 2, 3 or 4) to each. And you cannot make them all
priority 1!
Teenager at Kylie
Clerk for Investment
Objective Minogue Fan Club
Company
Website
Reliability of the
system, e.g. the results
of searches or
calculations are correct
Efficiency, e.g. that a
minimum number of
steps is required, thus
reducing human error
Satisfaction, e.g. the
experience of using the
system is enjoyable
Speed, e.g. the rate at
which information is
displayed
Warning: If you take the role analysis too far, then you will end up with a
different role for every use case. This is the opposite of having one role, called
ÂuserÊ who does everything. Somewhere between these two extremes is a useful
and workable set of roles. It sometimes takes a little while for this to come
together. So start with an initial list of roles, and work on identifying their use
cases. Then come back and review the role model.
38 TOPIC 2 REQUIREMENT AND USE CASES
Actor Importance of
Actor Name Description Current Job Title(s)
Type the Actor
This name Primary, A sentence or two This is helpful in Low, medium
needs to be secondary to describe the communicating to or high
as or external actor in some staff. There could be
meaningful detail multiple job titles
as possible. per actor, or one job
title can have many
actors.
Lastly assign an importance (high, medium, low) to each actor. This will
determine the order in which you start looking for use cases. (Of course, as with
everything, once you look more closely at it, the importance may change).
For the NextGen POS case study introduced in Topic 1 an initial list of actors
could be as in Table 2.2.
Table 2.2: NextGen POS Initial List of Actors
You will notice that this list has questions and indicates where more work is
required. This is normal.
EXERCISE 2.4
Identify possible actors for VictoriaÊs Videos system and categorize them as
primary, secondary or external.
Now download Reading 2.1 from myLMS to learn about a brief use case.
Use cases define a promise or contract of how a system will behave (Larman,
2002).
EXERCISE 2.5
In Exercise 2.5 we gave you the name of a use case, but of course, normally you
have to work out the use cases yourself. Deciding where one use case ends and
another use case begins takes a bit of practice. When you first start writing down
possible use cases do not be too concerned about getting this right. Once you get
further into writing the use cases you will be able to work out the boundaries.
EXERCISE 2.6
In Exercise 2.4, you listed the actors for VictoriaÊs Videos. Now you need to
work through the list of actors, from most important to least important, and
list their use cases. Do not be too concerned about getting the names of the
use cases perfect. Just write them down. Later you can change the names,
delete use cases or add use cases.
EXERCISE 2.7
Using your list from Exercise 2.6, select the next most important use case of
the most important actor and write a brief format of the use case.
Now select another use case and also write it in a brief format.
Now download Reading 2.2 from myLMS to learn about success scenarios and
alternate scenarios for NextGen POS example.
After going through Reading 2.2, you will see that each use case has a main
success and some alternate scenarios. A use case may has a main success scenario
and some alternate scenarios. Sometimes, when we have a large and complicated
system to develop, there will be lots of different scenarios. It would be impossible
to discover all the possible scenarios at the very beginning. Remember, in the UP,
everything is done in an iterative fashion. Hence, when you first start writing use
cases for a system, itÊs best to ignore all the alternate scenarios and only think
about everything going well · the Âsunny day scenarioÊ. Alternative scenarios
can be added in future iterations. Of course, successful scenarios can also be
revised and changed in later stages.
EXERCISE 2.8
We have written up a main success scenario for the borrow videos use case
in Exercise 2.5. Try to think up a few alternate scenarios and present them
in a brief format similar to the main success scenario. Compare your answer
with your course mates in myLMS.
The main purpose of the UP is to help system developers to build their systems in
a systematic manner. Poor system development tends to be done by developers
who cannot judge what they should be doing at each stage of the whole
development cycle. A common mistake is to jump into the system design before a
good requirements analysis is available. Hence, in the UP framework, a black-box
use cases approach is usually adopted to help system developers avoid making
the same mistake twice. Let us know discuss the term. Something is a black box
if we cannot see the inner workings of it. For example, from a car driverÊs
perspective, a car is a black box. The car either moves properly or it does not. If
there is a problem, then the car mechanic comes and, with a white-box view, lifts
the car bonnet and looks at the engine and internals. Hence, in the black-box
approach of use cases writing, we donÊt care about how the system will perform
the tasks but just focus on what we should expect from the system. In other
words, we are only focusing on the responsibilities of the system. Example of
black box use case shown below:
The main purpose of the UP is to help system developers to build their systems in a
systematic manner. Poor system development tends to be done by developers who
cannot judge what they should be doing at each stage of the whole development
cycle. A common mistake is to jump into the system design before a good
42 TOPIC 2 REQUIREMENT AND USE CASES
The system updates the student The system writes the new marks to a database
marks The system generates a SQL UPDATE statement
for the task
Sometimes confusion will still arise even if we adopt the black-box approach,
because different people have a different understanding of Âwhat the system
doesÊ. For example, a cashier might think of her goal as Âlogging inÊ, but in fact
this is just the mechanism that achieves the higher-level goal of identifying and
authenticating herself.
Now download Reading 2.3 from myLMS to learn of how to write use cases in an
essential UI-free style.
Essential style writing (as highlighted in Reading 2.3) is therefore used to further
clarify the focus of use cases writing: Âkeep the user interface out and focus on
actor intentÊ.
EXERCISE 2.9
Now take the three use cases from Exercises 2.5 and 2.7, and rewrite them in
the essential two-column format. (Yes, writing use cases is hard work, but
the more you write the easier it gets. It is not good enough to just look at the
answers. You must practise). Anyway, the answer could be obtained at the
end of the module.
TOPIC 2 REQUIREMENT AND USE CASES 43
Now download Reading 2.4 from myLMS to learn about goals and scopes of use
case.
Information systems are rather abstract entities that consist of software, hardware
and applications. However, even though we cannot visualize the whole
information system, for the purpose of use cases we need to define a boundary
for it. ItÊs similar to building a house, when we need to perform a land survey to
fix the boundary of the site on which the house is going to be built. A clearly
defined system boundary helps in the correct identification of the right actors to
use cases, which in turn helps the system analyst to obtain the goals. The four-
step procedure proposed to define use cases is listed below:
(i) define the right system boundary
(ii) identify the primary actors
(iii) identify the actorsÊ goals
(iv) define and name the use cases.
Now download Reading 2.5 from myLMS to learn about four-step procedure to
define use cases as listed above.
44 TOPIC 2 REQUIREMENT AND USE CASES
EXERCISE 2.10
For VictoriaÊs Videos, up to now we have tried to identify the actors and
some brief use cases. However, all these were produced by our
imagination. In a real system, the proper way to do requirements
analysis is to carry out a combination of many activities such as:
Read any documentation that has been collected.
Look at any systems that currently exist. Look at screens and
reports. See if you can track some real examples all the way
through. For example, for an insurance system, you could see how
a policy is created, and then later how a claim might be processed.
Talk to the parties concerned. Commonly you begin by conducting
some user requirements workshops. Use the initial actor analysis
work as a guide to who should attend the workshop. For the first
workshops it is best to have more people rather than less as you
need the broadest possible range of views. Later, you can have
much smaller workshops to concentrate on particular areas.
Prepare a list of questions that you would like to ask various people from
VictoriaÊs Videos.
ItÊs important that you understand the Use Case Model as itÊs a crucial element in
Object Oriented System Analysis & Design (OOSAD) and it is one of the earliest
tasks in the whole system development project. The future success of the project
depends on getting the use case right. As itÊs sometimes helpful to approach a
topic from a different angle, weÊd like you to reinforce your understanding of the
Use Case Model by working through the next reading by Cockburn.
http://alistair.cockburn.us/structuring+use+cases+with+goals
Writing a use case is, to a certain extent, is like writing a report, and as you will
know if youÊve ever written a report, itÊs much easier if you can follow some kind
of format. Most companies and organizations have report templates for people to
refer to. Similarly, for use cases there are templates that system analysts can refer
to. One of the most popular use case templates was developed by Alistair
Cockburn. The full version and a detailed description of the template are
available at http://alistair.cockburn.us/Basic+use+case+template. Use case
templates are not covered in this course.
The following Figure 2.5 is the simple UML notation to depict a use case.
A collection of use case diagrams will form a context for use case diagrams that
shows the scope of the system, and the relationship between the actors and use
cases. It serves as a diagrammatic summary of the behaviour of the system.
According to Larman (2002), use case diagrams are only secondary in use case
writing. System developers should not spend too much time drawing use case
diagrams. Writing use case text should be the primary focus.
46 TOPIC 2 REQUIREMENT AND USE CASES
Now download Reading 2.6 from myLMS to learn about use case diagram in
detail.
EXERCISE 2.11
By using the example of use case diagram shown in Figure 6.2 of Reading 2.6
as a guide, draw a use case diagram for VictoriaÊs Videos.
The following diagram shows how the different actors invoke their own use cases
to achieve the overall task. The diagram has ÂswimlanesÊ for each of the different
actors.
Each system is different so you have to decide whether or not any activity
diagrams are useful or not.
TOPIC 2 REQUIREMENT AND USE CASES 47
EXERCISE 2.12
Do you think an activity diagram would help explain how a subset of the
use cases for VictoriaÊs Videos system fit together to form a whole? If so,
then draw it. Note: We are not trying to draw all the use cases of the whole
system, but only some of them that make up a process that makes sense to
the users as a whole.
48 TOPIC 2 REQUIREMENT AND USE CASES
In writing this list, Susan Lilly (1999) is not arguing against use cases, but trying
to alert newcomers to the potential problems, and suggest ways to avoid them.
She advises:
Explicitly define the systemÊs boundary. This makes clear what is inside the
system and what is outside the system.
Make use of a standardized template for documenting your use-case
specifications. If the team uses a template, it will help communications
between team members as well as help newcomers get started.
When writing use cases, focus on the goals of the actors. This will help you
find use cases from the usersÊ perspective and keep a focus on the primary
function of the system.
DonÊt make use-case specification synonymous with user-interface design.
You can use low-fidelity representation of user interfaces, but since user
interface design is particularly subject to design-specific change, it is best not
to include it as part of the requirements if you want to get them signed off
earlier rather than later.
To help catch potential problems, Lilly suggests that you review your Use Case
Model, the diagrams and specifications, in incremental steps with the
development team, clients, and users. Start by reviewing your use-case diagram
TOPIC 2 REQUIREMENT AND USE CASES 49
before youÊve defined use case details; check that the system boundary has been
clearly defined, that obvious actors have not been missed and that the use cases
focus on the usersÊ goals.
EXERCISE 2.13
Deciding on the packages for a system requires a little experience, and there are
generally several valid approaches for one system. Some possibilities for
packaging the use case are listed below.
By functional areas. For example, put everything to do with money in one
package, and inventory in another.
By actor. For example, put all the cashierÊs use cases in one package.
By ÂstyleÊ of use case. For example, put all the simple setup/maintenance
style use cases in one package.
By importance or iteration. For example, all the use cases that are going to be
built first could be in one package.
50 TOPIC 2 REQUIREMENT AND USE CASES
By physical implementation. For example, all the use cases that are delivered
via the Web are in one package, and use cases accessed via the head office
computer are in another package.
The UML notation for a package is a folder. But, as emphasized earlier, the text of
the use case is more important than the diagrams. So often a use case package is
simply a short description of the use case, followed by a list of the use cases that
comprise the package. Optionally, include a use case diagram of the use cases
(refer to Figure 2.7).
Particularly with large systems, the key point is to identify all the architecturally
significant use cases as early as possible, and leave less important use cases for
later. Architecturally significant here means all the essential functionality of the
system. Use cases are vital and central to the Unified Process (Larman, C 2002).
During the requirements analysis, use cases are the main product. However, as
we noted earlier, use cases cater for the functional requirements of the system.
As you can recall, there are also non-functional requirements that also need to be
identified. Alongside the use case, there are three more artifacts in the
requirements workflow · vision, supplementary specification and glossary.
These three artifacts capture other system requirements that cannot be captured
in the use cases. The supplementary specification captures other non-functional
requirements in the URPS+ category such as documentation, packaging,
supportability, licensing requirements, etc. The vision is probably the highest-
level document of the project, providing a broad picture of the purpose and
business needs of the project and how the proposed system should look. It sets
forth the ultimate goals of the project from the organizationÊs business
perspective. The glossary mainly serves as a data dictionary for the whole system
development project. It clearly defines all the technical terms in the context of the
system development in order to avoid problems in communication and
ambiguity that can possibly arise during the whole development process.
The detail discussion about vision, supplementary specification and glossary are
not in the scope of this course.
Unlike the traditional waterfall system development life cycle (in which
requirements analysis is done and completed before the design and
implementation phases) the unified process model has the requirements
workflow (discipline) extended throughout the whole system development
process: in other words, the requirements analysis is done iteratively.
The use case model includes the identification of actors, their goals and the
writing of use cases. The functional requirements are captured in the use
cases. Sometimes, use case diagrams can be used to help to understand the
overall picture of the system, the flow of events and the relationship between
actors and use cases.
INTRODUCTION
From Topic 2 we have the requirements for our system defined to some degree.
Hopefully we are clear about the scope (i.e. what is included) and, have some use
cases and may be a use case diagram been written for parts of the system.
Up to now there has been nothing object-oriented in the material. We could write
use cases and then continue in a non-object-oriented manner. In this topic we
start the object-oriented modelling that will continue for several topics. While the
material is presented to you sequentially, in reality the object-oriented modelling
happens in parallel with the use case writing.
TOPIC 3 OBJECT-ORIENTED MODELLING 55
This Topic is all about domain modelling. Why do we do this? Because we need
to confirm our understanding of the domain and the scope of the problem. In
some cases the software developer or system analyst already understand the
domain, but in many cases there is some learning to do. In certain specialist
fields, such as finance, IT designers are expected to know a great deal about the
finance domain. While the theory may all look quite straightforward, you do
need to practise by working through the activities and the tutorials. By the end of
this Topic you will have a domain model for VictoriaÊs Videos.
During the inception phase, we should have established the business case for the
system and defined the project scope. To accomplish this we must have identified
all external entities with which the system will interact (actors and their roles)
and defined the nature of this interaction at a high level. This involves identifying
all use cases and describing (briefly) a few significant ones. The business case
includes success criteria, risk assessment, and an estimate of the resources
needed, and a phase plan showing dates of major milestones. The outcome of the
inception phase should include:
vision document: a general vision of the projectÊs requirements, key features,
and main constraints
initial use case model (10ă20% complete)
initial project glossary
initial business case, which includes business context, success criteria
(revenue projection, market recognition, and so on), and financial forecast
56 TOPIC 3 OBJECT-ORIENTED MODELLING
The inception phase should not last too long, generally one to two weeks, so
many of the things in the above list will be started but they wonÊt be finished. For
example a serious architectural prototype could easily take a month to choose
and install the relevant technologies (hardware and software), and then build it.
The artifacts produced should be brief and incomplete. The first major project
milestone is at the end of the inception phase. The evaluation criteria for the
inception phase are:
stakeholders agree on scope definition and cost/schedule estimates
requirements understanding as presented in the primary use cases
credibility of the cost/schedule estimates, priorities, risks and development
process
depth and breadth of any architectural prototype that was developed
actual expenditures versus planned expenditures.
If the inception phase milestone is not met, the scope of the project may be
redefined, or it may even be cancelled; if it passes the milestone, the project team
enters the elaboration phase, a more in-depth requirements investigation is
carried out and implementation of the core architecture is initiated. The purpose
of the elaboration phase is to analyse the problem domain, establish a sound
architectural foundation, develop the project plan, and eliminate the highest risk
elements of the project. Architectural decisions have to be made with an
understanding of the whole system: its scope, major functionality and non-
functional requirements such as performance requirements, etc.
In terms of project management, the elaboration phase is the most critical of the
four phases. At the end of this phase, the hard ÂengineeringÊ is considered
complete and the project team should make a very important decision · whether
or not to commit to the construction and transition phases. For most projects, this
also corresponds to the transition from a low cost, low-risk operation to a high-
cost, high-risk operation with substantial investment. While the process must
always accommodate changes, the elaboration phase activities ensure that the
architecture, requirements and plans are stable enough, and the risks are
sufficiently mitigated, so you can determine the cost and schedule for the
completion of the development.
TOPIC 3 OBJECT-ORIENTED MODELLING 57
The targeted system will be designed and built by the system development team of
the organization. However, it may happen that there is a commercially available
software package that fits the requirements of the targeted system (or requires only
minor adaptation). In this case, the organization may choose not to build its own
system but to purchase the available commercial package, which, in most cases is
more economical. The decision of whether to buy or to build the system has to be
58 TOPIC 3 OBJECT-ORIENTED MODELLING
made during the elaboration phase before we move to the next phases, which are
very costly and more risky.
EXERCISE 3.1
Refer to the use cases you wrote for VictoriaÊs Videos in Topic 2: for
Exercise 2.5 you wrote the Âborrow videosÊ use case, and for Exercise 2.7
you wrote another use case. Draw an SSD for each of those use cases. From
actually doing the SSD you may find that your use cases are not quite right.
A common mistake is that it is not clear from the text of the use case what is
happening. For example, you may have a phrase like Âupdate detailsÊ. Well,
who is updating the details · the user or the system? So if you find
something wrong with your use case then fix it.
Before we go any further, letÊs discuss the various kinds of models you meet in
UP, as they are liable to become confusing unless you are clear about the way
they fit together.
In UP, we adopt the modelling methodology to perform most of the tasks in the
whole system development process. There are a number of different models that
we need to build at different phases and iterations. We can categorize all these
different models into three levels, conceptual, logical and physical.
TOPIC 3 OBJECT-ORIENTED MODELLING 61
Conceptual model This model is a representation of the real world (in the context of
system development, the business domain where the resulting
system will be operated) from the userÊs conception. For example,
in the VictoriaÊs Videos case, a conceptual model is one that will
describe the entities as well as their relation in the video check out
system as perceived by, for example, a member of the video shop.
The entities within the video check-out domain may well include:
members
video CDs
video titles
video categories, etc.
Logical model This model shows what a system must do or have, without regard
for how it is to be done, built and represented. This includes the
requirements model discussed in Topic 2. Logical models are
implementation-independent in that the final system can be
implemented in any programming platform, be it C++ or Java and
even a manual system.
Physical model This is the final design model showing how things will be done or
built and depicting all platform details, data storage and other
implementation details.
Now that you have a clear understanding of the whole modelling hierarchy of the
UP, you will see why it is important to have a business modelling process on top
of the other UP models. As we are all aware, information systems no longer
merely support businesses. Increasingly, they form an integral part of a business,
hence the business itself defines the requirements of the system we are going to
develop. A business model (the domain model) is an abstraction of how a
business functions. It is a somewhat simplified view of the complex reality of the
TOPIC 3 OBJECT-ORIENTED MODELLING 63
As we said above, the use case model and domain model are related. The use case
model (like most of its artifacts) is basically textual in nature: it describes the
details of the functional (and non-functional) requirements of the system in
words. However, as has often been stated, ideas presented in visual rather than
textual terms are often easier to understand (a picture paints a thousand words).
So a visual business (domain) model may enhance the understanding of business
operations and help to refine the development of the requirements model and the
design model in the later stages of the UP.
There are many different ways to do business modelling. In the context of the UP,
we usually make use of the UML class diagram notations (which results in the so-
called domain model or conceptual model in some other object-oriented
literature). Bear in mind that UML is just a tool for object-oriented analysis and
design. The class diagram in UML can be used for other purposes in UP such as
the Âdesign class diagramÊ in the design model which we will discuss later. Here,
in the context of business modelling, a domain model is a class diagram drawn
from the conceptual perspective (which is different from the specification
perspective in the design class diagram at the design modelling stage).
The following reading will demonstrate a partial domain model for NextGen POS
system:
Now download Reading 3.2 from myLMS to read about „Domain Models‰.
EXERCISE 3.2
Before we go into the details of the domain model, letÊs make sure we are
clear about its function. Refer to the diagram below:
Do not be concerned with the exact meanings of the notation ă the lines,
words, arrows, etc. ă as this is all explained later in this topic. For the
moment, just try to read the diagram with the following words, starting in
the top right-hand corner: Items are Stocked-In a Store. A Store has an
address (e.g. 15 Jalan Buntong, Ipoh) and a name (e.g. Kedai Perabot Ali).
Each Store houses, or has, some Registers. Every Sale is captured-on, or
recorded on, a Register.
Continue with this description to cover all the domain objects and
relationships as depicted in the figure above. See if it gives you a better
understanding of the „payment sale‰ process of the NextGen POS case.
TOPIC 3 OBJECT-ORIENTED MODELLING 65
As the relationship between a class and its objects is so clear, we often get a bit
lazy with our language. If the head of engineering for a car factory says: ÂThe
painting on the car needs to be done betterÊ, he or she is probably talking about
the process that goes on in the factory rather than a specific car. So too in software
modelling we swap between using the words class and object.
The entity objects fall into a number of categories, based on the real-world objects
that they represent. Here are three kinds of conceptual class that we will
encounter in business modelling:
Concrete objects are tangible, i.e. have a physical presence. Concrete objects
are the most easily understood by analysts and users. In the video shop
example, video CD is a concrete object.
Conceptual objects are intangible and often far more difficult to understand.
For example, school is a conceptual object. You may argue that a school
tangibly exists · it has buildings. However, the concept of a school is not just
the buildings. Imagine that all the buildings in a school collapse in an
earthquake. We cannot say that the school doesnÊt exist anymore. It can be
rebuilt. Similarly, video title is also a conceptual object.
Event and state objects are highly abstract in nature. They are related in that
typically when an event of any significance occurs, some or more objects will
switch to a different state. An example of an event and state object in the
66 TOPIC 3 OBJECT-ORIENTED MODELLING
video shop is borrow video. We can see that borrow video events will
typically change the status (e.g. borrow video list) of the object.
Now download Reading 3.3 from myLMS to read about conceptual classes.
Even though the category list as presented is drawn from some particular
domains (in the the Table 5.1 case, the store domain), it more or less covers many
common categories in other business domains.
Now download Reading 3.4 from myLMS to read about classes category list.
68 TOPIC 3 OBJECT-ORIENTED MODELLING
EXERCISE 3.3
Another technique for identifying conceptual classes is the use of noun phrase
identification. After youÊve worked through the Reading 3.5, you will see that one
of the arguments for developing use cases before domain modelling is that they
are an excellent source of noun phrases for conceptual class identification.
However, note about the danger of ambiguities in the natural language of use
cases translating to the conceptual classes if the transformation of one to the other
is made too mechanically.
Now download Reading 3.5 from myLMS to read noun phrase identification.
Now let us see one example in which we going to use noun phrase identification
to identify conceptual classes.
EXAMPLE
Below is a description of a Web-based ticket reservation system. All the noun
phrases that are candidates for conceptual classes is highlighted in bold.
Before they can use the site, customers must register their contact details or enter
sufficient information to identify them if they have registered before. They may
then view publicity material and ticket availability information for a number of
different events and add tickets for chosen events to their order.
When they have finished, they enter their credit card details and, if all is well,
their tickets will be dispatched through the post. The company keeps a contact
address and a billing (credit card) address (which may be the same) for each
registered customer.
Concentrate just on the customer side ă donÊt model the supply of tickets from
„the usual ticket agencies‰.
TOPIC 3 OBJECT-ORIENTED MODELLING 69
There is also the issue of the proper naming of the conceptual classes so that the
use of the domain model as an effective communication tool in the system
development project can be highlighted. There are two basic principles that we
need to follow in naming conceptual classes:
They must be distinct.
There must be a way of telling them apart.
The mapmaker strategy be used as a guideline for naming conceptual classes and
this strategy is elaborated in Reading 3.6.
Now download Reading 3.6 from myLMS to read about issues in conceptual
classes identification.
70 TOPIC 3 OBJECT-ORIENTED MODELLING
In the video shop example, suppose we have the video Star Trek that has once
been in stock. The video has a video title, video classification and video category,
etc., that go with it. After the video has been borrowed by a member and he/she
has lost it, the video will be deleted from the system. If the management needs to
obtain some information about the video (e.g. what classification it is) there is no
way they can obtain that information. To solve this problem, we need a
ÂVideoSpecificationÊ conceptual class that records information about videos so
that whenever information about a specific video is needed (no matter whether it
is still in stock or not), it can be retrieved from the specification. The following
suggests when it is appropriate to use specification conceptual classes:
There is a need to describe about an item or service, independent of the
current existence of these items or services
Deleting instances of things that they describe (for Example: Item) results in a
loss of information that need to be maintained
It reduces duplicated information
Now download Reading 3.7 from myLMS to read about description conceptual
classes.
EXERCISE 3.4
3.5 ASSOCIATIONS
Now we have successfully identified the conceptual classes in the business
domain. Say, in the video shop system, we have identified ÂMemberÊ, ÂVideoÊ,
ÂFrontDeskÊ, ÂMemberRecordÊ as the conceptual classes (please note that this is a
highly simplified domain model and may not be the real domain model for the
video shop case). What are we going to do with all these objects (or conceptual
classes)? An obvious answer is to find out how they are related. An association is
an object-oriented term for relationship. People in the real world have
relationships with other people, with things and with places. So we can say a
person has a mother, is married to their spouse, likes to drive their Porsche, lives
in a house, etc. These are the associations of the object ÂpeopleÊ to other objects in
the real world. We notice that most of the relationships between the object
ÂpeopleÊ and the other objects are described by verbs such as ÂhasÊ, Âmarried toÊ,
Âlikes toÊ, Âlives inÊ, etc.
The Figure 3.4 shows the relationship between two conceptual classes ÂMemberÊ
and ÂVideoÊ.
The line between the conceptual class ÂMemberÊ and ÂVideoÊ represents the
association between the two classes with the label ÂBorrowÊ that indicates the
association name (relationship). The Â1Ê and Â*Ê represent multiplicity, which we
will discuss in detail later.
Begin with a list of all the classes on the left and the UML diagram of all the
classes drawn (without association) on the right, as shown in Figure 3.5. Pick the
first and second classes in the list, i.e. ÂMemberÊ and ÂVideoÊ and check whether
they have a relationship (either from the use case or discussion with users). If
there is a relationship (in this case ÂMember Borrow VideoÊ), add an association to
the UML diagram. At the same time, a line is drawn linking the ÂMemberÊ and
ÂVideoÊ items in the list, indicating that the relationship of these two classes has
been checked.
Then we move down the list to check the relationship between ÂMemberÊ and
ÂFrontDeskÊ and the association ÂGo ToÊ is added. Again, the two items in the list
are also linked with a line.
The process is repeated with the other items down the list, i.e. the ÂMemberÊ-
ÂMemberRecordÊ pair. If a relationship exists, an association is added in the UML
diagram. For the items in the list, even though there is no relationship between
two items, such as ÂMemberÊ and ÂMemberRecordÊ, a link is also drawn to link the
two items to indicate that the relationship between the two has been considered.
When ÂMemberÊ and all the other items down the list have been linked, it
indicates that the relationship between ÂMemberÊ and all the other classes has
been considered (regardless of whether or not they have an association in the
UML diagram). We can move on to the next step.
In the next step, the relationship between the class ÂVideoÊ and the other classes
down the list is considered. Similarly, items are linked after their relationship has
been checked and an association is added between any two classes in the UML
diagram if a relationship exists (refer to Figure 3.6).
TOPIC 3 OBJECT-ORIENTED MODELLING 73
This step is repeated with class pairs down the list until all class pairs have been
considered. The final model will look like Figure 3.7.
Now download Reading 3.8 from myLMS to read about finding associations.
74 TOPIC 3 OBJECT-ORIENTED MODELLING
3.5.2 Multiplicity
As you identify and draw each association, you will initially draw it as a simple
line joining two boxes in the UML diagram. Once you have established the
association, e.g. ÂMember Borrow VideoÊ, there is another question to ask: How
many videos will the member borrow? This question relates to the multiplicity of
the association.
The multiplicity of an association is the number of instances of each class that can
participate in an occurrence of the association. The following table lists some
possible multiplicity values for associations (refer to Table 3.2). Multiplicity is an
important piece of information for the later system design stage. It communicates
important domain constraints that will affect the software design, especially in
database design in the implementation stage.
Multiplicities Meaning
11 one-to-one
1* one-to-many
1 1..* one-to-one or more
1 0,1 one-to-zero or one-to-one
Figure 3.8 depicts the domain model of the video shop system with multiplicity
added.
Now download Reading 3.9 from myLMS to read about other issues of
associations.
EXERCISE 3.5
3.6 ATTRIBUTES
Attributes are the pieces of data we use to identify or describe things. For
example, a person has a name, date of birth and eye colour. Attributes usually
correspond to nouns followed by possessive phrases, such as Âthe colour of that
carÊ. In this case, colour is the attribute of car. Attributes are usually simple data
types or primitive data types such as integer, float, string, date, time, etc. Later
in Topic 5 you will see that an attribute can also designate a class.
For the video shop system, the following are possible attributes to the conceptual
classes identified:
Member · memberÊs number
Video · video ID, classification
FrontDesk · front desk register number
MemberRecord · number of video items borrowed, due dates of items
borrowed.
76 TOPIC 3 OBJECT-ORIENTED MODELLING
In UML, attributes are shown in the lower compartment of the rectangular box
representing the conceptual class. Hence the completed domain model, as
represented in UML for the video shop system is as shown in Figure 3.9.
An entity that has features of its own within the given application is a
separate class.
Do not list object identifiers that are used purely for unambiguously
referencing an object.
If an attribute describes the internal state of a class that is invisible outside the
class then eliminate it from the analysis.
Download Reading 3.10 from myLMS to learn how attributes have been
discovered for NextGen domain model besides the domain model conclusion for
this case study.
EXERCISE 3.6
Congratulations! You have now built a domain model. It probably is not perfect
yet, but it is sufficiently good to use.
of abstraction of the modelling stage we are in, we basically rely on the same set
of UML notations to visualize and communicate the models. Hence, it is very
important to make it clear that we donÊt mix up models with UML notations. For
example, the same rectangular box in UML can be used to represent classes in
different models, be it conceptual classes in the domain model or software classes
in the design model.
One advantage of using the same set of notations throughout the whole
development process is to reduce the so-called semantic gap (or Ârepresentation
gapÊ). Semantic gap means the gap between our mental model of the domain and
its representation in software. In a broader sense, it refers to the lack of shared
conceptual understanding on the aspects of business and system that need to be
modelled in a way that allows both people and technology to work together in
harmony and adapt to change. With the object-oriented approach and the use of
UML, we use the same representation, notation, and most importantly the same
style of thinking, from analysis all the way through to final implementation and
maintenance of the system. This not only makes it easier and cheaper to
accomplish all system development tasks, it also allows us to better educate
users. By reducing the complexity of the whole thing through a reduction of the
number of difficult concepts, we can bring knowledge within reach of a larger
group of people within the organization and eventually get more cooperation in,
enthusiasm for and user ownership of the project.
In this Topic, you had your first encounter with objects and classes. You
modelled a business domain with highly abstract conceptual classes. You
learned how use cases which is used to aid conceptual class identification.
You also identified the associations between conceptual classes and found
their intrinsic properties by identifying their attributes.
The idea of using the same set of standard notations, the UML, in different
models and throughout the different stages in the UP was emphasized. Using
this framework will reduce the representation gap between our mental model
of the domain and the software representation and result in a much better
system development environment.
TOPIC 3 OBJECT-ORIENTED MODELLING 79
Eriksson, H.-E. and Penkus, M. (2000) Business Modelling with UML · Business
Patterns at Work, Wiley.
Topic 4 X More Use-Cases
LEARNING OUTCOMES
By the end of Topic 4, you should be able to:
1. Employ sub-use cases with the include and extend relationships;
2. Describe the purpose of a UML state diagram at the conceptual
modelling level;
3. Draw simple state diagrams for conceptual classes;
4. Define CRUD and apply it;
5. Describe and apply business rules in requirements analysis;
6. Describe the purpose of robustness analysis; and
7. Draw a set of robustness analysis diagrams for a system.
X INTRODUCTION
This topic consolidates the work done on use cases, and helps you learn more
about the models. While it might seem a bit confusing, in practice either there are
different people working on different aspects of a project, or, in the case of a
small-scale project, the same people are working simultaneously on use cases and
the other models.
Use cases are the core to the whole process, so it is worth spending the time
needed to Âget it rightÊ. But knowing what is ÂrightÊ is often the hard part. As you
will see in this topic, not all writers and practitioners agree on what is right. You
need to work this out for every project.
In the sections on use cases we look at how we can split use cases into sub-use
cases. How far you take this is a bit controversial · as you will see.
A big question when working with use cases is when are you finished? In other
words, when have you found all the use cases? One very useful technique to help
TOPIC 4 MORE USE-CASES W 81
answer this question is to draw some state diagrams. In a nutshell, we take the
main entities from the domain class model and look at the lifecycle of each of
them · when they are created, updated and perhaps deleted.
During the development of the use cases, in one way or another, we need to find
out how the operations and business of the company or organization are running.
Every company or organization has its own policies and rules for doing things,
which can be summarized in a set of business rules. We have probably found bits
and pieces of business rules during the process of writing use cases. There is no
formal way of presenting business rules (in terms of UML or other development
tools). However, as you may realize later, a set of good business rules is
important to each stage in the whole system development project, so it is again
worth dedicating some effort to it.
There are many different approaches and styles to writing use cases. Reasons for
these differences include personal preferences, different styles of application (for
example, a website selling books is different from a stock market trading system),
and different scales/styles of development (for example, two people on a three-
month project work very differently than 50 people on a two-year project).
The next reading is a review of use cases, written by their inventor, Ivar Jacobsen.
He starts with a short history of their development.
http://download.boulder.ibm.com/ibmdl/pub/software/dw/rationaledge/ma
r03/usecases_TheRationalEdge_mar2003.pdf
82 X TOPIC 4 MORE USE-CASES
As you can see from this reading, one aspect of use cases that has been evolving
since 1986 is how we can relate one use case with other use cases. Relating use
cases to each other allows us to see commonalities and differences between them.
One more word of caution. As you saw in the reading, Jacobsen has changed his
views on how best to relate use cases. Use cases are not mathematically defined, so
the relationships between them are not rigorously defined, either. You will
probably find that when you read the details on the different types of relationships,
it will all seem quite simple, but that when you try to apply this knowledge, it can
be quite hard. Everyone, both novices and skilled practitioners, faces the same
problem. The solution is to remember that use cases are for human use.
http://download.boulder.ibm.com/ibmdl/pub/software/dw/rationaledge/ma
r03/usecases_TheRationalEdge_mar2003.pdf
Read pages 4ă5, i.e. the sections ÂUse cases and the unified modelling languageÊ
and ÂUse caution when formalizing use casesÊ.
Note: The rest of this reading, starting from the heading ÂTomorrow: potential
next stepsÊ, is more advanced and theoretical.
TOPIC 4 MORE USE-CASES W 83
Maintain Members
Actor Intention System Responsibility
Identify the borrower Display personal details (name, address, date
of birth, date, joined, etc.) of the borrower,
plus a summary of current borrowings
Optionally, the user can modify the Store the changes
personal details of the member
Optionally, the user can delete the Check that borrower has nothing borrowed
member Delete the member
Now compare this use case with Borrow Videos (from the answer for the
Exercise 2.9). Is there anything in common? Yes. The first line for each is the
same: ÂIdentify the borrowerÊ. As we are looking at use cases in essential format,
this might not seem like very much. But before we can build this system, we will
have to decide how the borrower will be identified. Will the user have a card to
be scanned, or will she give us her name or an identification number? Will she
need to quote a password? So to cater for all these later concerns, we can create a
sub-use case that we will call ÂGet BorrowerÊ. And now both the Borrow Videos
and Identify Members use cases will ÿincludeŸ the Get Borrower sub-use case.
(Note the UML notation of placing the special characters ÿ Ÿ around the word
ÂincludeÊ.)
84 X TOPIC 4 MORE USE-CASES
So now how do our use cases look? In long hand we could have (please refer to
Table 4.2).
Maintain Members
Actor Intention System Responsibility
Include use case Get Borrower ⁄
Maintain Members
Actor Intention System Responsibility
Get Borrower ⁄
The Get Borrower use case is then as follows (please refer to Table 4.4).
Get Borrower
Level: Subfunction
Actor Intention System Responsibility
Identify the borrower Display personal details (name, address,
date of birth, date joined, etc.) of the
borrower ⁄
You will notice the headings at the start of the use case that has level clause. It
tells us that this is a sub-use case, as it only gives us a subfunction. That is, this
use case makes no sense by itself. It needs to be called by another use case.
EXERCISE 4.1
LetÊs again think back to the situation of VictoriaÊs Videos. You already
have a use case to borrow videos. But now Victoria tells you that she would
also like to sell old videos that she doesnÊt need.
Update your use case diagram (from Exercise 2.11) with any new use cases.
The include relationship is the most useful relationship between use cases, and
you can build very sophisticated models using only this relationship. Indeed,
Cockburn (2002, 207), writes:
As a first rule of thumb, always use the includes relationship between use cases.
People who follow this rule report that they and their readers have less confusion
with their writing than people who mix includes and extends and [generalizes].
Cockburn holds this view because his emphasis is on the text of the use cases,
and their role in communicating between people. By contrast, people who put
more emphasis on the use case diagram, particularly when done with a CASE
tool, like the added complexity of having other relationships.
MemberÊs birthdays are marked with a special letter inviting them to borrow any
video of their choice for a week for free.
So we obviously we need a use case to generate the birthday letters · that is, a
straightforward use case. But how do we handle the situation when a person
comes to the shop with their birthday letter wanting to borrow a video for free?
Clearly this is an extension to the use case Borrow Videos.
So how would these use cases look?
Once again you can see weÊre at the subfunction level. The trigger clause tells us
when it gets started, namely when a customer has a birthday letter. The extension
point tells us that the use case Handle a Birthday Letter gets started from the use
case Borrow Videos when it reaches the part Âcalculate total fee dueÊ. This is
called an extension point.
Lastly, to keep the use cases tidy, we can document the Borrow Videos use case
to show that there is an extension. In other words, we make it clear to someone
TOPIC 4 MORE USE-CASES W 87
reading this use case that, as part of Âcalculate total fee dueÊ, there is something
more happening.
Borrow Videos
Extension point: Calculate total fee due
Actor Intention System Responsibility
Get borrower
Identify the videos Calculate the total fees due for any past
fines and the new borrowings
Pass the total amount due to the Cash
Register Terminal
Note that apart from adding the extension point at the start of the Borrow Videos
use case, we have not changed the text of it at all. This is an important aspect of
the extend relationship. Borrow Videos was a complete and whole use case before
we added the birthday letters, so it does not need to change.
A very common use of the extend relationship is for some action that can be
taken at any time. A common example is the ability to print the information on
the screen at any time.
So, for example, if we had the Maintain Members use case, then at any time the
front-desk clerk should be able to print out a summary of the member.
88 X TOPIC 4 MORE USE-CASES
EXERCISE 4.2
The differences between extend and include relationships are given below:
Extend Include
ă Use case with extention (sub) use case ă Use case with common use case
ă The main use case still complete ă Main use case need this sub use
without sub use case case to complete the
ă Just an additional activity process/activity
In general, the problem with the generalize relation is that the professional
community has not yet reached an understanding of what it means to
subtype and specialize behaviour, that is, what properties and options are
implied. Since use cases are descriptions of behaviour, there can be no
standard understanding of what it means to specialize them.
In the previous online reading, Jacobsen gives a rule of thumb for the number of use
cases. He says, Âa large system supporting one business process might have no more
TOPIC 4 MORE USE-CASES W 89
than 20 use casesÊ. This number does not include the sub-use cases, nor the generic
type use cases, such as logon or logoff. Think about VictoriaÊs Videos, where there is
really only one small business function, i.e. renting out videos. We have a lot fewer
than 20 use cases, so this rule seems to hold. However, in practice, with large
systems, it is sometime hard to say what constitutes one business process.
Another way of looking at how many use cases there should be is to note the rate of
discovery of use cases. Typically, an experienced practitioner will identify about 70%
of the use cases pretty quickly. The next section covers some of the techniques
employed when working with users to help make that process as smooth as possible.
But what about the remaining 30% of the use cases? Some of them will become
obvious once you start elaborating the initial 70%. There are also two techniques that
are very useful. Both require that we work with the conceptual class model. (This is
why we are teaching you use case writing and domain modelling in parallel.)
The first technique is to draw state diagrams for the major conceptual classes. On
these diagrams we then write the use case names. In so doing, we often discover
missing use cases.
The second technique is to check that you have use cases to create, read, update
and delete information for every conceptual class.
The following table gives some examples of systems and a list of their conceptual
classes. The third column suggests the conceptual classes that probably require a
state diagram. As you can see, the words in the third column are really the core of
each system.
90 X TOPIC 4 MORE USE-CASES
Table 4.7: Examples of Systems and Conceptual Casses that Require State Diagrams
EXERCISE 4.3
Suppose weÊve just started work and weÊve identified three use cases:
• Admission · Handles the prisoner being transferred from the police or
courts to the prison, and being admitted.
• Transfer · Handles transferring a prisoner to a half-way house.
• Release · Handles the way in which a prisoner is released back into the
community.
In parallel with identifying and writing use cases, we are also working on the
conceptual class model. Quickly we realize that Prisoner is a key conceptual class,
so we start to draw its state diagram.
What does a state diagram look like? Here is an example (please refer to Figure 4.3).
We have boxes with rounded corners to denote each state. Each state must be
given a meaningful name. Notice that the name of the last state ends in ÂedÊ ·
this is a very common ending for English state names.
What this diagram shows is that there are three states that a prisoner can be in.
Next we look at how our use case model supports these states. So what we do is
show the use cases on the state diagram (please refer to Figure 4.4). So our
diagram is now this:
Notice too the starting and end state symbols. These denote the first and last
states, respectively.
So now we could show this diagram to the users to confirm that we are correct in
our understanding. Very likely a person who understands prison systems would
say:
After some discussion with the user, we could redraw the diagram like this
(Figure 4.5):
This new version has a new state called Escaped (notice that it ends in ÂedÊ), and
weÊve identified two new use cases, namely Escape and Re-capture. This is the
92 X TOPIC 4 MORE USE-CASES
crucial point of drawing state diagrams · they help us to quickly find missing
use cases.
Notice in this last diagram that we now recognize that some escaped prisoners
never get recaptured.
EXERCISE 4.4
For VictoriaÊs Videos, draw two separate state diagrams, one for Video Tape,
and one for Member.
ÂThatÊs fine, but prisoners can also escape from being in the half-way house.
Of course if we capture them, then they go back into custody.Ê
You will notice that there are two transitions, or use cases, called Escape. Now
since these refer to the same use case, we can simplify the diagram by introducing
the concept of a super state (please refer to Figure 4.6).
In the next version you can see that there is a super state called Admitted. So
what we are now saying is that if a prisoner is In Custody or In half-way house,
and they Escape, then they will be in the state Escaped. Once they are in the state
Escaped, if they are re-captured, they go to the state In Custody (please refer to
Figure 4.7).
TOPIC 4 MORE USE-CASES W 93
The acronym ÂCRUDÊ stands for Create, Read, Update, and Delete. We need to
examine every class in the conceptual class diagram to ensure that either we have
all of these operations, or we can decide not to include them. For instance, the
delete operation is often omitted.
In this conversation, Sarojini has confirmed that Tiveesha has considered all the
CRUD operations for the conceptual class Member. Her next set of questions
would be about another conceptual class, such as Video.
94 X TOPIC 4 MORE USE-CASES
EXERCISE 4.5
Business rules are probably the most basic part of requirements analysis and
should be done concurrently with the use case modelling. The following reading
explores the relationship between business rules and use cases more fully.
<http://www.ebgconsulting.com/pubs/articles/businessrulesrule_gottesdiener.
pdf>
In fact, besides their role in the use cases, business rules are also linked to other
artifacts in the software development process. The following reading discusses
such links, in particular to user interface designs, data cleansing and validation.
<http://www.sdmagazine.com/documents/s=826/sdm0006j/>
In the last section of the reading, Ambler mentions the object constraint language
(OCL) as a means to express business rules. Other experts disagree. For example,
Gottesdiener says that business rules should be written in a language that the
users understand. We also like to adopt this approach in writing business rules.
The following are some options that we suggest can best express business rules:
• list all the rules in one list, and then refer to the list from everywhere else ·
use cases, screen mockups, class diagrams, etc.;
TOPIC 4 MORE USE-CASES W 95
• simply locate the rules in the use cases, as we have done in this course; and
• keep the use cases simple, but add a section to your use case template to
explicitly refer to the business rules that each use case implements.
So, as you can see, there is a range of possibilities. Additional factors to consider
are the style of system (e.g. does it involve lots of calculations), the size of the
application, the tools that are being used, etc.
So what are the business rules in VictoriaÊs Videos? Here are some examples:
• Only members can borrow videos.
• When a new person requests to become a member, they must show their
driverÊs license or other photo ID.
• The minimum age is 16 years old.
• A member can borrow any number of videos, as long as they have no
overdue videos.
• There are fines for overdue videos.
• The length of time that a video can be borrowed for depends on the video.
New releases are only lent out overnight, current releases are for three-day
hire, and the rest are for a week.
• Members can reserve a video.
• Every video has a classification, (general G, parental guidance PG, mature
audiences MA, and restricted R). Members must be over 18 to borrow R
videos. Every video also has a category: Romance, General, Sci-Fi, Foreign
Language, and Children.
• When a member has a birthday, they are sent a special letter inviting them to
borrow any video of their choice for a week for free.
• Every three months the shop does a stocktake.
• Any missing videos are updated to be shown as missing.
You should recognize most of this text as it is pretty close to the initial description
that you saw from Victoria Videos Case Study in Topic 1. When describing a
system, one very common method is to list and describe the business rules. The
skill of a requirements analyst is to capture these rules and make them into
something that the rest of the design and programming team can work with. Use
cases are a key way of weaving the business rules together to create a system.
96 X TOPIC 4 MORE USE-CASES
EXERCISE 4.6
For each of the example business rules we have just given for VictoriaÊs
Videos, decide if the rule has been captured in any use case(s). If so, name
them. Or, you might note that a business rule has not yet been captured in
any use case.
The previous exercise should have helped you to appreciate the fact that quite a
strong link exists between use cases and business rules, but that each form is
quite different.
From Topic 2 and this topic, our use case model is being developed. We have a
list of actors and use cases. We have a use case diagram of the whole. Some of the
use cases have been written out in detail, while others only have a name. We have
an activity diagram to show how some key use cases fit together.
From Topic 3 we have a conceptual class model, and from this topic as well we
have drawn some state diagrams for the conceptual classes Member and Video
Tape.
So now we want to move on to the design model. But thereÊs a very large gap
between the conceptual domain classes and the design classes. To help us bridge this
gap, thereÊs a technique called robustness analysis (its also sometimes called Âuse case
analysisÊ). This technique can help us to produce a preliminary design. It is
particularly useful for beginners, but even experienced designers, when faced with a
difficult problem, often use this technique.
TOPIC 4 MORE USE-CASES W 97
Figure 4.8: Robustness diagrams help bridge the gap between analysis and design phases
Robustness diagrams are not part of formal UML so most CASE tools do not support
them. But the spirit of this type of diagram is that itÊs really a Âthrow-awayÊ. That is, it
is the act of drawing it that helps you far more than the end product. In fact, as the
semantics of robustness diagrams are quite loose, it is quite possible to have many
different versions of the same thing.
Boundary objects represent all connections between the internal objects of the
system and the outside world. The most common sort of boundary object is part
of a user interface, such as a window or dialog box. Bar code readers are also
represented by boundary objects.
For example, in VictoriaÊs Videos we would have objects to control the bar code
readers.
Entity objects are the objects that represent data that have to be remembered by
the system, either on a more permanent basis beyond the execution of the use
case (such data might be stored in a database table), or for the execution of a use
case. The conceptual domain model should be the source of many of your entity
objects. Typically, you will find new entities that are not on your domain class
diagram. This is not a flaw with your conceptual model, but a sign that the
robustness analysis is helping you.
Controller objects represent anything else you find you need to make the whole
diagram make sense. Things like business rules or processes that are captured by
a use case will be shown as controller objects.
In VictoriaÊs Videos all the logic that makes up the use case would be in a
controller object. In addition, we could put some of the calculations in their own
controller object.
We will study an example, but first we need to note the following rules, which
the robustness diagram must obey:
• Actors only talk to boundary objects.
• Boundary objects only talk to controller objects.
• Controller objects talk to boundary objects, entity objects or other controllers.
• Entity objects talk only to controllers.
TOPIC 4 MORE USE-CASES W 99
If you find that you canÊt model the diagram in this way, then perhaps you need
to add a new object. The set of objects you end up with is a first cut at the set of
design classes.
Of course this diagram needs some words to label all the entities so we know
what it is about. The directions of the arrowheads are not particularly important,
so you can draw them whichever way makes more sense to you.
For those who are already familiar with sequence diagrams, note that we are not
concerned with detailed messages between the objects · that comes later when
we do the sequence diagrams themselves.
So how do you start? Well, you go back to your use cases. Take the text, and, if
you did one, its SSD. Start reading through the use case. Ignore any error
conditions · in other words, take a Âsunny dayÊ approach. Later you can
consider how major/likely errors could be handled.
LetÊs now spend a bit of time working through an extended example of how
robustness diagramming can work in practice.
Example
Refer figure below which shows the SSD for the Process Sale use case (Larman
(2002)):
100 X TOPIC 4 MORE USE-CASES
So letÊs draw a robustness diagram for this. The first line is ÂMake New SaleÊ,
from the cashier to the system. This is represented by a boundary object. From
our rules above, we know that a boundary object can only talk to a controller
object, so draw one. It may look like the following.
The next line of the SSD is ÂEnter ItemÊ. Clearly, this requires another boundary
object called Enter Item.
The next line of the SSD is displaying the description and price. Here we need the
entities Item and Product Specification. The rules say that only controllers can
talk to entities, so we draw lines from the New Sale Controller to the Item and
Product Specification objects.
This keeps on going, but we do not need to show repetition or looping. This is
because weÊre really only interested in finding out what the entities are, rather
than in the detailed timing of how they are used · that happens in later topics.
The next interesting event is when the user indicates that he is ÂdoneÊ. Then we go
and calculate the tax. Here we probably need some more details from the Product
Specification (for example, many countries have different levels of sales tax on
different items). Also, we might need some information on tax rates. So letÊs put
in an entity object called Tax Info with the note Âinvestigate furtherÊ. You may
recall from Topic 3 that no such conceptual class existed, but Tax Info could be a
candidate for being in the class diagram. Once again, the act of drawing a
diagram, in this case a robustness diagram, indicates where there are holes in our
design.
102 X TOPIC 4 MORE USE-CASES
Next we need to store all the information collected. Looking at our conceptual
class diagram, we see that there are two classes involved here, namely Sale and
Sales Line Item.
EXERCISE 4.7
Assuming you had the following use case for Borrow Videos, draw a
robustness diagram to handle the following conditions:
• Use cases are the core of requirements analysis, which lays the foundation of
the whole development project by guiding us to Âdo the right thingsÊ. We
started the discussion of use cases in Topic 2. In this topic, we elaborated on
this by discussing how to relate use cases using sub-use cases, including
ÂextendÊ and ÂincludeÊ.
• One question that always puzzles inexperienced system developers is Âhow
many use cases is enough for this system?Ê In most cases, there is no definite
answer. However, there are techniques that can help us to identify missed use
cases. One of these is drawing Âstate diagramsÊ of the important conceptual
classes in the domain model. Another is to look at the CRUD operations of the
conceptual classes. These methods can, in one way or another, help to identify
a more complete set of use cases for the project.
• Before we wrap up our discussion of requirements analysis, we need to
understand the rules of logic behind the business the targeted system is
serving. Otherwise, we will definitely end up with a system that cannot
function properly. The business rules of the company or organization have to
be studied in detail. Business rules not only can help us do a better
requirements analysis, they will also be referred to by other models later in
the design, implementation and testing stages.
TOPIC 4 MORE USE-CASES W 105
• We also took a look at a tool that can help to bridge the gap between the
requirements and design · robustness analysis. Drawing robustness
diagrams can help us to identify a first-guess set of objects in the use cases.
Rosenberg, D. and Scott, K. (1999). Use Case Driven Object Modelling with UML:
A Practical Approach, Reading, MA: Addison-Wesley.
Von Halle, B. (2002). Business Rules Applied: Building Better Systems Using the
Business Rules Approach, Wiley.
Topic 5 X Dynamic
Modelling
LEARNING OUTCOMES
By the end of Topic 5, learners should be able to:
1. Explain the role of design modelling;
2. Explain the purpose of a UML collaboration diagram;
3. Draw correct UML collaboration diagrams for a system;
4. Describe the purpose of a UML sequence diagram;
5. Draw correct UML sequence diagrams for a system;
6. Draw a design class diagram;
7. Define and use inheritance on a class diagram;
8. Define the term polymorphism;
9. Explain the abstract and concrete classes;
10. Describe the design principles of coupling and cohesion;
11. List other design principles.
X INTRODUCTION
In this topic we carry on from Topic 4 and go into the design stage. You will
really get to ÂseeÊ how an object-oriented system hangs together in terms of
software classes. In particular, you see how the objects pass messages to other
objects, and by doing that, you will get an overview of how the system works.
There are two interaction diagrams in UML. Both show how messages are passed
between objects. This topic describes both in detail.
By working through the robustness diagrams in Topic 4 and the interaction
diagrams in Topic 5 you will learn more about how the software classes will
TOPIC 5 DYNAMIC MODELLING W 107
actually work. Thus the result of the interaction diagrams is to take what has been
learned and start work on the design class diagram.
This topic will also discuss the very important object-oriented concept of
inheritance and polymorphism.
Figure 5.1 depicts the artifacts and the relation between them in the design
model. As you can see, the robustness diagrams act as an interface between
analysis and design.
108 X TOPIC 5 DYNAMIC MODELLING
Notice that in Figure 5.1, while there is one conceptual class diagram, and one
design class diagram, there are several robustness, sequence and collaboration
diagrams. Why is this? Recall from Topic 4 that we draw one robustness diagram
for one use case. Similarly, we take each robustness diagram and then draw
either a sequence and/or a collaboration diagram for each.
The following steps outline how you would go about identifying the first cut of
software classes for the design model:
1. Use the requirements model/use cases/domain model, and find the nouns.
These will most likely be classes.
2. Use the technique of robustness analysis to identify additional classes.
3. Suggest responsibilities.
4. Identify attributes.
5. Identify operations.
We will go into details of how to proceed with these steps in the coming sections.
In UML, a class is drawn as a rectangle with three compartments: one for the
class name and any modifiers, one for attributes and one for operations.
• The class name is a textual string used to identify a class (e.g. ÂCustomerÊ).
Each name has a unique meaning in its context.
Classes should be named using the vocabulary of the domain.
Naming standards should be created (e.g., all classes are singular nouns
starting with a capital letter).
• Operations are the behaviour of a class/object that acts upon the attributes in
the class/object. Operations can have input (in), output (out) and
input/output (inout) arguments.
All arguments have a name and type (separated by a colon) and are prefixed
by the term describing what type of argument they are.
In general, there are three types of operations that could be existed in a class
diagram namely constructor operation, query operation and update operation.
Constructor operation is used to create new objects for a class by giving initial
values for the attributes. The name of the constructor operation is same with the
name of the class. Query operation is used to access only the objectÊs state and
this operation does not change the state of a object (e.g. getName, getPay,
RetrieveID, checkPassword, etc). Finally, update operation is used to update or
change the value of attribute(s) of a object. This update operation will change the
state of the object (e.g. setName, updateAge, etc).
The other details within the class notation will be discussed in the coming sections.
To specify an object, we also use a rectangle, but the name is underlined. In the
following figure, the first box represents the class Member. The second box is for
an object. In this case the object is named Jill. Usually objects are not named ·
they are just anonymous objects. The third box represents an anonymous object
of the class Member.
We can first think about how people communicate. Here are some examples:
• A host for a dinner party announces, ÂDinner is ready.Ê
• An office worker returns to their desk after the lunch break, and her coworker
says to her, ÂWhile you were out I answered your phone · Please ring Jason
Yip on 6343 3472.Ê
• Two people have met at a bar, and at the end of the evening one says, ÂWhatÊs
your phone number?Ê and the other replies, Â3472 3424Ê.
• A mother gives her child a note, ÂHereÊs a note I want you to give to your
teacher.Ê
The following table shows how each of these messages could be expressed in
UML.
The table above summarizes the examples just given, and in the last column gives
you a sample of how the UML message could be written.
Look at the second row. The details ÂJason YipÊ and Â6343 3472Ê within the
parentheses are called parameters.
Now look at the third row · Â:phoneNumberÊ. The colon tells us that an answer
is expected, and the word phoneNumber tells us what sort of an answer is
expected.
112 X TOPIC 5 DYNAMIC MODELLING
Lastly, the fourth row is an example of an object, in this case a note for the
teacher, being passed as part of a message.
The basic notation to show the message passing is quite straightforward. But, like
much of UML, there are many small complexities that only occasionally arise.
This course sticks to the basics.
Interaction diagrams are used to define the class/object interactions within the
system. They show the dynamic aspect of the system, e.g. the flow of messages.
There are two types of interaction diagrams: sequence and collaboration. Both
types are used to describe the behaviour of objects to fulfil a single use case.
The two types of interaction diagrams each have their own strengths and
weaknesses, and so are used slightly differently. Collaboration diagrams (some
textbooks use the term communication diagrams) are a bit more intuitive and are
useful for learning UML. However, they are less used in industry. Sequence
diagrams are more complex and show much more detail.
The following reading describes the strengths and weaknesses of each kind of
diagram in more detail. Examples of each are also given.
Now download Reading 5.1 from myLMS which describes the strengths and
weaknesses of each kind of diagram in more detail. Examples of each are also
given.
Interaction diagrams are a way to show how one use case will be realized in
terms of the software objects. You will notice that, just as with the robustness
diagrams, some of the class names are the same or very similar to the names of
the conceptual classes. This is expected. But this time the name refers to the
software representation of that thing. In addition, you will find that there are
other classes that only exist in software and not in real life.
TOPIC 5 DYNAMIC MODELLING W 113
A collaboration diagram shows the messages the objects send each other. A
message is represented as an arrow near the association line between two objects.
The arrow points to the receiving object. A label near the arrow shows what the
message is. The message tells the receiving object to execute one of its operations.
A pair of parentheses end the message. Inside the parentheses are the parameters
(if any) that the operation works on.
Download Reading 5.2 from myLMS to learn the details of collaboration diagram.
In addition to the notation in the reading, there is also the concept of a multi
object. This is also known as a collection object (such as a list). So a message
which is shown as being sent to a multi object, is really a message sent to the
collector of that object. The collector then finds the correct object.
TOPIC 5 DYNAMIC MODELLING W 115
EXERCISE 5.1
Your task is to translate this diagram into a dialogue between the various
components.
Typically a sequence diagram shows one use case. However, to adequately show
how errors are handled, often extra diagrams are required.
Download Reading 5.3 from myLMS to learn the details of sequence diagram as
shown in the table above.
EXERCISE 5.2
As we work through the use cases or robustness diagram, and we are trying to
decide which object should fulfil a particular function, the word responsibility is
used.
In terms of its actions, an instance of a class may do something itself, may cause
another class to do something by initiating an action or controlling or
coordinating its actions. These are its types of ÂdoingÊ responsibilities that must be
defined appropriately for classes in a system.
A classÊs responsibilities might be: knowing about its own data, knowing about a
related object or knowing about things it can figure out.
Next, we want to encapsulate all the intelligence of the use case into a single
object that we will call Register. Alternatively, you could call it the Process Sale
Use Case Controller. On a real project, once several use cases have been done,
these use case controllers can be re-examined and perhaps combined or tackled in
another way.
Where to begin? We start with the GUI telling the Register its ready to create a
new sale. This is a simple create operation on the class Sale. Next the GUI sends
the Register the id or barcode of the item and the quantity. Next we need to find
out what the item is, as per our robustness diagram. LetÊs just check that this is
correct. So look at the conceptual class model on page below:
TOPIC 5 DYNAMIC MODELLING W 119
What do you notice about the itemId? Is this attribute on the Item class? No, itÊs
not · itÊs on ProductSpecification. But how do we get to ProductSpecification?
From the domain model, we know that it is from the ProductCatalog. We are
trying to get a whole ProductSpecification object back, so note the syntax of
message 5 from Figure 5.9. Next the ProductCatalog object sends a message to the
ProductSpecification collection object, denoted with the special notation. This
collection object finds the correct ProductSpecification and sends it back.
(Note: At this point we have assumed that all these objects are sitting around just
waiting for us to talk to them. In reality of course they would be in a database,
and we would have to do some work to get them out. Getting data in and out of
databases is not covered in this module.)
no more items, so we need to calculate the total. Once again the Register
delegates this task to the Sale object which then in turn asks each SalesLineItem
for its total. Each SalesLineItem asks its ProductSpecification for its price.
Lastly, the payment is made (assume itÊs cash only, and that correct money is
given) and the Payment object is created.
So now we have one collaboration diagram for the use case Process a Sale. Of
course, we could also show this as a sequence diagram.
EXERCISE 5.3
EXERCISE 5.4
Draw a collaboration diagram and a sequence diagram for the use case
Borrow Videos in the VictoriaÊs Video case.
A design class diagram describes classes that will exist in software. As we work
through each use case and draw interaction diagrams we figure out what these
classes are. There are different ways to come up with a design class diagram. One
way is to base it on the interaction diagrams we have. As an example, we can
produce our first version of a design class diagram of the video sale simply by:
• drawing the classes from the interaction diagrams
• if a message is passed from class A to class B, then draw a line between them
• add the messages received by a class as one of its operations.
122 X TOPIC 5 DYNAMIC MODELLING
Notice how in this diagram, the names of the classes are not underlined · this
means these are classes rather than objects.
As you learned in the previous section, there are more details of classes that are
needed that we havenÊt yet worked on. We now discuss these individually.
5.3.1 Visibility
The visibility of an attribute or method within a class determines what other
objects can access it. The options are:
• Public visibility · denoted by Â+Ê in UML (or by an icon in the tool) means
that objects of any class can use the attribute or operation.
• Protected visibility · denoted by Â#Ê in UML (or by an icon in the tool) means
that only objects of that class or its subclasses can use the attribute or
operation. Subclasses are discussed later in this topic.
• Private visibility · denoted by Â-Ê in UML (or by an icon in the tool) means
that objects of only that class can use the attribute or operation.
5.3.3 Association
An association is a connection between classes and is shown as a line connecting
the related classes. If there are no arrows on the line, it is assumed to be bi-
directional. An association represents that one or methods of Class B can report
about the relationship of Class A to Class B and vice versa. The association can be
bi-directional or uni-directional. An arrowhead on the end of the line is used to
represent uni-directional navigability. In Figure 5.11, the class User knows about
the class Password, but not the other way around.
In the domain model, when we drew the associations on the conceptual class
diagram, we were not concerned with how the objects were accessed. It was
enough to say that there was an association. With design the class diagram we are
concerned with how the objects can be accessed. Thus we may specify the
direction of access, as shown in Figure 5.11.
Figure 5.13 depicts the final version of the design class diagram of the Process a
Sale use case.
Figure below shows a design class diagram which has association, composition
and aggregation relationships. Multiplicity of an association between classes also
shown in the figure below:
Notice that with both types of aggregation and composition relationships, the
diamond is located on the side of the line pointing to the class which represents
the "whole" in the relationship. Aggregation is a special form of association that is
tighter than a normal association. Aggregation means that there is a whole-part
relationship. Furthermore, the parts usually cannot exist without the whole.
Aggregation causes much confusion. As Martin Fowler writes in UML Distilled,
2nd edn, page 85:
You probably notice that the design class diagram is very similar to the
conceptual class diagram that we produced in the domain model. However, there
are some differences. The following table summarizes these key differences.
126 X TOPIC 5 DYNAMIC MODELLING
Table 5.3: Key Differences between Conceptual and Design Class Diagrams
Methods Usually very few Add many more, with full parameters.
EXERCISE 5.5
Draw a design class diagram for the Borrow Videos use case in VictoriaÊs
Videos.
5.4 INHERITANCE
Inheritance is a vital aspect of object-orientation and we have briefly discuss
about this concept in Topic 1. Inheritance is a relationship between objects. It is
known as the Âis-aÊ relationship. This contrasts with an association relationship,
which is the Âhas-aÊ relationship. Inheritance relationships can be shown on both
conceptual class diagrams and design class diagrams.
LetÊs look at an example. Imagine you were writing a system to handle vehicle
registrations for the Transport Department. This system has to handle many
different types of vehicles, namely cars, motorbikes and buses. All of these have
some things in common, and some things that are different. If we were to draw
the classes we might have the following (please Refer to Figure 5.14):
TOPIC 5 DYNAMIC MODELLING W 127
So what do you notice? They all have the attribute licencePlate and the operation
requestInspection. So we abstract these out into a new superclass called Vehicle,
and create three subclasses (please refer to Figure 5.15).
Note that the arrow is drawn pointing from the subclass to the superclass.
(Initially you may find this arrow counter-intuitive). The arrows can be drawn in
various ways, as shown in figure 5.16 · the choice is yours.
So we have the general concept of a vehicle and its specializations. We say that a
Car is-a vehicle, a Bus is-a vehicle and MotorBike is-a vehicle.
The superclass holds the attributes and methods that are common to all of its
subclasses. Each of the subclasses then can optionally have additional attributes
and operations.
specifying the design classes, inheritance is a powerful tool to simplify the design
by expressing commonalities succinctly.
When a subclass inherits from a superclass it inherits everything that the
superclass has. A subclass inherits all the attributes, operations and relationships
of the superclass. Here is an example:
Can we say a Bus has-a Owner? The answer is yes, because all relationships are
also inherited.
Can objects change class? This is an important question and a very good
illustration of the difference between conceptual and design class diagrams. LetÊs
ask the question, can a bus become a motorbike? Clearly in the real world this is
nonsense. But another example is not so clear.
Yes, we could always write some code to delete the Child object, and create an
Adult object, but that is a very messy approach. For a design class diagram it is
far better not to use inheritance, but to use a plain association (please refer to
Figure 5.19).
EXERCISE 5.6
EXERCISE 5.7
5.4.1 Polymorphism
Polymorphism is very much related to inheritance. Consider the following
example (please refer to Figure 5.20):
130 X TOPIC 5 DYNAMIC MODELLING
The inheritance tree for a number of document types is shown in Figure 6.3.
Notice that each of the document types in the tree has a print method. So when
an owner object wants to print a document, it simply sends a ÂprintÊ message to
the document. The important point is that the owner object does not need to
know what type of document it is before it can issue the print command. This
concept is known as polymorphism · taking on many forms. Note that
polymorphism does not imply that objects change class. It means that the exact
code of the method will change according to the class of the object that receives
the message.
A concrete class is class that has objects. Up until this topic, all the classes we
have discussed were concrete classes.
Figure 5.21: Abstract and Concrete classes ă allowed and not allowed
There are two ways of specifying abstract and concrete classes in UML. One way
is to put the name of the class in italics; the other way is to put the word abstract
in curly brackets as shown in the figure below.
sequence diagrams or collaboration diagrams. For the static view of the design
model, the UML representation is the design class diagrams. To make the design
model work better, there are some design class principles that we need to follow.
This section looks at some principles that a good object-oriented design should
embody namely cohesion and coupling. This section is about how you can
evaluate a design. In your work to date, sometimes you may have seen that there
were choices in how you approached something. For example, should you split a
class into two separate classes, or which class should implement a certain
method? In this section, we provide some terminology for you to discuss a design
in terms of various pros and cons. As with all design endeavours · be it interior
design, clothing, town planning, or whatever · trade-offs need to be made.
As you saw in previous topics, the design classes initially come straight from the
conceptual model, and then are added to, changed, merged or whatever as a
solution develops. As the design develops, it must be constantly evaluated
against the following object-oriented design principles.
5.5.1 Coupling
Coupling comes from the structured methods of Edward Yourdon, a developer of
object-oriented design models. Coupling represents the strength of association
between two classes. Two classes are coupled if one of them uses, refers to the
other, or in some way has knowledge of the other.
Looking back at Figure 5.12, we can say that Borrowing and Video are coupled,
while Member and Video are not. To confirm this, we could read through the
code of the methods of the Member and Video classes to confirm that neither
sends any messages to the other.
If a class changes, then all coupled classes will (probably) change. So strong
coupling complicates a system in that it is harder to change and understand one
class if it is highly interrelated with other classes. Further, tightly coupled classes
are difficult to reuse in later systems. Loose coupling seeks to make a system
easier to understand, maintain and change. You can classify coupling into
different types· the four most basic forms are (see Richter, p. 133)
Ć Identity coupling
Ć Representational coupling
Ć Subclass coupling
Ć Inheritance coupling
TOPIC 5 DYNAMIC MODELLING W 133
Accessing the public method foo in the class X, as in Figure 5.23, is a very low-
level approach and so has a high degree of representational coupling.
Figure 5.23: Method getFoo is an example of a ÂgetterÊ · it gets the value of an attribute
On the other hand, using the method getFoo, which would simply give us the
value of attribute foo, is a low level of representational coupling. The latter
version is preferred as the low-level implantation details of class X are hidden.
This is encapsulation.
Subclass coupling occurs when a client class directly references a subclass rather
than its superclass. This is to be avoided wherever possible (please refer to Figure
5.24).
5.5.2 Cohesion
Cohesion also comes from the structured methods of Edward Yourdon and is a
measure of how focused the functionality of a class is. A class has high cohesion if
it only represents one idea.
EXERCISE 5.8
• In this topic, we entered the design phase of the system. With all (or most) of
the artifacts and documents in the analysis phase being complete, we begin to
see how the system can be built and how the software classes and objects can
work together to achieve the tasks that we identified in the analysis.
• The design model consists of two broad types of artifacts, namely the
interaction diagrams and the design class diagram. The interaction diagrams
will give us the dynamic look of the system that indicates the sequence of
exchange of messages between the classes. The design class diagram will depict
the relationship between the classes and give more details of the structure of
the classes and the operations that they can perform.
• We have also studied a very important property of object-oriented design ·
the inheritance of classes besides polymorphism, abstract and concrete classes.
136 X TOPIC 5 DYNAMIC MODELLING
• At the same time, the principles of good object-oriented design have been
introduced to you.
• In this course, we have learnt object oriented approach in software
development.
• We also have focus on Unified Process and UML.
Fowler, M. and Scott, K. (2000). UML Distilled, 2nd edn, Addison-Wesley. (This is
a short and practical overview to using UML in actual practice.)
Scott, K. (2001). UML Explained, Addison-Wesley. (This book presents the basics
of UML.)
Exercise 1.2
message
data
138 ANSWERS
1. messages
2. class
3. instance
Exercise 1.3
(a) There are several possible answers, including:
Risk mitigation · by working on the riskiest aspects of a project we
can either address any problems or stop the project early rather than
waiting until the end.
Provide early and tangible results to users, thus getting greater
cooperation.
Instil the habit of delivering artifacts regularly. This means the project
maintains momentum and does not become mired in fussy details or
features that are not absolutely necessary.
Exercise 1.4
Traditional Object-oriented
Approach to data and functions Consider separately Consider together
System development life cycle Waterfall Iterative
(SDLC)
Notations Entity-relationship (ER) UML diagrams
diagrams
Data Flow Diagrams (DFDs)
Example languages COBOL, various 4GLs Java, C++
Database Relational databases Usually still use
relational databases
ANSWERS 139
Exercise 1.5
A student registers on an OUM course
The student receives a registration package from the Registry by mail.
He/she looks up the courses list provided in the Prospectus or Courses
Supplement. He/she decides which courses he/she would like to register on
in the coming semester. He/she fills in the registration form and mails it back
to the Registry. He/she receives a payment slip from the Registry. He/she
goes to the designated bank to pay the tuition fee for the courses he/she has
registered on. He/she receives instructions from the Registry to collect the
course materials and the study schedules for the courses.
(a) functional
(b) non-functional
(c) functional
(d) non-functional
Exercise 2.2
Functional requirements:
register members
track overdue videos
produce a daily upload file for the general ledger
print letters for members on their birthdays.
Non-functional requirements:
speed of the system should allow a video borrowing transaction to be
completed within one minute
the barcode reader should be at least 99.5% accurate
a front desk clerk should be able to become familiar with all the functions of
the system within one week.
Exercise 2.3
Exercise 2.4
Exercise 2.5
Borrow a video · brief format for an initial version of the use case
This use case starts when the member finishes selecting their videos and brings
them to the front desk. The front desk clerk asks to see their membership card.
The clerk then enters the memberÊs number into the system. The front desk clerk
then scans the barcodes of the memberÊs videos. The system calculates the price
according to whether the videos are new releases, current releases, or other, and
the price is displayed on the cash register terminal. The customer pays by credit
card or cash, and then leaves the shop with their videos.
142 ANSWERS
The most important actor is the front desk clerk because this actor serves the
members. After all, if there were no members, then the video shop would go out
of business. Similarly, if nobody borrowed any videos, then it would be time to
pack up and go home.
Exercise 2.6
The following list has the main use cases that you might have identified. Note
that there are other use cases, which we will find during later analysis. You might
have already thought of some of these yourself. Obviously the more use cases
you find earlier, the easier the whole process is.
Exercise 2.7
1. Return Videos
This use case is used when a member returns videos. The front desk clerk
scans the videos and the system is updated to show the videos as returned.
(As you can see, some use cases are very simple.)
Exercise 2.8
Exercise 2.9
Borrow videos
Exercise 2.10
Here are just a few examples. They are many, many more:
Is it true that members will not use the computer system? That is, will
everything be done through the clerk?
144 ANSWERS
Exercise 2.11
Later in the unit we show you a way for dealing with large systems with
hundreds of use cases.
Exercise 2.12
Customer Front desk clerk Cash register
(external)
Used italics as
nothing to do Select Borrow
with computer videos videos
system
Create
member
Take
money
There are many ways you could draw this. In particular, the big question is, what
is the ÂsystemÊ. Here are two examples.
:System
:FrontDeskClerk
borrowVideos()
* enterVideo(videoID)
* displayTitle
allVideos()
Gives Total
makePayment(amount)
Change, receipt
In version 2 the important issue is how the CashRegisterTerminal gets told the
total amount. Does it come from the Video Tracking System, or from the user?
Version 2 clearly shows that the Video Tracking System tells the terminal.
The preceding diagrams were drawn using the Sequence Diagram tool in Visual
Paradigm. Note that the enterVideo and disaplayTitle messages have a Â*Ê prefix.
The Â*Ê represents iteration. You may have noticed in your textbook, a rectangle is
placed in the diagram to enclose a group of messages to indicate that the
messages are iterated together. However, the Sequence Diagram tool in Visual
Paradigm does not allow the placing of rectangles in the diagram.
ANSWERS 147
Exercise 3.3
Exercise 3.4
Exercise 3.5
ANSWERS 149
Exercise 3.6
What do you notice about the last line? ItÊs the same as the last line of the Borrow
Videos use case.
Level: Subfunction
Actor Intention System Responsibility
Get payment Pass the total amount due to the Cash Register Terminal
And then updating the other two use cases gives us the following.
Borrow Videos
Actor Intention System Responsibility
Get Borrower (note underline) Display details of current borrowings
Identify the videos Calculate the total fees due for any past fines and the
new borrowings
Process Payment (note underline)
Exercise 4.2
Maintain Members
Extension point: At any point once the memberÊs details are displayed
Actor intention System responsibility
Get Borrower Display personal details (name, address, date of
birth, date joined, etc.), plus a summary of
current borrowings (e.g. total number borrowed,
total number of overdues, current number
borrowed, current number overdues)
Optionally, the user can modify Store the changes
the personal details of the member
Optionally, the user can delete the Check that the borrower has nothing borrowed
member Delete the member
Exercise 4.3
The most obvious entity that we wish to track is each Video Tape.
The other entity for which a state diagram could be useful is the class Member.
The problem discussion did not mention that if a member has too many
overdues, then she is not allowed to borrow, but this is the sort of fact that should
be verified with individual users if a state diagram is used.
As we stated, it is not wrong to draw state diagrams for other classes, it is simply
that they will be very simple and you will not learn from them. But of course the
best way to find this out is to draw them.
Exercise 4.4
The first version for the state diagram for Video Tape might look like this:
Borrow Videos
On-Shelf Borrowed
Return Videos
Then you could think about how a video tape comes into existence. Clearly we
are missing a use case here · letÊs call it Get New Video Tapes.
And what about the final state? An initial answer could be to create another new
use case, this time called Retire Video Tapes. Clearly we have uncovered new
functionality and would need to go back to the users to discuss this. For example,
perhaps they try to sell some old video tapes.
Lastly, letÊs think about lost or missing video tapes. Once again, we would need
to discuss this with Victoria, and the answer could be the following.
ANSWERS 153
Record Stocktake
Findings Write-off
Video Tape
Exercise 4.5
If you think about all the use cases we have discussed so far, you should realize
that the only use case that might have something to do with the Video
Specification class is the use case that we identified in the answer to Exercise 4.4,
namely Get New Video Tapes.
So the next step would be write that use case, and then continue with the review.
Exercise 4.6
Exercise 4.7
Show Password
VideoTape
Get
VideoTape
Scan Video
Payment
Register
Give price and Finalise Video Title
get confirmation
that paid
Borrowing
Confirm
complete
Exercise 5.2
Exercise 5.3
ANSWERS 157
Exercise 5.4
Exercise 5.5
158 ANSWERS
Exercise 5.6
Exercise 5.7
Exercise 5.8
1. The second diagram; having the functionality for Chess and Checkers in the
same class (BoardGame) is not functionally cohesive.
2. The second diagram. The first diagram has the Player class creating a
CheckersMove class for the CheckersBoard class. The second diagram lets
the CheckersBoard class deal with the CheckersMove class itself.
3. Figure B has less coupling because every class has at most one association
with another class.
APPENDIX
APPENDIX 1
Case studies are a useful and increasingly popular form of learning and
assessment in the OUMÊs Faculty of Information Technology & Multimedia
Communication. Hence, this course will make use two case studies.
This section will look at why case studies are used and then suggest some
learning strategies that you can use to approach case studies. We will also briefly
discuss some problems that you may encounter as you learn from case studies.
LetÊs have a look at two kinds of case study questions that you might be asked to
work through in your courses. The first example is quite structured, while the
second is much more open-ended.
160 APPENDIX
Case studies are not meant to replace textbooks, but rather to ask you to draw
connections between theories and practice and to apply abstract ideas, concepts,
and principles to specific concrete situations. Consequently, case analysis
develops a number of skills that are crucial in business. In particular, they help
you to:
analyse complex, unstructured, sometimes ambiguous situations;
identify critical issues and problems;
question your own and othersÊ assumptions;
APPENDIX 161
You may find that there are many possible ÂrightÊ answers to the questions in a
case study. This illustrates that there is often no single best way to responsibly
manage and solve real-life business problems.
Read the case again, and this time note down critical facts (such as names,
time sequences, and where events occurred). Try to understand how events
have influenced decisions. Identify the important individuals or
stakeholders, and try to assess the importance of supporting information in
the case. How reliable is this supporting information? Are there any gaps in
the information that is given?
Make a note of any questions that you have as you read the case.
Key players and systems: How do systems and people operate in this
organization? Why do they operate like this? Are the systems
undergoing change? How successful are the changes? Is there
someone who could sabotage any future strategy? Is there someone
who can ensure the success of a future strategy?
Significant trends: How does this industry operate? What are the main
or unique characteristics of the industry? What were they five or ten
years ago, and what are they likely to be in the future? What impact
are trends likely to have on the organization under investigation?
How does this organizationÊs performance compare with that of
competitors?
Constraints: Clearly identify all constraints in the case. A constraint
may be viewed as anything (usually beyond the control of the
organization) that may prevent an otherwise feasible course of action
from becoming a success. What is outside the control of individuals in
the case study? For example, it is unlikely that any company or
individual in Hong Kong could prevent a foreign government from
imposing tariff barriers on imports.
Increased prices
Reduced marketing
budget
Fall in revenue
Increased costs
Poor overseas sales
If there are several problems, you need to order and prioritize them. You
might want to number problems according to how you perceive their
importance, or make a matrix, like the one below, which shows
relationships between various criteria and each problem.
Ask yourself what assumptions you have made about the case. Are these
assumptions reasonable, and are they supported by the facts? Would other
people objectively suggest the same problems, based on the facts that you
have? Are you suggesting problems that are not supported by the facts of
the case?
After you have considered and put into order the possible problems and
questioned your assumptions relating to these problems, you should write a
statement of the problems as you perceive them. Avoid suggesting
solutions at this stage.
Once you have a problem statement, you need to find evidence in the case to
support your problem diagnosis. Also, try to identify ideas, concepts and
theories from your textbook and course units which help to explain what is
happening in the case.
Also refer to ideas, concepts and theories from your course materials as you
consider and assess each possible solution.
APPENDIX 165
ItÊs often wise to propose a solution that allows for plausible alternatives if
it should fail. Managers use the term satisfice when they are considering
acceptable alternative solutions, that is, the solution is able to satisfy the
situation while also making some realistic sacrifices to existing constraints.
Therefore, it is a satisficing rather than a maximizing solution.
Analysing cases poses many challenges, and this is one reason the case study
method is so rewarding. It is a very active form of learning. It offers you a risk-
free opportunity to gain managerial and organizational experience and should
greatly increase your confidence to make informed decisions in the real world.
Good luck and we hope you enjoy working through the cases that you encounter!
MODULE FEEDBACK
MAKLUM BALAS MODUL
Should you have any comment or feedback, you are welcomed to:
OR
Thank you.