Object Oriented System Design
Object Oriented System Design
Object Oriented System Design
UNIT - I
CONTENTS
1.0 AIMS AND OBJECTIVES
1.1 INTRODUCTION
1.7 REFERENCES
The object oriented philosophy and why it is needed
The unified approach , methodology used to study the object oriented concepts
1.1 INTRODUCTION
Today a vast number of tools and methodologies are available for systems
development.
systems analysis
Systems development activities consists of
modeling,
design
implementation,
testing, and
maintenance.
“A software system is a set of mechanisms for performing certain action on certain data.”
traditional approach
- focuses on the functions of the system
object-oriented systems development
- centers on the object, which combines data and functionality.
In an object-oriented environment,
Example
. Promotion of reusability.
Objects are reusable because they are modeled directly out of a real-world
problem domain. Each object stands by itself or within a small circle of peers (other
objects). Within this framework, the class does not concern itself with the rest of the
system or how it is going to be used within a particular system.
The unified modeling language (UML) is a set of notations and conventions used
to describe and model an application. But, the UML does not specify a methodology or
what steps to follow to develop an application; that would be the task of the UA. Figure
1-1 depicts the essence of the unified approach. The heart of the UA is Jacobson's use
case. The use case represents a typical interaction between a user and a computer system
to capture the users' goals and needs.
The main advantage of an object-oriented system is that the class tree is dynamic
and can grow. Your function as a developer in an object-oriented environment is to foster
the growth of the class tree by defining new, more specialized classes to perform the
tasks your applications require. After your first few projects, you will accumulate a
repository or class library of your own, one that performs the operations your applications
most often require. At that point, creating additional applications will require no more
than assembling classes from the class library.
5
An object orientation produces systems that are easier to evolve, more flexible, more
robust, and more reusable than a top-down structure approach. An object orientation
Use-case driven development.
Utilizing the unified modeling language for modeling.
Object-oriented analysis (utilizing use cases and object modeling).
Object-oriented design.
Repositories of reusable classes and maximum reuse.
The layered approach.
Incremental development and prototyping.
Continuous testing.
1.7 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
7
CONTENTS
2.0 AIMS AND OBJECTIVES
2.1 INTRODUCTION
2.2 OBJECTS
2.2.1 OBJECTS ARE GROUPED IN CLASSES
2.2.2 ATTRIBUTES: OBJECT STATE AND PROPERTIES
2.2.3 OBJECTS RESPOND TO MESSAGES
2.3 ENCAPSULATION AND INFORMATION HIDING
2.4 CLASS HIERARCHY
2.4.1 INHERITANCE
2.4.2 DYNAMIC INHERITANCE
2.4.3 MULTIPLE INHERITANCE
2.5 POLYMORPHISM
2.6 OBJECT RELATIONSHIPS AND ASSOCIATIONS
2.12 REFERENCES
The main aim of this lesson is know about the basic concepts of the objects and object
oriented programming. At the end of this lesson you will be familiar with the concepts of
Objects
Classes
Attributes
Inheritance
8
Polymorphism
Messages
Aggregations and Object Containment
Object Persistence
Meta-classes
2.1 INTRODUCTION
In an object-oriented system, the algorithm and the data structures are packaged
together as an object, which has a set of attributes or properties. The state of these
attributes is reflected in the values stored in its data structures. In addition, the object has
a collection of procedures or methods-things it can do-as reflected in its package of
methods. The attributes and methods are equal and inseparable parts of the object; one
cannot ignore one for the sake of the other. For example, a car has certain attributes, such
9
as color, year, model, and price, and can perform a number of operations, such as go,
stop, turn left, and turn right.
2.2 OBJECTS
The term object was first formally utilized in the Simula language, and objects
typically existed in Simula programs to simulate some aspect of reality. The term object
means a combination of data and logic that represents some real world entity. For
example, consider a Saab automobile. The Saab can be represented
in a computer program as an object. The "data" part of this object would be the car's
name, color, number of doors, price, and so forth. The "logic" part of the object could be
a collection of programs.
Classes are used to distinguish one type of object from another. In the context of
object-oriented systems, a class is a set of objects that share a common structure and a
common behavior; a single object is simply an instance of a class A class is a
specification of structure (instance variables), behavior (methods), and inheritance for
objects.) Classes are an important mechanism for classifying objects. The chief role of a
class is to define the properties and procedures (the state and behavior) and applicability
of its instances. The class car, for example, defines the property color. Each individual
car (formally, 9th instance of the class car) will have a value for this property, such as
maroon, yellow, or white. In an object-oriented system, a method or behavior of an object
is defined by its class.
FIGURE 2.1 Sue, Bill, AI, Hal, and David are instances or objects of the class
Employee.
An object's capabilities are determined by the methods defined for it. Methods
conceptually are equivalent to the function definitions used in procedural languages. For
example, a draw method would tell a chart how to draw itself. However, to do an
operation, a message is sent to an object. Objects perform operations in response to
messages. For example, when you press on the brake pedal of a car, you send a stop
message to the car object. The car object knows how to respond to the stop message,
since brakes have been designed with specialized parts such as brake pads and drums
precisely to respond to that message. Sending the same stop message to a different object,
such as a tree, however, would be meaningless an could result in an unanticipated
response.
A message has a name, just like a method, such as cost, set cost, cooking time. An
object understands a message when it can match the message to a method that has a same
name as the message. To match up the message, an object first searches the methods
defined by its class. If found, that method is called up. If not found, the object searches
the super class of its class. If it is found in a super class, then that method is called up.
Otherwise, it continues the search upward. An error occurs only if none of the
superclasses contains the method. A message differs from a function in that a function
says how to do something and a message says what to do. Because a message is so
general, it can be used over and over again in many different contexts. The result is a
system more resilient to change and more reusable, both within an application and from
one application to another.
13
Information hiding is the principle of concealing the internal data and procedures
of an object and providing an interface to each object in such a way as to reveal as little
as possible about its inner workings. As in conventional programming, some languages
permit arbitrary access to objects and allow methods to be defined outside of a class. For
example, Simula provides no protection, or information hiding, for objects, meaning that
an object's data, or instance variables, may be accessed wherever visible. However, most
object-oriented languages provide a well-defined interface to their objects through
classes. For example, C++ has a very general encapsulation protection mechanism with
public, private, and protected members. Public members (member data and member
functions) may be accessed from anywhere. For instance, the compute Payroll method of
an employee object will be public. Private members are accessible only from within a
class. An object data representation, such as a list or an array, usually will be private.
Protected members can be accessed only from subclasses.
By contrast, super classes generalize behavior. It follows that a more general state
and behavior is modeled as one moves up the super class-subclass hierarchy (or simply
class hierarchy) and a more specific state is modeled as one move down. It is evident
from our example that the notion of subclasses and super classes is relative. A class may
simultaneously be the subclass to some class and a super class to other classes. Truck is a
subclass of a motor vehicle and a super class of both 18-wheeler and pickup. For
example, Ford is a class that defines Ford car objects (see Figure 2.5). However, more
specific classes of Ford car objects are Mustang, Taurus, Escort, and Thunderbird. These
classes define Fords in a much more specialized manner than the Ford car class itself.
Since the Taurus, Escort, Mustang, and Thunderbird classes are more specific classes of
Ford cars, they are consider ed subclasses of class Ford and the Ford class is their super
class. However, the Ford class may not be the most general in our hierarchy. For
instance, the Ford class is the subclass of the Car class, which is the subclass of the
Vehicle class. The car class defines how a car behaves.
The Ford class defines the behavior of Ford cars (in addition to cars in general),
and the Mustang class defines the behavior of Mustangs (in addition to Ford cars in
general) wanted was a Ford Mustang object, you would write only one class, Mustang.
The class would define exactly how a Ford Mustang car operates. This methodology is
limiting because, if you decide later to create a Ford Taurus object, you will have to
duplicate most of the code that describes not only how a vehicle behaves but also how a
car, and specifically a Ford, behaves. This duplication occurs when using a procedural
language, since there is no concept of hierarchy and inheriting behavior. An object-
oriented system eliminates duplicated effort by allowing classes to share and reuse
behaviors.
15
You might find it strange to define a Car class. After all, what is an instance of the
Car class? There is no such thing as a generic car. All cars must be of some make and
model. In the same way, there are no instances of Ford class. All Fords must belong to
one of the subclasses: Mustang, Escort, Taurus, or Thunderbird. The Car class is a formal
class, also called an abstract class. Formal or abstract classes have no instances but
define the common behaviors that can be inherited by more specific classes.
In some object-oriented languages, the terms super class and subclass are used instead of
base and derived. In this book, the terms super class and subclass are used consistently.
2.4.1 INHERITANCE
For example, the Car class defines the general behavior of cars. The Ford class
inherits the general behavior from the Car class and adds behavior specific to Fords. It is
not necessary to redefine the behavior of the car class; this is inherited. Another level
down, the Mustang class inherits the behavior of cars from the Car class and the even
more specific behavior of Fords from the Ford class. The Mustang class then adds
behavior unique to Mustangs. Assume that all Fords use the same braking system. In that
case, the stop method would be defined in class Ford (and not in Mustang class), since it
is a behavior shared by all objects of class Ford. When you step on the brake pedal of a
Mustang, you send a stop message to the Mustang object. However, the stop method is
not defined in the Mustang class, so the hierarchy is searched until a stop method is
found. The stop method is found in the Ford class, a super class of the Mustang class, and
it is invoked (Figure 2.6). In a similar way, the Mustang class can inherit behaviors from
the Car and the Vehicle classes.
Dynamic inheritance allows objects to change and evolve over time. Since base
classes provide properties and attributes for objects, changing base classes changes the
properties and attributes of a class. A previous example was a Windows object changing
into an icon and then back again, which involves changing a base class between a
Windows class and an Icon class. More specifically, dynamic inheritance refers to the
ability to add, delete, or change parents from objects (or classes) at run time.
In object-oriented programming languages, variables can be declared to hold or reference
objects of a particular class. For example, a variable declared to reference a motor vehicle
is capable of referencing a car or a truck or any subclass of motor vehicle.
Some object-oriented systems permit a class to inherit its state (attributes) and
behaviors from more than one super class. This kind of inheritance is referred to as
multiple inheritance. For example, a utility vehicle inherits attributes from both the Car
and Truck classes.
Multiple inheritance can pose some difficulties. For example, several distinct
parent classes can declare a member within a multiple inheritance hierarchy. This then
can become an issue of choice, particularly when several super classes define the same
method. It also is more difficult to understand programs written in multiple inheritance
systems.
One way of achieving the benefits of multiple inheritance in a language with
single inheritance is to inherit from the most appropriate class and then add an object of
another class as an attribute.
2.5 POLYMORPHISM
Poly means "many" and morph means "form." In the context of object-oriented
systems, it means objects that can take on or assume many different forms.
Polymorphism means that the same operation may behave differently on different classes.
Booch defines polymorphism as the relationship of objects of many different classes by
some common super class; thus, any of the objects designated by this name is able to
respond to some common set of operations in a different way. For example, consider how
driving an automobile with a manual transmission is different from driving a car with an
automatic transmission. The manual transmission requires you to operate the clutch and
the shift, so in addition to all other mechanical controls, you also need information on
when to shift gears. Therefore, although driving is a behavior we perform with all cars
(and all motor vehicles), the specific behavior can be different, and depending on the kind
of car we are driving. A car with an automatic transmission might implement its drive
method to use information such as current speed, engine RPM, and current gear.
18
ASSOCIATIONS
Association represents the relationships between objects and classes. For example,
in the statement "a pilot can fly planes" (Figure 2.7) the italicized term is an association.
Associations are bidirectional; that means they can be traversed in both directions,
perhaps with different connotations. The direction implied by the name is the forward
direction; the opposite direction is the inverse direction. For example, can fly connects a
pilot to certain airplanes. The inverse of can fly could be called is flown by.
Consumer-Producer Association
server. For example, we have a print object that prints the consumer object. The print
producer provides the ability to print other objects. Figure 2.8 depicts the consumer-
producer association.
All objects, except the most basic ones, are composed of and may contain other
objects. For example, a spreadsheet is an object composed of cells, and cells are objects
that may contain text, mathematical formulas, video, and so forth. Breaking down objects
into the objects from which they are composed is decomposition. This is possible because
an object's attributes need not be simple data fields; attributes
can reference other objects. Since each object has an identity, one object can refer to
other objects. This is known as aggregation, where an attribute can be an object itself.
For instance, a car object is an aggregation of engine, seat, wheels, and other objects (see
Figure2.9).
FIGURE 2.9 A Car object is an aggregation of other objects such as engine, seat,
and wheel objects.
20
Objects have a lifetime. They are explicitly created and can exist for a period of
time that, traditionally, has been the duration of the process in which they were created.
A file or a database can provide support for objects having a longer lifeline longer than
the duration of the process for which they were created. From a language perspective, this
characteristic is called object persistence. An object can persist beyond application
session boundaries, during which the object is stored in a file or a database, in some file
or database form. The object can be retrieved in another application session and will have
the same state and relationship to other objects as at the time it was saved. The lifetime of
an object can be explicitly tenninated. After an object is deleted, its state is inaccessible
and its persistent storage is reclaimed. Its identity, however, is never reused, not even
after the object is deleted. Object storage and its access from the database will be covered
in later chapters
The real advantage of using the object-oriented approach is that you can build on
what you already have. Object-oriented software development is a significant departure
21
from the traditional structured approach. The main advantage of the object-oriented
approach is the ability to reuse code and develop more maintainable systems in a shorter
amount of time. Additionally, object-oriented systems are better designed, more resilient
to change, and more reliable, since they are built from completely tested and debugged
classes.
Rather than treat data and procedures separately, object-oriented systems link
both closely into objects. Events occur when objects respond to messages. The objects
themselves determine the response to the messages, allowing the same message to be sent
to many objects.
1. Justify objects
2. Analyze how objects are grouped in classes
3. Discuss about the object behavior and methods
2.12 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
22
CONTENTS
3.1 INTRODUCTION
The essence of the software development process that consists of analysis, design,
implementation, testing, and refinement is to transform users' needs into a software
solution that satisfies those needs. However, some people view the software development
process as interesting but feel it has little importance in developing software. It is
tempting to ignore the process and plunge into the implementation and programming
phases of software development, much like the builder who would bypass the architect.
Some programmers have been able to ignore the counsel of systems development in
building a system.
prototype of some of the key system components shortly after the products are selected,
to understand how easy or difficult it will be to implement some of the features of the
system.
The prototype also can give users a chance to comment on the usability and
usefulness of the design and let you assess the fit between the software tools selected, the
functional specification, and the users' needs.
This lesson introduces you to the systems development life cycle in general and,
more specifically, to an object-oriented approach to software development. The main
point of this chapter is the idea of building software by placing emphasis on the analysis
and design aspects of the software life cycle. The emphasis is intended to promote the
building of high-quality software (meeting specifications and being adaptable for
change). The software industry previously suffered from the lack of focus on the early
stages of the life cycle
The process can be divided into small, interacting phases-sub processes. The sub
processes must be defined in such a way that they are clearly spelled out, to allow each
activity to be performed as independently of other sub processes as possible. Each sub
process must have the following
A description in terms of how it works
Specification of the input required for the process
Specification of the output to be produced
The software development process also can be divided into smaller, interacting
sub processes. Generally, the software development process can be viewed as a series of
transformations, where the output of one transformation becomes the input of the
subsequent transformation (Figure 3-1):
Transformation 1 (analysis) translates the users' needs into system requirements and
responsibilities. The way they use the system can provide insight into the users'
requirements. For example, one use of the system might be analyzing an incentive payroll
system, which will tell us that this capacity must be included in the system requirements.
24
Transformation 2 (design) begins with a problem statement and ends with a detailed
design that can be transformed into an operational system. This transformation includes
the bulk of the software development activity, including the
FIGURE 3-1
Software process reflecting transformation from needs to a software product that
satisfies those needs.
definition of how to build the software, its development, and its testing. It also includes
the design descriptions, the program, and the testing materials. . Transformation 3
(implementation) refines the detailed design into the system deployment that will satisfy
the users' needs. This takes into account the equipment, procedures, people, and the like.
It represents embedding the software product within its operational environment. For
example, the new compensation method is programmed, new forms are put to use, and
new reports now can be printed. Here, we try to answer the following question: What
procedures and resources are needed to compensate the employees under the new
accounting system?.
In the real world, the problems are not always well-defined and that is why the
waterfall model has limited utility. For example, if a company has experience in building
accounting systems, then building another such product based on the existing design is
25
best managed with the waterfall model, as it has been described. Where there is
uncertainty regarding what is required or how it can be built, the waterfall model fails.
This model assumes that the requirements are
known before the design begins, but one may need experience with the product before the
requirements can be fully understood. It also assumes that the requirements will remain
static over the development cycle and that a product delivered months after it was
specified will meet the delivery-time needs.
Finally, even when there is a clear specification, it assumes that sufficient design
knowledge will be available to build the product. The waterfall model is the best way to
manage a project with a well-understood product, especially very large projects. Clearly,
it is based on well-established engineering principles. However, its failures can be traced
to its inability to accommodate software's special properties and its inappropriateness for
resolving partially understood issues; furthermore, it neither emphasizes nor encourages
software reusability. After the system is installed in the real world, the environment
frequently changes, altering the accuracy of the original problem statement and,
consequently, generating revised software requirements. This can complicate the
software development process even more. For example, a new class of employees or
another shift of workers may be added or the standard workweek or the piece rate
changed. By definition, any such changes also change the environment, requiring changes
in the programs. As each such request is processed, system and programming changes
make the process increasingly complex, since each request must be considered in regard
to the original statement of needs as modified by other requests.
The software process transforms the users' needs via the application domain to a
software solution that satisfies those needs. Once the system (programs) exists, we must
test it to see if it is free of bugs. High-quality products must meet users' needs and
26
expectations. Furthermore, the products should attain this with minimal or no defects, the
focus being on improving products (or services) prior to delivery rather than correcting
them after delivery.
There are two basic approaches to systems testing. We can test a system
according to how it has been built or, alternatively, what it should do. Blum describes a
means of system evaluation in terms of four quality measures: correspondence,
correctness, verification, and validation. Correspondence measures how well the
delivered system matches the needs of the operational environment, as described in the
original requirements statement.
Verification. Am I building the product right?
Validation. Am I building the right product?
Validation begins as soon as the project starts, but verification can begin only
after a specification has been accepted. Verification and validation are independent of
each other. It is possible to have a product that corresponds to the specification, but if the
specification proves to be incorrect, we do not have the right product; for example, say a
necessary report is missing from the delivered product, since it was not included in the
original specification. A product also may be correct but not correspond to the users'
needs; for example, after years of waiting, a system is delivered that satisfies the initial
design statement but no longer reflects current operating practices. Blum argues that,
when the specification is informal, it is difficult to separate verification from validation.
Future chapter looks at the issue of software validation and correspondence by proposing
a way to measure user satisfaction
27
FIGURE 3-3
Four quality measures (correspondence, correctness, validation, and verification) for
software evaluation.
Object-oriented design
Prototyping
Component-based development
Incremental testing
28
FIGURE 3-4
The object-oriented systems development approach. Object- oriented analysis
corresponds to transformation 1;design to transformation 2, and implementation to
transformation 3 of Figure 3-1.
FIGURE 3-5
29
By following the life cycle model of Jacobson et aI., we produce designs that are
traceable across requirements, analysis, implementation, and testing.
makes sense in the context of the real-world system. While developing the model, objects
emerge that help us establish a workable system. It is necessary to work iteratively
between use-case and object models. For example, the objects in the incentive payroll
system might include the following examples:
The employee, worker, supervisor, office administrator.
The paycheck.
The product being made.
The process used to make the product.
Of course, some problems have no basis in the real world. In this case, it can be
useful to pose the problem in terms of analogous physical objects, kind of a mental
simulation. the context of the application's domain. For example, the application domain
might be a payroll system; and the tangible objects might be the paycheck, employee,
worker, supervisor, office administrator; and the intangible objects might be tables, data
entry screen, data structures, and so forth. Documentation is another important activity,
which does not end with object-oriented analysis but should be carried out throughout the
system development. However, make the documentation as short as possible. The 80-20
rule generally applies for documentation: 80 percent of the work can be done with 20
percent of the documentation. The trick is to make sure that the 20 percent is easily
accessible and the rest (80 percent) is available to those (few) who need to know.
Remember that documentation and modeling are not separate activities, and good
modeling implies good documentation.
This chapter introduces the system development life cycle (SOLC) in general and
object-oriented and use-case driven SOLC specifically. The essence of the software
process is the transformation of users' needs through the application domain into a
software solution that is executed in the implementation domain. The concept of the use
case, or a set of scenarios, can be a valuable tool for understanding the users' needs. The
emphasis on the analysis and design aspects of the software life cycle is intended to
promote building high-quality software (meeting the specifications and being adaptable
for change).
3.7 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
32
CONTENTS
The main objective of this lesson to know the details about the
Object-Oriented Design
Prototyping
Implementation of the object oriented models
4.1 INTRODUCTION
objects and their relationships, then iterate and refine the model: .Design and refine
classes. .Design and refine attributes. .Design and refine methods. .Design and refine
structures. .Design and refine associations.
Here are a few guidelines to use in your object-oriented design: .Reuse, rather
than build, a new class. Know the existing classes. .Design a large number of simple
classes, rather than a small number of complex classes. Design methods. Critique what
you have proposed. If possible, go back and refine the classes.
4.3 PROTOTYPING
Although the object-oriented analysis and design describe the system features, it
is important to construct a prototype of some of the key system components shortly after
the products are selected. It has been said "a picture may be worth a thousand words, but
a prototype is worth a thousand pictures"[author unknown]. Not only is this true, it is an
understatement of the value of software prototyping. Essentially, a prototype is a version
of a software product developed in the early stages of the product's life cycle for specific,
experimental purposes. A prototype enables you to fully understand how easy or difficult
it will be to implement some of the features of the system. It also can give users a chance
to comment on the usability and usefulness of the user interface design and lets you
assess the fit between the software tools selected, the functional specification, and the
user needs. Additionally, prototyping can further define the use cases, and it actually
makes use-case modeling much easier.
Building a prototype that the users are happy with, along with documentation of
what you did, can define the basic courses of action for those use cases covered by the
prototype. The main idea here is to build a prototype with uses-case modeling to design
systems that users like and need. Traditionally, prototyping was used as a "quick and
dirty" way to test the design, user interface, and so forth, something to be thrown away
when the "industrial strength" version was developed. However, the new trend, such as
using rapid application development, is to refine the prototype into the final product.
Prototyping provides the developer a means to test and refine the user interface and
increase the usability of the system. As the underlying prototype design begins to become
more consistent with the application requirements, more details can be added to the
application, again with further testing, evaluation, and rebuilding, until all the application
components work properly within the prototype framework.
Prototypes have been categorized in various ways. The following categories are
some of the commonly accepted prototypes and represent very distinct ways of viewing a
prototype, each having its own strengths:
Horizontal Prototype
Vertical Prototype
Analysis Prototype
34
A horizontal prototype is a simulation of the interface (that is, it has the entire
user interface that will be in the full-featured system) but contains no functionality. This
has the advantages of being very quick to implement, providing a good overall feel of the
system, and allowing users to evaluate the interface on the basis of their normal, expected
perception of the system.
The principal advantage of this method is that the few implemented functions can
be tested in great depth. In practice, prototypes are a hybrid between horizontal and
vertical: The major portions of the interface are established so the user can get the feel of
the system, and features having a high degree of risk are prototyped with much more
functionality.
An analysis prototype is an aid for exploring the problem domain. This class of
prototype is used to inform the user and demonstrate the proof of a concept. It is not used
as the basis of development, however, and is discarded when it has served its purpose.
The final product will use the concepts exposed by the prototype, not its code. .A domain
prototype is an aid for the incremental development of the ultimate software solution. It
often is used as a tool for the staged delivery of subsystems to the users or other members
of the development team. It demonstrates the feasibility of the implementation and
eventually will evolve into a deliverable product.
The typical time required to produce a prototype is anywhere from a few days to
several weeks, depending on the type and function of prototype. Prototyping should
involve representation from all user groups that will be affected by the project, especially
the end users and management members to ascertain that the general structure of the
prototype meets the requirements established for the overall design. The purpose of this
review is threefold:
3. To give management and everyone connected with the project the first (or it
could be second or third. . .) glimpse of what the technology can provide. The evaluation
can be performed easily if the necessary supporting data is readily available. Testing
considerations must be incorporated into the design and subsequent implementation of
the system.
modifications to the specification and even can reveal additional features or problems that
were not obvious until the prototype was built.
Manufacturers long ago learned the benefits of moving from custom development
to assembly from prefabricated components. Component-based manufacturing makes
many products available to the marketplace that otherwise would be prohibitively
expensive. If products, from automobiles to plumbing fittings to PCs, were custom-
designed and built for each customer, the way business applications are, then large
markets for these products would not exist. Low-cost, high-quality products would not be
available. Modem manufacturing has evolved to exploit two crucial factors underlying
today's market requirements: reduce cost and time to market by building from pre-built,
ready-tested components, but add value and differentiation by rapid customization to
targeted customers
Today, software components are built and tested in-house, using a wide range of
technologies. For example, computer-aided software engineering (CASE) tools allow
their users to rapidly develop information systems. The main goal of CASE technology is
the automation of the entire information system's development life cycle process using a
set of integrated software tools, such as modeling, methodology, and automatic code
generation. However, most often, the code generated by CASE tools is only the skeleton
of an application and a lot needs to be filled in by programming by hand.
Visual tools or actual code can be used to "glue" together components. Although
it is practical to do simple applications using only "visual glue" (e.g., by "wiring"
components together as in Digitalk's Smalltalk PARTS, or IBM's VisuaIAge), putting
together a practical application still poses some challenges. Of course, all these are
"under the hood" and should be invisible to end users. The impact to users will come
from faster product development cycles, increased flexibility, and improved
customization features. CBD will allow independently developed applications to work
together and do so more efficiently and with less development effort.
An application wrapper surrounds a complete system, both code and data. This
wrapper then provides an interface that can interact with both the legacy and the new
software systems (see Figure 3-6). Off-the-shelf application wrappers are not widely
available. At present, most application wrappers are homegrown within organizations.
However, with component-based development technology emerging rapidly, component
wrapper technology will be used more widely.
The software components are the functional units of a program, building blocks
offering a collection of reusable services. A software component can request a service
from another component or deliver its own services on request. The delivery of services
is independent, which means that components work together to accomplish a task. Of
course, components may depend on one another without interfering with each other. Each
component is unaware of the context or inner workings of the other components. In short,
the object-oriented concept addresses analysis,
37
FIGURE 4.1
Reusing legacy system via component wrapping technology.
RAD is concerned primarily with reducing the "time to market," not exclusively
the software development time. In fact, one successful RAD application achieved a
substantial reduction in time to market but realized no significant reduction in the
individual software cycles.
RAD does not replace the system development life cycle (see the Real-World
case) but complements it, since it focuses more on process description and can be
combined perfectly with the object-oriented approach. The task of RAD is to build the
application quickly and incrementally implement the design and user requirements,
through tools such as Delphi, VisualAge, Visual Basic, or PowerBuilder. After the
overall design for an application has been completed, RAD begins. The main objective of
RAD is to build a version of an application rapidly to see whether we actually have
understood the problem (analysis). Further, it determines whether the system does what it
38
If you wait until after development to test an application for bugs and
performance, you could be wasting thousands of dollars and hours of time. That's what
happened at Bankers Trust in 1992: "Our testing was very complete and good, but it was
costing a lot of money and would add months onto a project," says Glenn Shimamoto,
vice president of technology and strategic planning at the New York bank . In one case,
testing added nearly six months to the development of a funds transfer application. The
problem was that developers would turn over applications to a quality assurance (QA)
group for testing only after development was completed. Since the QA group wasn't
included in the initial plan, it had no clear picture of the system characteristics until it
came time to test.
4.6 REUSABILITY
High-quality software provides users with an application that meets their needs
and expectations. Four quality measures have been described: correspondence,
correctness, verification, and validation. Correspondence measures how well the
delivered system corresponds to the needs of the problem. Correctness determines
whether or not the system correctly computes the results based on the rules created during
the system analysis and design, measuring the consistency of product requirements with
respect to the design specification. Verification is the task of determining correctness (am
I building the product right?). Validation is the task of predicting correspondence (am I
building the right product?).
Object-oriented design requires more rigor up front to do things right. You need
to spend more time gathering requirements, developing a requirements model and an
analysis model, then turning them into the design model. Now, you can develop code
quickly-you have a recipe for doing it. Object-oriented systems development consists of
three macro processes: object-oriented analysis, object-oriented design, and object-
oriented implementation.
4.10 REFERENCES
1. Norman, Ronald- object oriented system analysis and design –prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
41
LESSON – 5: METHODOLOGIES
CONTENTS
The main objective of this lesson is to know about the concepts of Object-oriented
methodology and the overview of the various object oriented methodology.
5.1 INTRODUCTION
In the 1980s, many methodologists were wondering how analysis and design
methods and processes would fit into an object-oriented world. Object-oriented methods
suddenly had become very popular, and it was apparent that the techniques to help people
execute good analysis and design were just as important as the object-oriented concept
itself.
To get a feel for object-oriented methodologies, let us look at some of the
methods developed in the 1980s and 1990s. This list by no means is complete
These methodologies and many other forms of notational language provided system
designers and architects many choices but created a much split, competitive, and
confusing environment. Most of the methods were very similar but contained a number of
often annoying minor differences, and each had a group of practitioners that liked its
ideas. The same basic concepts appeared in very different notations, which caused
confusion among the users . The trend in object-oriented methodologies, sometimes
called second-generation object-oriented methods, has been toward combining the best
aspects of the most popular methods instead of coming out with new methodologies,
which was the tendency in first-generation object-oriented methods. In the next section,
to give you a taste of object-oriented methodologies, we will look at some of the most
popular ones.
Many methodologies are available to choose from for system development. Each
methodology is based on modeling the business problem and implementing the
application in an object-oriented fashion; the differences lie primarily in the
documentation of information and modeling notations and language. An application can
be implemented in many ways to meet the same requirements and provide the same
functionality. The largest noticeable differences will be in the trade-offs and detailed
design decisions made. 1\vo people using the same methodology may produce
application designs that look radically different. This does not necessarily mean that one
is right and one is wrong, just that they are different. In the following sections, we look at
the methodologies and their modeling notations developed by Rumbaugh et aI., Booch,
and Jacobson which are the origins of the Unified Modeling Language (UML).
Each method has its strengths. The Rumbaugh et ai. method is well-suited for
describing the object model or the static structure of the system. The Jacobson et al.
method is good for producing user-driven analysis models. The Booch method produces
detailed object-oriented design models.
43
5.7 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –prentice hall 1996.
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press.
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press.
4. Rambaugh, James ,Michael –Object oriented Modelling and design.
5. Ali –Brahmi –Object oriented system development”.
44
UNIT – II
CONTENTS
6.1 INTRODUCTION.
Many methodologies are available to choose from for system development. Each
methodology is based on modeling the business problem and implementing the
application in an object-oriented fashion; the differences lie primarily in the
documentation of information and modeling notations and language. An application can
be implemented in many ways to meet the same requirements and provide the same
functionality. The largest noticeable differences will be in the trade-offs and detailed
design decisions made. 1\vo people using the same methodology may produce
application designs that look radically different. This does not necessarily mean that one
is right and one is wrong, just that they are different. In the following sections, we look at
the methodologies and their modeling notations developed by Rumbaugh Booch, and
Jacobson which are the origins of the Unified Modeling Language (UML). Each method
has its strengths. The Rum Baugh et ai. method is well-suited for describing the object
model or the static structure of the system. The Jacobson method is good for producing
45
user-driven analysis models. The Booch method produces detailed object-oriented design
models.
The object modeling technique (OMT) presented by Jim Rumbaugh and his
coworkers describes a method for the analysis, design, and implementation of a system
using an object-oriented technique. OMT is a fast. intuitive approach for identifying and
modeling all the objects making up a system. The dynamic behavior of objects within a
system can be described using the OMT dynamic model. This model lets you specify
detailed state transitions and their descriptions within a system. Finally, a process
description and consumer-producer relationships can be expressed using OMT's
functional model. OMT consists of four phases, which can be performed iteratively:
1. Analysis. The results are objects and dynamic and functional models.
2. System design. The results are a structure of the basic architecture of the system along
with high-level strategy decisions.
3. Object design. This phase produces a design document, consisting of detailed objects
static, dynamic, and functional models.
4. Implementation. This activity produces reusable, extendible, and robust code. OMT
separates modeling into three different parts:
1. An object model, presented by the object model and the data dictionary.
2. A dynamic model, presented by the state diagrams and event flow diagrams.
3. A functional model, presented by data flow and constraints.
The object model describes the structure of objects in a system: their identity,
relationships to other objects, attributes, and operations. The object model is represented
graphically with an object diagram (see Fig ). The object diagram contains classes
interconnected by association lines. Each class represents a set of individual objects. The
association lines establish relationships among the classes. Each association line
represents a set of links from the objects of one class to the objects of another class.
The OMT object model of a bank system. The boxes represent classes and the
filled triangle represents specialization. Association between Account and transaction is
one too many; since one account can have many transactions, the filled circle represents
many (zero or more). The relationship between Client and Account classes is one to one:
A client can have only one account and account can belong to only one person (in this
model joint accounts are not allowed).
The OMT data flow diagram (DFD) shows the flow of data between different
processes in a business. An OMT DFD provides a simple and intuitive method for
describing business processes without focusing on the details of computer systems.
Overall, the Rumbaugh et al. OMT methodology provides one of the strongest
tool sets for the analysis and design of object-oriented systems.
State transition diagram for the bank application user interface. The round boxes
represent states and the arrows represent transitions.
6.9 REFERENCES
1. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
2. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
3. Rambaugh, James ,Michael –Object oriented Modelling and design
4.Ali –Brahmi –Object oriented system development”
49
CONTENTS
7.0 AIMS AND OBJECTIVES
7.1 INTRODUCTION
7.2 THE BOOCH METHODOLOGY
7.3 THE MACRO DEVELOPMENT PROCESS
7.4 THE MICRO DEVELOPMENT PROCESS
7.5 THE JACOBSON METHODOLOGIES
7.6 USE CASES
7.7 OBJECT-ORIENTED SOFTWARE ENGINEERING: OBJECTORY
7.8 OBJECT-ORIENTED BUSINESS ENGINEERING
7.9 PATTERNS
7.10 LET US SUM UP
7.11 POINTS FOR DISCUSSION
7.12 LESSON – END ACTIVITIES
7.13 REFERENCES
7.1 INTRODUCTION
The Booch methodology is a widely used object-oriented method that helps you
design your system using the object paradigm. It covers the analysis and design phases of
an object-oriented system. Booch sometimes is criticized for his large set of symbols.
Even though Booch defines a lot of symbols to document almost every design decision, if
you work with his method, you will notice that you never use all these symbols and
diagrams. You start with class and object diagrams (see Figs 4-4 and 4-5) in the analysis
phase and refine these diagrams in various steps. Only when you are ready to generate
code, do you add design symbols and this is where the Booch method shines, you can
document your object-oriented code. The Booch method consists of the following
diagrams:
Class diagrams
Object diagrams
State transition diagrams
Module diagrams
Process diagrams
Interaction diagrams
51
OMTDFDof the AT system. The data flowlines include arrows to show the direction of
data element movement.The circles represent processes. The boxes represent external
entities.A data store reveals the storage of data.
The macro process serves as a controlling framework for the micro process and
can take weeks or even months. The primary concern of the macro process is technical
management of the system. Such management is interested less in the actual object-
oriented design than in how well the project corresponds to the requirements set for it and
whether it is produced on time. In the macro process, the traditional phases of analysis
and design to a large extent are preserved.
Object modeling using Booch notation. The arrows represent specialization; for example,
the class Taurus is subclass of the class Ford.
the desired behavior of the system. Then, you use the object diagram to describe the
desired behavior of the system in terms of scenarios or, alternatively, use the interaction
diagram to describe behavior of the system in terms of scenarios.
3. Design or create the system architecture. In the design phase, you use the class
diagram to decide what classes exist and how they relate to each other. Next, you use the
object diagram to decide what mechanisms are used to regulate how objects collaborate.
Then, you use the module diagram to map out where each class and object should be
declared. Finally, you use the process diagram to determine to which processor to
allocate a process. Also, determine the schedules for multiple processes on each relevant
processor.
4. Evolution or implementation. Successively refine the system through many iterations.
Produce a stream of software implementations (or executable releases), each of which is a
refinement of the prior one.
5. Maintenance. Make localized changes to the system to add new requirements and
eliminate bugs.
53
Each macro development process has its own micro development processes. The
micro process is a description of the day-to-day activities by a single or small group of
software developers, which could look blurry to an outside viewer, since the analysis and
design phases are not clearly defined.
An alarm class state transition diagram with Booch notation. This diagram can
capture the state of a class based on a stimulus. For example, a stimulus causes the class
to perform some processing, followed by a transition to another state. In this case, the
alarm silenced state can be changed to alarm sounding state and vice versa.
life cycle and stress traceability between the different phases, both forward and
backward. This traceability enables reuse of analysis and design work, possibly much
bigger factors in the reduction of development time than reuse of code.
At the heart of their methodologies is the use-case concept, which evolved with
Objectory (Object Factory for Software Development).
Use cases are scenarios for understanding system requirements. A use case is an
interaction between users and a system. The use-case model captures the goal of the user
and the responsibility of the system to its users (see Fig). In the requirements analysis, the
use cases are described as one of the following :
Nonformal text with no clear flow of events.
Text, easy to read but with a clear flow of events to follow (this is a recommended style).
Formal style using pseudo code.
The use case description must contain
How and when the use case begins and ends.
The interaction between the use case and its actors, including when the interaction occurs
and what is exchanged.
How and when the use case will need data stored in the system or will store data in the
system.
Exceptions to the flow of events.
How and when concepts of the problem domain are handled.
Every single use case should describe one main flow of events. An exceptional or
additional flow of events could be added. The exceptional use case extends another use
case to include the additional one. The use-case model employs extends and uses
relationships. The extends relationship is used when you have one use case that is similar
to another use case but does a bit more. In essence, it extends the functionality of the
original use case (like a subclass). The uses relationship reuses common behavior in
different use cases.
Use cases could be viewed as concrete or abstract. An abstract use case is not
complete and has no actors that initiate it but is used by another use case. This inheritance
could be used in several levels. Abstract use cases also are the ones that have uses or
extends relationships.
55
the user and the responsibility of the system to its users (see Fig 4-6). In the requirements
analysis, the use cases are described as one of the following:
Nonformal text with no clear flow of events.
Text, easy to read but with a clear flow of events to follow (this is a recommended style).
Formal style using pseudo code. The use case description must contain
How and when the use case begins and ends.
The interaction between the use case and its actors, including when the interaction occurs
and what is exchanged.
How and when the use case will need data stored in the system or will store data in the
system.
Exceptions to the flow of events.
How and when concepts of the problem domain are handled.
Every single use case should describe one main flow of events. An exceptional or
additional flow of events could be added. The exceptional use case extends another use
case to include the additional one. The use-case model employs extends and uses
relationships. The extends relationship is used when you have one use case that is similar
to another use case but does a bit more. In essence, it extends the functionality of the
original use case (like a subclass). The uses relationship reuses common behavior in
different use cases.
Use cases could be viewed as concrete or abstract. An abstract use case is not
complete and has no actors that initiate it but is used by another use case. This inheritance
could be used in several levels. Abstract use cases also are the ones that have uses or
extends relationships.
56
Some uses of a library. As you can see, these are external views of the library
system from an actor such as a member.The simpler the use case, the more effective it
will be. It is unwise to capture all of the details right at the start; you can do that later.
. Test model. The test model constitutes the test plans, specifications, and reports.
The maintenance of each model is specified in its associated process. A process is created
when the first development project starts and is terminated when the developed system is
taken out of service.
analysis objects are translated into design objects that fit the current implementation
environment.
. Testing phase. Finally, Jacobson describes several testing levels and techniques. The
levels include unit testing, integration testing, and system testing.
7.9 PATTERNS
In this section, we look at the concept of patterns; and in the next section, we look
at another emerging method, frameworks. The use of design patterns originates in the
work done by a building architect named Christopher Alexander during the late 1970s.
Alexander wrote two books, A Pattern Language and A Timeless Way of Building ], that,
in addition to giving examples, described his rationale for documenting patterns.
Alexander's articulation on pattern work was soon employed by object-oriented thinkers
looking for ways to describe commonly occurring design solutions and programming
paradigms.
A pattern is [an] instructive information that captures the essential structure and
insight of a successful family of proven solutions to a recurring problem that arises within
a certain context and system of forces.
The majority of the initial patterns developed focus on design problems and still
design patterns represent most solutions. However, more recent patterns encompass all
aspects of software engineering, including development organization, the software
development process, project planning, requirements engineering, and software
configuration management.
Generative patterns are patterns that not only describe a recurring problem, they
can tell us how to generate something and can be observed in the resulting system
architectures they helped shape. Nongenerative patterns are static and passive: They
describe recurring phenomena without necessarily saying how to reproduce them. We
should strive to document generative patterns because they not only show us the
60
characteristics of good systems, they teach us how to build them. Alexander explains that
the most useful patterns are generative:
These patterns in our minds are, more or less, mental images of the patterns in the
world: they are abstract representations of the very morphological rules which define the
patterns in the world. However, in one respect they are very different. The patterns in the
world merely exist. But the same patterns in our minds are dynamic. They have force.
They are generative. They tell us what to do; they tell us how we shall, or may, generate
them; and they tell us too, that under certain circumstances, we must create them. Each
pattern is a rule which describes what you have to do to generate the entity which it
defines.
Patterns Template
Every pattern must be expressed "in the form of a rule [template] which
establishes a relationship between a context, a system of forces which arises in that
context, and a configuration, which allows these forces to resolve themselves in that
context" .
Currently, several different pattern templates have been defined that eventually
will represent a pattern. Despite this, it is generally agreed that a pattern should contain
certain essential components. The following essential components should be clearly
recognizable on reading a pattern :
.Name. A meaningful name. This allows us to use a single word or short phrase to refer
to the pattern and the knowledge and structure it describes. Good pattern names form a
vocabulary for discussing conceptual abstractions. Sometimes, a pattern may have more
than one commonly used or recognizable name in the literature. In this case, it is common
practice to document these nicknames or synonyms under the heading of aliases or also
known as. Some pattern forms also provide a classification of the pattern in addition to its
name.
61
.Problem. A statement of the problem that describes its intent: the goals and objectives it
wants to reach within the given context and forces. Often the forces oppose these
objectives as well as each other.
. Context. The preconditions under which the problem and its solution seem to recur and
for which the solution is desirable. This tells us the pattern's applicability. It can be
thought of as the initial configuration of the system before the pattern is applied to it.
. Forces. A description of the relevant forces and constraints and how they interact or
conflict with one another and with the goals we wish to achieve (perhaps with some
indication of their priorities). A concrete scenario that serves as the motivation for the
pattern frequently is employed (see also Examples). Forces reveal the intricacies of a
problem and define the kinds of trade-offs that must be considered in the presence of the
tension or dissonance they create. A good pattern description should fully encapsulate all
the forces that have an impact on it.
. Solution. Static relationships and dynamic rules describing how to realize the desired
outcome. This often is equivalent to giving instructions that describe how to construct the
necessary products. The description may encompass pictures, diagrams, and prose that
identify the pattern's structure, its participants, and their collaborations, to show how the
problem is solved. The solution should describe not only the static structure but also
dynamic behavior. The static structure tells us the form and organization of the pattern,
but often the behavioral dynamics is what makes the pattern "come alive." The
description of the pattern's solution may indicate guidelines to keep in mind (as well as
pitfalls to avoid) when attempting a concrete implementation of the solution. Sometimes,
possible variants or specializations of the solution are described as well.
.Examples. One or more sample applications of the pattern that illustrate a specific initial
context; how the pattern is applied to and transforms that context; and the resulting
context left in its wake. Examples help the reader understand the pattern's use and
applicability. Visual examples and analogies often can be very useful. An example may
be supplemented by a sample implementation to show one way the solution might be
realized. Easy-to-comprehend examples from known systems usually are preferred.
.Resulting context. The state or configuration of the system after the pattern has been
applied, including the consequences (both good and bad) of applying the pattern, and
other problems and patterns that may arise from the new context. It describes the
postconditions and side effects of the pattern. This is sometimes called a resolution of
forces because it describes which forces have been resolved, which ones remain
unresolved, and which patterns may now be applicable. Documenting the resulting
context produced by one pattern helps you correlate it with the initial context of other
patterns (a single pattern often is just one step toward accomplishing some larger task or
project).
.Rationale. A justifying explanation of steps or rules in the pattern and also of the pattern
as a whole in terms of how and why it resolves its forces in a particular way to be in
alignment with desired goals, principles, and philosophies. It explains how the forces and
constraints are orchestrated in concert to achieve a resonant harmony. This tells us how
the pattern actually works, why it works, and why it is "good." The solution component
of a pattern may describe the outwardly visible structure and behavior of the pattern, but
the rationale is what provides insight into the deep structures and key mechanisms going
on beneath the surface of the system.
62
.Related patterns. The static and dynamic relationships between this pattern and others
within the same pattern language or system. Related patterns often share common forces.
They also frequently have an initial or resulting context that is compatible with the
resulting or initial context of another pattern. Such patterns might be predecessor patterns
whose application leads to this pattern, successor patterns whose application follows from
this pattern, alternative patterns that describe a different solution to the same problem but
under different forces and constraints, and codependent patterns that may (or must) be
applied simultaneously with this pattern.
.Known uses. The known occurrences of the pattern and its application within existing
systems. This helps validate a pattern by verifying that it indeed is a proven solution to a
recurring problem. Known uses of the pattern often can serve as instructional examples
(see also Examples).
Although it is not strictly required, good patterns often begin with an abstract that
provides a short summary or overview. This gives readers a clear picture of the pattern
and quickly informs them of its relevance to any problems they may wish to solve
(sometimes such a description is called a thumbnail sketch of the pattern, or a pattern
thumbnail). A pattern should identify its target audience and make clear what it assumes
of the reader.
Antipatterns
Capturing Patterns
People can contribute new solutions, lessons learned (or antipatterns), and more examples
within a variety of contexts.
How do you know a pattern when you come across one? The answer is you do not
always know. You may jot down the beginning of some things you think are patterns, but
it may turn out that these are not patterns at all, or they are only pieces of patterns, simply
good principles, or general rules that may form part of the rationale for a particular
pattern. It is important to remember that a solution in which no forces are present is not a
The shepherd contacts the pattern author(s) and discusses with him or her how the
individual authors, the patterns are discussed in writers' workshops, open forums
where all attending seek to improve the patterns presented by discussing what
. Careful editing. The pattern authors should have the opportunity to incorporate
they like about them and the areas in which they are lacking.
all the comments and insights during the shepherding and writers' workshops
before presenting the patterns in their finished form.
Booch and Rumbaugh et al. are object centered in their approaches and focus
more on figuring out what are the objects of a system, how are they related, and how do
they collaborate with each other. Jacobson et al. are more user centered, in that
everything in their approach derives from use cases or usage scenarios.
7.13 REFERENCES
1. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
2. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
3. Rambaugh, James ,Michael –Object oriented Modelling and design
4. Ali –Brahmi –Object oriented system development”
65
LESSON – 8: FRAMEWORKS
CONTENTS
8.0 AIMS AND OBJECTIVES
8.1 INTRODUCTION.
8.2 FRAMEWORKS
8.4 OBJECT-ORIENTED ANALYSIS
8.5 OBJECT-ORIENTED DESIGN
8.6 ITERATIVE DEVELOPMENT AND CONTINUOUS TESTING
8.7 MODELING BASED ON THE UNIFIED MODELING LANGUAGE
8.8 LET US SUM UP
8.9 POINTS FOR DISCUSSION
8.10 LESSON – END ACTIVITIES
8.11 REFERENCES
8.1 INTRODUCTION
8.2 FRAMEWORKS
Even though they are related in this manner, it is important to recognize that
frameworks and design patterns are two distinctly separate beasts: A framework is
executable software, whereas design patterns represent knowledge and experience about
software. In this respect, frameworks are of a physical nature, while patterns are of a
logical nature: Frameworks are the physical realization of one or more software pattern
solutions; patterns are the instructions for how to implement those solutions .
Gamma et al. describe the major differences between design patterns and frameworks as
follows:
.Design patterns are more abstract than frameworks. Frameworks can be embodied in
code, but only examples of patterns can be embodied in code. A strength of frameworks
is that they can be written down in programming languages and not only studied but
executed and reused directly. In contrast, design patterns have to be implemented each
time they are used. Design patterns also explain the intent, trade-offs, and consequences
of a design.
.Design patterns are smaller architectural elements than frameworks. A typical
framework contains several design patterns but the reverse is never true.
. Design patterns are less specialized than frameworks. Frameworks always have a
particular application domain. In contrast, design patterns can be used in nearly any kind
of application. While more specialized design patterns are certainly possible, even these
would not dictate an application architecture.
The approach promoted in this book is based on the best practices that have
proven successful in system development and, more specifically, the work done by
Booch, Rumbaugh, and Jacobson in their attempt to unify their modeling efforts. The
unified approach (UA) (see Fig ) establishes a unifying and unitary framework around
their works by utilizing the unified modeling language (UML) to describe, model, and
document the software development process. The idea behind the UA is not to introduce
yet another methodology. The main motivation here is to combine the best practices,
67
processes, methodologies, and guidelines along with UML notations and diagrams for
better understanding object-oriented concepts and system development.
The unified approach to software development revolves around (but is not limited
to) the following processes and concepts (see Fig ). The processes are:
Use-case driven development
Object-oriented analysis
Object-oriented design
Incremental development and prototyping
Continuous testing
Analysis is the process of extracting the needs of a system and what the system
must do to satisfy the users' requirements. The goal of object-oriented analysis is to first
understand the domain of the problem and the system's responsibilities by understanding
how the users use or will use the system. This is accomplished by constructing several
models of the system. These models concentrate on describing what the system does
rather than how it does it. Separating the behavior of a system from the way it is
implemented requires viewing the system from the user's perspective rather than that of
the machine. OOA Process consists of the following
Steps:
1. Identify the Actors.
2. Develop a simple business process model using UML Activity diagram.
3. Develop the Use Case.
4. Develop interaction diagrams.
5. Identify classes.
You must iterate and reiterate until, eventually, you are satisfied with the system.
Since testing often uncovers design weaknesses or at least provides additional
information you will want to use, repeat the entire process, taking what you have learned
and reworking your design or moving on to reprototyping and retesting. Continue this
refining cycle through the development process until you are satisfied with the results.
During this iterative process, your prototypes will be incrementally transformed into the
actual application. The UA encourages the integration of testing plans from day I of the
project. Usage scenarios can become test scenarios; therefore, use cases will drive the
usability testing. Usability testing is the process in which the functionality of software is
measured.
The unified modeling language was developed by the joint efforts of the leading
object technologists Grady Booch, Ivar Jacobson, and James Rumbaugh with
contributions from many others. The UML merges the best of the notations used by the
three most popular analysis and design methodologies: Booch's methodology, Jacobson
et al.'s use case, and Rumbaugh et al.'s object modeling technique. The UML is becoming
the universal language for modeling systems; it is intended to be used to express models
of many different kinds and purposes, just as a programming language or a natural
language can be used in many different ways. The UML has become the standard
notation for object-oriented modeling systems. It is an evolving notation that still is under
development. The UA uses the UML to describe and model the analysis and design
phases of system development (UML notations will be covered in Chapter 5).
The idea promoted here is to create a repository that allows the maximum reuse of
previous experience and previously defined objects, patterns, frameworks, and user
interfaces in an easily accessible manner with a completely available and easily utilized
format. As we saw previously, central to the discussion on developing this best practice
sharing is the concept of a pattern. Everything from the original user request to
maintenance of the project as it goes to production should be kept in the repository. The
advantage of repositories is that, if your organization has done projects in the past,
objects in the repositories from those projects might be useful. You can select any piece
69
from a repository-from the definition of one data element, to a diagram, all its symbols,
and all their dependent definitions, to entries- for reuse.
If a new requirement surfaces, new objects will be designed and stored in the
main repository for future use. The same arguments can be made about patterns and
frameworks. Specifications of the software components, describing the behavior of the
component and how it should be used, are registered in the repository for future reuse by
teams of developers.
In a two-layered system, user interface screens are tied to the data through
routines that sit directly behind the screens; for example, a routine that executes when
you click on a button. With every interface you create, you must re-create the business
logic needed to run the screen. The routines required to access the data must exist within
every screen. Any change to the business logic must be accomplished in every screen that
deals with that portion of the business. This approach resultsin objects that are very
specialized and cannot be reused easily in other projects.
The Business Layer The business layer contains all the objects that represent the
business (both data and behavior). This is where the real objects such as Order,
Customer, Line item, Inventory, and Invoice exist. Most modem objectoriented analysis
and design methodologies are generated toward identifying these kinds of objects.
The responsibilities of the business layer are very straightforward: Model the
objects of the business and how they interact to accomplish the business processes. When
creating the business layer, however, it is important to keep in mind a couple of things.
These objects should not be responsible for the following: .Displaying details.
Business objects should have no special knowledge of how they are being displayed and
by whom. They are designed to be independent of any particular interface, so the details
of how to display an object should exist in the interface (view) layer of the object
displaying it.
Data access details. Business objects also should have no special knowledge of
"where they come from." It does not matter to the business model whether the data are
stored and retrieved via SQL or file I/O. The business objects need to know only to
whom to talk about being stored or retrieved. The business objects are modeled during
the object-oriented analysis. A business model captures the static and dynamic
relationships among a collection of business objects. Static relationships include object
associations and aggregations. For example, a customer could have more than one
account or an order could be aggregated from one or more line items. Dynamic
relationships show how the business objects interact to perform tasks. For example, an
order interacts with inventory to determine product availability. An individual business
object can appear in different business models. Business models also incorporate control
objects that direct their processes. The business objects are identified during the object-
oriented analysis. Use cases can provide a wonderful tool to capture business objects.
The User Interface (View) Layer: The user interface layer consists of objects
with which the user interacts as well as the objects needed to manage or control the
interface. The user interface layer also is called the view layer. This layer typically is
responsible for two major aspects of the applications:
. Responding to user interaction. The user interface layer objects must be designed to
translate actions by the user, such as clicking on a button or selecting .from a menu, into
an appropriate response. That response may be to open or close another interface or to
send a message down into the business layer to start some business process; remember,
the business logic does not exist here, just the knowledge of which message to send to
which business object..
. Displaying business objects. This layer must paint the best possible picture of the
business objects for the user. In one interface, this may mean entry fields and list boxes to
display an order and its items. In another, it may be a graph of the total price of a
customer's orders.
72
8.11 REFERENCES
CONTENTS
9.1 INTRODUCTION
These graphic languages are sets of symbols. The symbols are used according to
certain rules of the methodology for communicating the complex relationships of
information more clearly than descriptive text. The main goal of most CASE tools is to
aid us in using these graphic languages, along with their associated methodologies.
Modeling frequently is used during many of the phases of the software life cycle, such as
analysis, design, and implementation. For example, Objectory is built around several
different models: . Use-case model. The use-case model defines the outside (actors) and
inside (use case) of the system's behavior.
. Domain object model. Objects of the "real" world are mapped into the domain object
model. .Analysis object model. The analysis object model presents how the source code
(i.e., the implementation) should be carried out and written. .Implementation model. The
implementation model represents the implementation of the system.
. Test model. The test model constitutes the test plans, specifications, and reports.
As the model progresses from analysis to implementation, more detail is added, but it
remains essentially the same. In this chapter, we look at unified modeling language
(UML) notations and diagrams. The main idea here is to gain exposure to the UML
syntax, semantics, and modeling constructs. Many new concepts will be introduced here
from a modeling standpoint. We apply these concepts in system analysis and design
contexts in later chapters.
Models can represent static or dynamic situations. Each representation has different
implications for how the knowledge about the model might be organized and represented
.
Static Model
Dynamic Model
A system can be described by first developing its static model, which is the
structure of its objects and their relationships to each other frozen in time, a baseline.
Then, we can examine changes to the objects and their relationships over time. Dynamic
modeling is most useful during the design and implementation phases of the system
development. The UML interaction diagrams and activity models are examples of UML
dynamic models.
Clarity. We are much better at picking out errors and omissions from a
graphicalor visual representation than from listings of code or tables of numbers.
We very easily can understand the system being modeled because visual
examination of the whole is possible.
Familiarity. The representation form for the model may turn out to be similar to
the way in which the information actually is represented and used by the
employees currently working in the problem domain. We, too, may find it more
comfortable to work with this type of representation.
Maintenance. Visual notation can improve the main tainability of a system. The
visual identification of locations to be changed and the visual confirmation of
those changes will reduce errors. Thus, you can make changes faster, and fewer
errors are likely to be introduced in the process of making those changes.
Simplification. Use of a higher level representation generally results in the use of
fewer but more general constructs, contributing to simplicity and conceptual
understanding. Turban cites the following advantages of modeling:
76
1. Models make it easier to express complex ideas. For example, an architect builds a
model to communicate ideas more easily to clients.
2. The main reason for modeling is the reduction of complexity. Models reduce
complexity by separating those aspects that are unimportant from those that are
important. Therefore, it makes complex situations easier to understand.
3. Models enhance and reinforce learning and training.
4. The cost of the modeling analysis is much lower than the cost of similar
experimentation conducted with a real system.
5. Manipulation of the model (changing variables) is much easier than manipulating a
real system.
To summarize, here are a few key ideas regarding modeling: . A model is rarely correct
on the first try. . Always seek the advice and criticism of others. You can improve a
model by reconciling different perspectives. .Avoid excess model revisions, as they can
distort the essence of your model. Let simplicity and elegance guide you through the
process.
The goals of the unification efforts were to keep it simple; to cast away elements
of existing Booch, OMT, and OOSE methods that did not work in practice; to add
elements from other methods that were more effective; and to invent new methods only
when an existing solution was unavailable. Because the UML authors, in effect, were
designing a language (albeit a graphical one), they had to strike a proper balance between
minimalism (everything is text and boxes) and overengineering (having a symbol or fig
for every conceivable modeling element).
To that end, they were very careful about adding new things: They did not want to
make the UML unnecessarily complex. A similar situation exists with the problem of
UML not supporting other diagrams. Booch et al. explain that other diagrams, such as the
data flow diagram (DFD), were not included in the UML because they do not fit as
cleanly into a consistent object-oriented paradigm. For example, activity diagrams
accomplish much of what people want from DFDs and then some; activity diagrams also
are useful for modeling work flow. The authors of the UML clearly are promoting the
UML diagrams over all others for objectoriented projects but do not condemn all other
diagrams. Along the way, however, some things were found that were advantageous to
77
add because they had proven useful in other modeling practice.The primary goals in the
design of the UML were as follows :
1. Provide users a ready-to-use, expressive visual modeling language so they can develop
and exchange meaningful models.
2. Provide extensibility and specialization mechanisms to extend the core concepts.
3. Be independent of particular programming languages and development processes.
4. Provide a formal basis for understanding the modeling language.
5. Encourage the growth of the 00 tools market.
6. Support higher-level development concepts.
7. Integrate best practices and methodologies.
This section of the chapter is based on the The Unified Modeling Language Notation
Guide Version 1.1 written by Grady Booch, Ivar Jacobson, and James Rumbaugh .
The choice of what models and diagrams one creates has a great influence on how
a problem is encountered and how a corresponding solution is shaped. We will study
applications of different diagrams throughout the book. However, in this chapter we
concentrate on the UML notations and its semantics.
The UML class diagram, also referred to as object modeling, is the main static
analysis diagram. These diagrams show the static structure of the model. A class diagram
is a collection of static modeling elements, such as classes and their relationships,
connected as a graph to each other and to their contents; for example,the things that exist
(such as classes), their internal structures, and their relationships to other classes. Class
diagrams do not show temporal information, which is required in dynamic modeling.
Object modeling is the process by which the logical objects in the real world (problem
space) are represented (mapped) by the actual objects in the program(logical or a mini
78
world). This visual representation of the objects, their relationships, and their structures is
for ease of understanding. To effectively develop a model of the real world and to
determine the objects required in the system, you first must ask what objects are needed
to model the system. Answering the following questions will help you to stay focused on
the problem at hand and determine what is inside the problem domain and what is outside
it:
You need to know what objects will form the system because, in the
objectoriented viewpoint, objects are the primary abstraction. The main task of object
modeling is to graphically show what each object will do in the problem domain,
describe the structure (such as class hierarchy or part-whole) and the relationships among
objects (such asassociations) by visual notation, and determine what behaviors fall within
and outside the problem domain.
Object Diagram
In class notation, either or both the attributes and operation compartments may be
suppressed.
A binary association is drawn as a solid path connecting two classes, or both ends
may be connected to the same class. An association may have an association name.
Furthermore, the association name may have an optional black triangle in it, the point of
the triangle indicating the direction in which to read the name. The end of an association,
where it connects to a class, is called the association role (seeFig ).
80
Association Role
Association notation.
part of the class. Each association has two or more roles to which it is connected. In Fig
5-3, the association worksFor connects two roles, employee and employer. A Person is an
employee of a Company and a Company is an employer of a Person.
The UML uses the term association navigation or navigability to specify a role
affiliated with each end of an association relationship. An arrow may be attached to the
end of the path to indicate that navigation is supported in the direction of the class
pointed to. An arrow may be attached to neither, one, or both ends of the path. In
particular, arrows could be shown whenever navigation is supported in a given direction.
In the UML, association is represented by an open arrow, as represented in Fig .
Navigability is visually distinguished from inheritance, which is denoted by an unfilled
arrowhead symbol near the superclass.
In Fig 5-4, the association is navigable in only one direction, from the
BankAccount to Person, but not the reverse. This might indicate a design decision, but it
81
also might indicate an analysis decision, that the Person class is frozen and cannot be
extended to know about the BankAccount class, but the BankAccount class can know
about the Person class.
Qualifier
Multiplicity
The terms lower bound and upper bound are integer values, specifying the range of
integers including the lower bound to the upper bound. The star character (*) may be
used for the upper bound, denoting an unlimited upper bound. If a single integer value is
specified, then the integer range contains the single values. For example, 0..1
0..*
1..3, 7..10, 15, 19..*
OR Association
Association Class
N-Ary Association
An n-ary association is an association among more than two classes. Since n-ary
association is more difficult to understand, it is better to convert an n-ary association to
binary association. However, here, for the sake of completeness, we cover the notation of
n-ary association. An n-ary association is shown as a large diamond with a path from the
diamond to each participant class. The name of the association
(if any) is shown near the diamond. The role attachment may appear on each path as with
a binary association. Multiplicity may be indicated; however, qualifiers and aggregation
are not permitted. An association class symbol may be at-
An n-ary (ternary) association that shows association among class, year, and student
classes. The association class GradeBook which contains the attributes of the associations
such as grade, exam, and lab. tached to the diamond by a dashed line, indicating an n-ary
association that has attributes, operation, or associations. The example depicted in Fig
shows the grade book of a class in each semester.
Generalization
subclasses, the label applies to all of the paths. In other words, all subclasses share the
given properties.
Generalization notation.
86
Ellipses (. . .) indicate that additional classes exist and are not shown.
The description of a use case defines what happens in the system when the use
case is performed. In essence, the use-case model defines the outside (actors) and inside
(use case) of the system's behavior. Use cases represent specific flows of events in the
system. The use cases are initiated by actors and describe the flow of events that these
actors set off. An actor is anything that interacts with a use case:
It could be a human user, external hardware, or another system. An actor represents a
category of user rather than a physical user. Several physical users can play the same
role. For example, in terms of a Member actor, many people can be members of a library,
which can be represented by one actor called Member.
A use-case diagram is a graph of actors, a set of use cases enclosed by a system
boundary, communication (participation) associations between the actors and the use
cases, and generalization among the use cases.
87
A use-case diagram shows the relationship among actors and use cases within a system.
Fig diagrams use cases for a Help Desk. A use-case diagram shows the relationship
among the actors and use cases within a system. A client makes a call that is taken by an
operator, who determines the nature of the problem. Some calls can be answered
immediately; other calls require research and a return call. A use case is shown as an
ellipse containing the name of the use case. The name of the use case can be placed
below or inside the ellipse. Actors' names and use case names should follow the
capitalization and punctuation guidelines of the model.
An actor is shown as a class rectangle with the label < <actor> >, or the label and a stick
fig, or just the stick fig with the name of the actor below the fig (see Fig ).
FIG
The three representations of an actor are equivalent.
9.10 REFERENCES
CONTENTS
You can express the dynamic semantics of a problem with the following
diagrams:
Behavior diagrams (dynamic):
Interaction diagrams:
Sequence diagrams
Collaboration diagrams
Statechart diagrams
Activity diagrams
10.1 INTRODUCTION
One must understand both the structure and the function of the objects involved.
One must understand the taxonomic structure of class objects, the inheritance and
mechanisms used, the individual behaviors of objects, and the dynamic behavior of the
system as a whole. The problem is somewhat analogous to that of viewing a sports event
such as tennis or a football game. Many different camera angles are required to provide
an understanding of the action taking place. Each camera reveals particular aspects of the
action that could not be conveyed by one camera alone.
90
The diagrams we have looked at so far largely are static. However, events happen
dynamically in all systems: Objects are created and destroyed, objects send messages to
one another in an orderly fashion, and in some systems, external events trigger operations
on certain objects. Furthermore, objects have states. The state of an object would be
difficult to capture in a static model. The state of an object is the result of its behavior.
Booch provides us an excellent example:
Each class may have an associated activity diagram that indicates the behavior of
the class's instance (its object). In conjunction with the use-case model, we may provide a
scripts or an interaction diagram to show the time or event ordering of messages as they
are evaluated .
Interaction diagrams are diagrams that describe how groups of objects collaborate
to get the job done. Interaction diagrams capture the behavior of a single use case,
showing the pattern of interaction among objects. The diagram shows a number of
example objects and the messages passed between those objects within the use case .
There are two kinds of interaction models: sequence diagrams and collaboration
diagrams.
UML Sequence Diagram Sequence diagrams are an easy and intuitive way of
describing the behavior of a system by viewing the interaction between the system and its
environment. A sequence diagram shows an interaction arranged in a time sequence. It
shows the objects participating in the interaction by their lifelines and the messages they
exchange, arranged in a time sequence.
A sequence diagram has two dimensions: the vertical dimension represents time,
the horizontal dimension represents different objects. The vertical line is called the
object's lifeline. The lifeline represents the object's existence during the interaction. This
form was first popularized by Jacobson. An object is shown as a box at the top of a
dashed vertical line (see Fig). A role is a slot for an object within a collaboration that
describes the type of object that may play the role and its relationships to other roles.
91
However, a sequence diagram does not show the relationships among the roles or the
association among the objects. An object role is shown as a vertical dashed line, the
lifeline.
Each message is represented by an arrow between the lifelines of two objects. The order
in which these messages occur is shown top to bottom on the page. Each message is
labeled with the message name. The label also can include the argument and some
control information and show self-delegation, a message that an object sends to itself, by
sending the message arrow back to the same lifeline. The horizontal ordering of the
lifelines is arbitrary. Often, call arrows are arranged to proceed in one direction across the
page, but this is not always possible and the order conveys no information.
The sequence diagram is very simple and has immediate visual appeal-this is its
great strength. A sequence diagram is an alternative way to understand the overall flow of
the control of a program. Instead of looking at the code and trying to find out the overall
sequence of behavior, you can use the sequence diagram to quickly understand that
sequence .
Some people argue that numbering the messages makes it more difficult to see the
sequence than drawing the lines on the page. However, since the collaboration diagram is
more compressed, other things can be shown more easily-for example, how the objects
are linked together-and the layout can be overlaid with packages or other information.
92
The UML uses the decimal scheme because it makes it clear which operation is
calling which other operation, although it can be hard to see the overall sequence .
Different people have different preferences when it comes to deciding whether to use
sequence or collaboration diagrams. Fowler and Scott suggest that a sequence diagram is
easier to read. Others prefer a collaboration diagram, because they can use the layout to
indicate how objects are statically connected . Fowler and Scott argue that the main
advantage of interaction diagrams (both collaboration and sequence) is simplicity. You
easily can see the message by looking at the diagram. The disadvantage of interaction
diagrams is that they are great only for representing a single sequential process; they
begin to break down when you want to represent conditional looping behavior. However,
conditional behavior can be represented in sequence or collaboration diagrams through
two methods. The preferred method is to use separate diagrams for each scenario.
Another way is to use conditions on messages to indicate the behavior. The main
guideline in developing interaction diagrams is simplicity. The interaction diagram loses
its clarity with more complex conditional behavior. If you want to capture complex
behavior in a single diagram, use an activity diagram, which will be described in a later
section.
93
A statechart diagram (also called a state diagram) shows the sequence of states
that an object goes through during its life in response to outside stimuli and messages.
The state is the set of values that describes an object at a specific point in time and is
represented by state symbols and the transitions are represented by arrows connecting the
state symbols. A statechart diagram may contain subdiagrams. A state diagram represents
the state of the method execution (that is, the state of the object executing the method),
and the activities in the diagram represent the activities of the object that performs the
method. The purpose of the state diagram is to understand the algorithm involved in
performing a method. To complete an object-oriented design, the activities within the
diagram must be assigned to objects and the control flows assigned to links in the
object diagram.
Two special events are entry and exit, which are reserved words and cannot be
used for event names. These terms are used in the following ways: entry I
actionexpression (the action is to be performed on entry to the state) and exit I
actionexpressed (the action is to be performed on exit from the state). The statechart
supports nested state machines; to activate a substate machine use the keyword do: do I
machine-name (argument-list). If this state is entered, afterthe entry action is completed,
the nested (sub)state machine will be executed with its initial state. When the nested state
machine reaches its final state, it will exit the action of the current state, and the current
state will be considered completed. An initial state is shown as a small dot, and the
transition from the initial state may be labeled with the event that creates the objects;
otherwise, it is unlabeled. If unlabeled, it represents any transition to the enclosing state.
A final state is shown as a circle surrounding a small dot, a bull's-eye. This
represents the completion of activity in the enclosing state and triggers a transition on the
enclosing state labeled by the implicit activity completion event, usually displayed as an
unlabeled transition (see Fig ). The transition can be simple or complex. A simple
transition is a relationship between two states indicating that an object in the first state
will enter the second state and perform certain actions when a specific event occurs; if the
specified
95
A complex transition.
conditions are satisfied, the transition is said to "fire." Events are processed one at a time.
An event that triggers no transition is simply ignored. A complex transition may have
multiple source and target states. It represents a synchronization or a splitting of control
into concurrent threads. A complex transition is enabled when all the source states are
changed, after a complex transition "fires" all its destination states. A complex transition
is shown as a short heavy bar.! The bar may have one or more solid arrows from states to
the bar (these are source states); the bar also may have one or more solid arrows from the
bar to states (these are the destination states). A transition string may be shown near the
bar. Individual arrows do not have their own transition strings (see Fig 5-19).
96
There certainly is no reason to prepare a state diagram for each class in your
system. Indeed, many developers create rather large systems without bothering to create
any state diagrams. However, state diagrams are useful when you have a class that is very
dynamic. In that situation, it often is helpful to prepare a state diagram to be sure you
understand each of the possible states an object of the class could take and what event
(message) would trigger each transition from one state to another. In effect, state
diagrams emphasize the use of events and states to detennine the overall activity of the
system.
Executing a particular step within the diagram represents a state within the
execution of the overall method. The same operation name may appear more than once in
a state diagram, indicating the invocation of the same operation in different phases. An
outgoing solid arrow attached to an activity symbol indicates a transition triggered by the
completion of the activity. The name of this implicit event need not be written, but the
conditions that depend on the result of the activity or other values may be included (see
Fig ). Several transitions with different conditions imply a branching off of control. If
conditions are not disjoint, then the branch is nondeterministic. The concurrent control is
represented by multiple arrows leaving a synchronization bar, which is represented by a
short thick bar with incoming and outgoing arrows. Joining concurrent control is
expressed by multiple arrows entering the synchronization bar. The activity diagram
98
depicted in Fig 5-20, "Process Mortgage Request," is a multistep operation, all of which
are completed before the single operation Draw up insurance policy.
A decision.
An activity diagram is used mostly to show the internal state of an object, but
external events may appear in them. An external event appears when the object is in a
"wait state," a state during which there is no internal activity by the object and the object
is waiting for some external event to occur as the result of an activity by another object
(such as a user input or some other signal). The two states are wait state and activity state.
More than one possible event might take the object out of the wait state; the first one that
occurs triggers the transition. A wait state is the "normal" state.
Activity and state diagrams express a decision when conditions (the UML calls
them guard conditions) are used to indicate different possible transitions that depend on
Boolean conditions of container object. The fig provided for a decision is the traditional
diamond shape, with one or more incoming arrows and two or more outgoing arrows,
each labeled by a distinct guard condition. All possible outcomes should appear on one
of the outgoing transitions (see Fig ). Actions may be organized into swimlanes, each
separated from neighboring swimlanes by vertical solid lines on both sides. Each
swimlane represents responsibility for part of the overall activity and may be
implemented by one or more objects. The relative ordering of the swimlanes has no
semantic significance but might indicate some affinity. Each action is assigned to one
swimlane. A transition may cross lanes; there is no significance to the routing of the
transition path (see Fig ).
later in this book, a full discussion of implementation is beyond the scope of this book.
This section is included to show the place of implementation in the UML.
However, the package could be a first approximation of what eventually will turn
into physical grouping. In that case, the package will become a component .
A component diagram.
of code units. In most cases, component diagrams are used in conjunction with
deployment diagrams to show how physical modules of code are distributed on various
hardware platforms. In many cases, component and deployment diagrams can be
combined .
are small, or they might be suppressed from higher levels. The entire system is apackage.
Fig 5-26 also shows the hierarchical structure, with one package dependent on other
packages. For example, the Customer depends on the package Business Model, meaning
that one or more elements within Customer depend on one or more elements within the
other packages. The package Business Model is shown partially expanded. In this case,
we see that the package Business Model owns theclasses Bank, Checking, and Savings as
well as the packages Clients and Bank. Ownership may be shown by a graphic nesting of
103
the figs or by the expansion of a package in a separate drawing. Packages can be used to
designate not only logical and physical groupings but also use-case groups. A use-case
group, as the name suggests, is a package of use cases.
An example of constraints. A person is a manager of people who work for the accounting
department.
In the UML sequence diagram is for dynamic modeling, where objects are
represented by vertical lines and messages p,assed back and forth between the objects are
modeled by horizontal vectors between the objects. The UML collaboration diagram is an
alternative view of the sequence diagram, showing in a scenario how objects interrelate
with one another. Statechart diagrams, another form of dynamic modeling, focus on the
events occurring within a single object as it responds to messages; an activity diagram is
used to model an entire business process. Thus, an activity model can represent several
different classes.
10.11 REFERENCES
UNIT – III:
CONTENTS
11.1 INTRODUCTION
Analysis is the process of extracting the needs of a system and what the system
must do to satisfy the users' requirement. The goal of object oriented analysis is to
understand the domain of tile problem and the system's responsibilities by understanding
how the users use or will use the system.
what the system must do to satisfy the users' requirements and needs. This is
accomplished by constructing several models of the system that concentrate on
describing what the system does rather than how it does it. Separating the behavior of a
sy7stem from the way that behavior is implemented requires viewing the system from the
perspective of the user rather than that of the machine.
In addition, there are minor methods, such as literature review. However, these
activities must be directed by a use-case model that can capture the user requirements.
The inputs to this phase are the users' requirements, both written and oral, which will be
reduced to the model of the required operational capability of the system.
might lead to user dissatisfaction if the user's interpretation of a fast response is different
from the systems analyst's interpretation. Incomplete requirements mean that certain
requirements necessary for successful system development are not included for a variety
of reasons. These reasons could include the users' forgetting to identify them, high cost,
politics within the business, or oversight by the system developer. However, because of
the iterative nature of object-oriented analysis and the unified approach most of the
incomplete requirements can be identified in subsequent tries. When addressing features
of the system, keep in mind that every additional feature could affect the performance,
complexity, stability, maintenance, and support costs of an application. Features
implemented by a small extension to the application code do not necessarily have a
proportionally small effect on a user interface. For example, if the primary task is
selecting a single object, extending it to support selection of multiple objects could make
the frequent, simple task more difficult to carry out. A number of other factors also may
affect the design of an application. For example, deadlines may require delivering a
product to market with a minimal design process, or comparative evaluations may force
considering additional features. Remember that additional features and shortcuts can
affect the product.
To understand the users' requirements, we need to find out how they "use" the
system. This can be accomplish by developing use cases. Use cases are scenarios for
understanding system requirements.
In addition to developing use cases, which will be described in the next section,
the uses and the objectives of the application must be discussed with those who are going
to use it or be affected by the system. Usually, domain users or experts are the best
authorities. Try to understand the expected inputs and desired responses.
Defer unimportant details until later. State what must be done, not how it should
be done. This, of course, is easier said than done. Yet another tool that can be very useful
for understanding users' requirements is preparing a prototype of the user interface.
Preparation of a prototype usually can help you better understand how the system will be
used, and therefore it is a valuable tool during business object analysis.
108
Having established what users want by developing use cases then documenting
and modeling the application, we can proceed to the design and implementation. The
unified approach (UA) steps can overlap each other. The process is iterative, and you
may have to backtrack to previously completed steps for another try. Separating the what
from the how is no simple process. Fully understanding a problem and defining how to
implement it may require several tries or iterations. In this chapter, we see how a use-case
model can assist us in capturing an application's requirements.
The object-oriented analysis (OOA) phase of the unified approach uses actors and
use cases to describe the system from the users' perspective. The actors are external
factors that interact with the system; use cases are scenarios that describe how actors use
the system. The use cases identified here will be involved throughout the development
process.
The OOA process consists of the following steps :
1. Identify the actors: .Who is using the system? Or, in the case of a new system, who
will be using the system?
2. Develop a simple business process model using UML activity diagram.
3. Develop the use case: .What are the users doing with the system?. Or, in case of the
new system, what will users be doing with the system? .Use cases provide us with
comprehensive documentation of the system under study.
4. Prepare interaction diagrams: .Determine the sequence. .Develop collaboration
diagrams.
5. Classification-develop a static UML class diagram: .Identify classes. . Identify
relationships. .Identify attributes. .Identify methods.
6. Iterate and refine: If needed, repeat the preceding steps.
This is not necessarily the start of every project, but when required, business
processes and user requirements may be modeled and recorded to any level of detail. This
may include modeling as-is processes and the applications that support them and any
number of phased, would-be models of reengineered processes or implementation of the
system. These activities would be enhanced and supported by using an activity diagram.
Business process modeling can be very time consurning, so the main idea should be to
get a basic model without spending too much time on the process. The advantage of
developing a business process model is that it makes you more familiar with the system
and therefore the user requirements and also aids in developing use cases. For example,
let us define the steps or activities involved in using your school library. These activities
can be represented with an activity diagram.
Developing an activity diagram of the business process can give us a better understanding
of what sort of activities are performed in a library by a library member.
Use cases are scenarios for understanding system requirements. A use-case model can be
instrumental in project development, planning, and documentation of systems
requirements. A use case is an interaction between users and a system; it captures the
goal of the users and the responsibility of the system to its users)For example, take a car;
110
typical uses of a car include "take you different places" or "haul your stuff" or a user may
want to use it "off the road."iThe use-case model describes the uses of the system and
shows the courses of events that can be performed. ih other words, it shows a system in
terms of its users and how it is being used from a user point of view. Furthermore, it
defines what happens in the system when the use case is performed. In essence, the use-
case model tries to sysrtematically identify uses of the system and therefore the system's
responsibilities. A use-case model also can discover classes and the relationships among
subsystems of the systems.
(A use-case model can be developed by talking to typical users and discussing the
various things they might want to do with the application being prepared) Each use or
scenario represents what the user wants to do. Each use case must have a name and short
textual description, no more than a few paragraphs. Since the use-case model provides an
external view of a system or application, it is directed primarily toward the users or the
"actors" of the systems, not its implementers (see Figure ).(The use-case model expresses
what the business or application will do and not how; that is the responsibility of the
UML class diagram-FIGURE
Some uses of a library.As you can see, these are uses of external views of the
library system by an actor such as a member, circulation clerk, or supplier instead of a
developer of the library system. The simpler the use-case model, the more effective it will
be. It is not wise to capture all the details right at the start; you can do that later.
111
gram. The UML class diagram, also called an object model, represents the static
relationships between objects, inheritance, association, and the like. The object model
represents an internal view of the system, as opposed to the use-case model, which
represents the external view of the system. The object model shows how the business is
run. Jacobson, Ericsson, and Jacobson call the use-case model a "what model," in
contrast to the object model, which is a "how model."1
An important issue that can assist us in building correct use cases is the
differentiation between user goals and system interactions. Use cases represent the things
that the user is doing with the system, which can be different from the users'
goals:)However, by focusing on users' goals first, we can come up with use cases to
satisfy them. Let us take a closer look at the definition of use case b.y Jacobson et al.,
italics added to highlight the words that are discussed next]: "A Use Case is a sequence of
transactions in a system whose task is to yield results of measurable value to an
individual actor of the system."
Now let us take a look at the key words of this definition: .Use casi Use case is a
special flow of events through the system. By definition, many courses of events are
possible and many of these are very similar. It is suggested that, to make a use-case
model meaningful, we must group the courses of events and call each group a use-case
112
class; For example, how you would borrow a book from the library depends on whether
the book is located in the library, whether you are the member of the library, and so on.
All these alternatives often are best grouped into one or two use cases, called
Borrow books and Get an interlibrary loan (we will look at the relationships of these two
use cases in the next section). By grouping the uses cases, we can manage complexities
and reduce the number of use cases in a package. .Actors.iAn actor is a user playing a
role with respect to the system. When dealing with actors, it is important to think about
roles rather than just people and their job titles . For instance, a first-class passenger may
play the role of business- class passenger. The actor is the key to finding the correct use
cases.
Actors carry out the use cases. A single actor may perform many use cases;
furthermore, a use case may have several actors performing it. Actor also can be an
external system that needs some information from the current system. Actors can be the
ones that get value from the use case, or they can just participate in the use case . .In a
system. This simply means that the actors communicate with the system's use case.
A measurable value. A use case must help the actor to perform a task that has some
identifiable value; for example, the performance of a use case in terms of price or cost.
For example, borrowing books is something of value for a member of the library.
113
The use-case diagram depicts the extends and uses relationships, where the interlibrary
loan is a special case of checking out books. Entering into the system is common to get
an interlibrary loan, borrow books, and return books use cases, so it is being "used" by all
these use cases.
. Transaction.A transaction is an atomic set of activities that are perfonned either fully or
not at all. A transaction is triggered by a stimulus from an actor to the system or by a
point in time being reached in the system. The following are some examples of use cases
for the library (see Figure ).
Three actors appear in Figure : a member, a circulation clerk, and a supplier.
.Use-case name: Borrow books. A member takes books from the library to read at home,
registering them at the checkout desk so the library can keep track of its books.
Depending on the member's record, different courses of events will follow.
.Use-case name: Get an interlibrary loan. A member requests a book that the library does
not have. The book is located at another library and ordered through an interlibrary loan.
.Use-case name: Return books. A member brings borrowed books back to the library. .
.Use-case name: Check library card. A member submits his or her library card to the
clerk, who checks the borrower's record. . Use-case name: Do research. A member
comes to the library to do research. The member can search in a variety of ways (such as
through books, journals, CDROM, WWW) to find information on the subjects of that
research.
. Use-case name: Read books, newspaper. A member comes to the library for a quiet
place to study or read a newspaper, journal, or book. . Use-case name: Purchase supplies.
The supplier provides the books, journals, and newspapers purchased by the library.
In Figure , the library has an environment with three types of actors (member,
circulation clerk, and supplier) and seven use cases (borrow books, return books, get an
interlibrary loan, do research, read books or newspaper, and purchase supplies).
The extends association is used when you have one use case that is similar to
another use case but does a bit more or is more specialized; in essence, it is like a
subclass.'}:n our example, checking out a book is the basic use case. This is the case that
will represent what happens when all goes smoothly. However, many things can affect
the flow of events. For example, the book already might be checked out or the library
might not have the requested book. Therefore, we cannot always perform the usual
behavior associated with the given use case and need to create other use cases to handle
the new situations. Of course, one option is to put this variation within the use case.
However, the use case quickly would become cluttered with lots of special logic, which
would obscure the normal flow .
114
To remedy this problem, we can use the extends association. Here, you put the
base or normal behavior in one use case and the unusual behaviors somewhere else; but
instead of cutting and pasting the shared behavior between the base (common) and more
specialized use cases, you utilize an extends association to expand the common behavior
to fit the special circumstances. Figure1 extends" Figure 2 to include extends and uses
associations.
The uses association occurs when you are describing your use cases and notice
that some of them have subflows in common. To avoid describing a subflow more than
once in several use cases, you can extract the common subflow and make it a use case of
its own. This new use case then can be used by other use cases. The relationships among
the other use cases and this new extracted use case is called a uses association.) The uses
association helps us avoid redundancy by allowing a use case to be shared. For example,
checking a library card is common among the borrow books, return books, and
interlibrary loan use cases (see Figure ).
The similarity between extends and uses associations is that both can be viewed
as a kind of inheritance. When you want to share common sequences in several use cases,
utilize the uses association by extracting common sequences into a new, shared use case.
The extends association is found when you add a bit more specialized, new use case that
extends some of the use cases that you have.
(Use cases could be viewed as concrete or abstract. An abstract use case is not complete
and has no initiation actors but is used by a concrete use case, which does interact with
actors. This inheritance could be used at several levels. Abstract use cases also are the use
cases that have uses or extends associations. All the use cases depicted in Figure are
concrete, since they all have initiation actors.
perform tasks some of which can be done by others and others that are unique. However,
try to isolate the roles that the users can play.
You have to identify the actors and understand how they will use and interact with
the system. In a thought-provoking book on requirement analysis, Gause and Weinberg ,
explain what is known as the railroad paradox:
When trying to find all users, we need to beware of the Railroad Paradox.When
railroads were asked to establish new stops on the schedule, they "studied the
requirements," by sending someone to the station at the designated time to see if anyone
was waiting for a train. Of course, nobody was there because no stop was scheduled, so
the railroad turned down the request because there was no demand.
Gause and Weinberg concluded that the railroad paradox appears everywhere there are
products and goes like this (which should be avoided):
1. The product is not satisfying the users.
2. Since the product is not satisfactory, potential users will not use it.
3. Potential users ask for a better product.
4. Because the potential users do not use the product, the request is denied.
Therefore, since the product does not meet the needs of some users, they are not
identified as potential users of a better product. They are not consulted and the product
stays bad . The railroad paradox suggests that a new product actually can create users
where none existed before{ Candidates for actors can be found through the answers to the
following questions:
Who is using the system? Or, who is affected by the system? Or, which groups need help
from the system to perform a task?
116
.Who affects the system? Or, which user groups are needed by the system to perform its
functions? These functions can be both main functions and secondary / functions, such as
administration.
.Which external hardware or other systems (if any) use the system to perform tasks?
."What problems does this application solve (that is, for whom)? . And, finally, how do
users use the system (use case)? What are they doing with 'the system.
When requirements for new applications are modeled and designed by a group that
excludes the targeted users, not only will the application not meet the users' needs, but
potential users will feel no involvement in the process and not be committed to giving the
application a good try. Always remember Veblen's principle:
'There's no change, no matter how awful, that won't benefit some people; and no change,
no matter how good, that won't hurt some." , Another issue worth mentioning is that
actors need not be human, although actors are represented as stick figures within a use-
case diagram. An actor also can be an external system. For example, an accounting
system that needs information from a system to update its accounts is an actor in that
system .
When you have defined a set of actors, it is time to describe the way they interact
with the system. This should be carried out sequentially, but an iterated approach may be
necessary. Here are the steps for finding use cases :
1. For each actor, find the tasks and functions that the actor should be able to perform or
that the system needs the actor to perform. The use case should represent a course of
events that leads to a clear goal (or, in some cases, several distinct goals that could be
alternatives for the actor or for the system).
2. Name the use cases (see Section 6.6.8).
3. Describe the use cases briefly by applying terms with which the user is familiar. This
makes the description less ambiguous. Once you have identified the use-cases candidates,
it may not be apparent that
all of these use cases need to be described separately; some may be modeled as variants
of others. Consider what the actors want to do. It is important to separate actors from
users. The actors each represent a role
that one or several users can play. Therefore, it is not necessary to model different actors
that can perform the same use case in the same way. The approach should allow different
users to be different actors and play one role when performing a particular actor's use
case. Thus, each use case has only one main actor. To achieve this, you have to
. Isolate users from actors.
. Isolate actors from other actors (separate the responsibilities of each actor).
.Isolate use cases that have different initiating actors and slightly different behavior (if the
actor had been the same, this would be modeled by a use-case alternative behavior) .
While finding use cases, you might have to make changes to your set of actors. All actor
changes should be updated in the textual description of actors and use cases. The change
should be carried out with care, since changes to the set of actors affect the use cases as
well.
117
When specifying use cases, you might discover that some of them are variants of each
other. If so, try to see how you can reuse the use case through extends or uses
associations .
How Detailed Must a Use Case Be? When to Stop Decomposing and When to
Continue
A use case, as already explained, describes the courses of events that will be
carried out by the system. Jacobson et al. believe that, in most cases, too much detail may
not be very useful. During analysis of a business system, you can develop one use-case
diagram as the system use case and draw packages on this use case to represent the
various business domains of the system. For each package, you may create a child
usecase diagram (see the case in Section 6.7 for an example). On each child use-case
diagram, you can draw all of the use cases of the domain, with actions and interactions.
You can further refine the way the use cases are categorized. The extends and uses
relationships can be used to eliminate redundant modeling of scenarios.
When should use cases be employed? Use cases are an essential tool in capturing
requirements and planning and controlling any software development project. Capturing
use cases is a primary task of the analysis phase. Although most use cases are captured at
the beginning of the project, you will uncover more as you proceed.
How many use cases do you need? Ivar Jacobson believes that, for a lO-
personyear project, he would expect 20 use cases (not counting the uses and extends
associations). Other researchers, such as Fowler and Scott, would come up with 100 use
cases for a project of the same magnitude. Some prefer smaller grained, more detailed use
cases. There is no magic formula; you need to be flexible and work with whatever
magnitude you find comfortable . The UML specification recommends that at least one
scenario be prepared for each significantly different kind of use case instance. Each
scenario shows a different sequence of interactions between actors and the system, with
all decisions definite. When you have arrived at the lowest use-case level, which cannot
be broken down any further, you may create a sequence diagram and an accompanying
collaboration diagram for the use case. With the sequence and collaboration diagrams,
you can model the implementation of the scenario .
Each use case represents a particular scenario in the system. You may model
either how the system currently works or how you want it to work. Typically, a design is
broken down into packages. You must narrow the focus of the scenarios in your system.
For example, in a library system, the various scenarios involve a supplier providing
books or a member doing research or borrowing books. In this case, there should be three
separate packages, one each for Borrow books, Do research, and Purchase books. Many
applications may be associated with the library system and one or more databases used to
store the information (see Figure).
118
A library system can be divided into many packages, each of which encompasses
multiple use cases.
This is an iterative process that goes on until the problem is well understood. The
main objective of object-oriented analysis is to find out what the problem is by
developing a use-case model, which Jacobson et al. call the "what model." We saw that
119
use cases are an essential tool in capturing requirements. Capturing use cases is one of the
first things to do in coming up with requirements.
Requirements must be traceable across analysis, design, coding, and testing. The
unified approach follows Jacobson et al.'s life cycle to produce systems that can be traced
across all phases of the developments.
11.10 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –printice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
120
CONTENTS
12.1 INTRODUCTION
Documenting your project not only provides a valuable reference point and form
of communication but often helps reveal issues and gaps in the analysis and design. A
document can serve as a communication vehicle among the project's team members, or it
can serve as an initial understanding of the requirements. Blum concludes that
management has responsibility for resources such as software, hardware, and operational
expenses. In many projects, documentation can be an important factor in making a
decision about committing resources. Application software is expected to provide a
solution to a problem. It is very difficult, if not impossible, to document a poorly
understood problem. The main issue in documentation during the analysis phase is to
determine what the system must do. Decisions about how the system works are delayed
to the design phase. Blum raises the following questions for determining the importance
of documentation: How . will a document be used? (If it will not be used, it is not
121
necessary.) What is the objective of the document? What is the management view of the
document? Who are the readers of the document?
Bell and Evans provide us the following guidelines for making documents fit
the needs and expectations of your audience:
Common cover. All documents should share a common cover sheet that identifies the
document, the current version, and the individual responsible for the content. As the
document proceeds through the life cycle phases, the responsible individual may change.
That change must be reflected in the cover sheet .
Figure depicts a cover sheet template. .80-20 rule. As for many applications, the
80-20 rule generally applies for ocumentation 80 percent of the work can be done with 20
percent of the documentation. The trick is to make sure that the 20 percent is easily
accessible and the rest (80 percent) is available to those (few) who need to know.
.Familiar vocabulary. The formality of a document will depend on how it is used and who
will read it. When developing a documentation use a vocabulary that your readers
understand and are comfortable with. The main objective here is to communicate with
readers and not impress them with buzz words.
Make the document as short as possible. Assume that you are developing a
manual. The key in developing an effective manual is to eliminate all repetition; present
surpmaries, reviews, organization chapters in less than three pages; and make chapter
headings task oriented so that the table of contents also could serveas an index . Organize
the document. Use the rules of good organization (such as the organization's standards,
college handbooks, Strunk and White's Elements of Styleor the University of Chicago
Manual of Style) within each section. Appendix
122
A ViaNet bank client can have two types of accounts: a checking account and
savings account. For each checking account, one related savings account can exist. .
Access to the ViaNet bank accounts is rovided by a PIN code consisting of four integer
digits between 0 and 9. .One PIN code allows access to all accounts held by a bank
client. .No receipts will be provided for any account transactions. .The bank application
operates for a single banking institution only. .Neither a checking nor a savings account
can have a negative balance. The system should automatically withdraw money from a
related savings account if the requested withdrawal amount on the checking account is
more than its current balance. If the balance on a savings account is less than the
withdrawal amount requested, the transaction will stop and the bank client will be
notified. In this chapter, we identify the actors and use cases of the ViaNet bank ATM
system that will be used by subsequent chapters.
Identifying Actors and Use Cases for the ViaNet Bank ATM System
The bank application will be used by one category of users: bank clients. Notice
that identifying the actors of the system is an iterative process and can be modified as you
learn more about the system. The actor of the bank system is the bank client. The bank
client must be able to deposit an amount to and withdraw an
amount from his or her accounts using the bank application. The following scenarios
show use-case interactions between the actor (bank client) and the bank. In real life
application these use cases are created by system requirements, examination of existing
system documentation, interviews, questionnaire, observation, etc.
. Use-case name: Bank ATM transaction. The bank clients interact with the bank system
by going through the approval process. After the approval process, the bank client can
perform the transaction. Here are the steps in the ATM transaction use case:
1. Insert ATM card.
2. Perform the approval process.
3. Ask type of transaction.
4. Enter type of transaction.
5. Perform transaction.
6. Eject card.
7. Request take card.
8. Take card.
These steps are shown in the Figure activity diagram. .Use-case name: Approval process.
The client enters a PIN code that consists of digits.
123
withdrawal is successful. This use case extends the withdraw amount use case. (See
Figure. Use-case name: Withdraw savings denied. The client withdraws an amount from
a savings account. If the amount is more than the balance, the transaction is
halted and a message is displayed.
This use case extends the bank transaction use case. (See Figure.Use-case name:
Savings transaction history. The bank client requests a history of transactions for a
savings account. The system displays the transaction history for the savings account. This
use case extends the bank transaction use case. (See Figure)
The use-case list contains at least one scenario of each significantly different kind
of use-case instance. Each scenario shows a different sequence of interactions between
actors and the system, with all decisions definite. If the scenario consists of an if
statement, for each condition create one scenario.
Note that the extends association is used when you have a use case that is similar
to another use case but does a bit more. In essence, it is a subclass. In the example, the
Checking withdraw use case extends the Withdraw amount use case.The Withdraw
amount use case represents the case when all goes smoothly. However, many things can
affect the flow of events, such as when the withdrawal is for more than the amount of
126
money in the checking account. Withdraw more from checking is the use case that
extends the Checking withdraw. You can put this variation within the Checking withdraw
use case, too. However, this would clutter the use case with lots of special logic, which
would obscure the normal flow. To review, the uses association occurs when a behavior
is common to more than one use case and you want to avoid copying the description of
that behavior. The Approval process is such a use case that is used by Bank transaction
use case. As you can see, use cases are an essential tool for identifying requirements.
Developing use cases is an iterative process. Although most use cases are generated at
this phase of system development, you will uncover more as you proceed. Fowler and
Scott advise us to keep an eye out for them at all times. Every use case represents a
potential requirement.
Each use case represents a particular scenario in the system. As explained earlier,
it is better to break down the use cases into packages. Narrow the focus of the scenarios
in the system. In the bank system, the various scenarios involve checking account,
savings account, and general bank transactions. (See Figure .)
Remember, use case is a method for capturing the way a system or business
works. Use cases are used to model the scenarios. The scenarios are described textually
or through a sequence of steps. Modeling with use cases is a recommended tool in finding
the objects of a system. In the next chapter, we look at identifying classes based on the
use cases identified here.
Amount
Approval Process
ATM Card
ATM Machine
Bank
Bank Client
Card
Cash
Check
Checking
Checking Account
Client
Client's Account
Currency
Dollar
Envelope
Four Digits
Fund
Invalid PIN
Message
127
Money
Password
PIN .
PIN Code
Record
Savings
Savings Account
Step.
System
Transaction
Transaction History
It is safe to eliminate the irrelevant classes. The candidate classes must be selected
from relevant and fuzzy classes. The following irrelevant classes can be eliminated
because they do not belong to the problem statement: Envelope, Four Digits, and Step.
Strikeouts indicate eliminated classes.
Account
Account Balance
Amount
Approval Process
ATM Card
ATM Machine
Bank .
BankClient
Card
Cash
Check
Checking
Checking Account
Client
Client's Account
Currency
Dollar
ElWelape
FeMeDigits
Fund
Invalid PIN
Message
Money,
Password
PIN
PIN Code
Record
Savings
Savings Account
System
Transaction -Transaction History
128
Classes are an important mechanism for classifying objects. The chief role of a
class is to define the attributes, methods, and applicability of its instances. The class car,
for example, defines the property color. Each individual car (formally, each instance of
the class car) will have a value for this property, such as maroon, yellow, or white.
It is fairly natural to partition the world into objects that have properties
(attributes)and methods (behaviors). It is common and useful partitioning or
classification, but we also routinely divide the world along a second dimension: We
distinguish classes from instances. A class is a specification of structure, behavior, and
the description of an object. Classification is concerned more with identifying the class of
an object than the individual objects within a system. Martin and Odell explain that
classes are important because they create conceptual building blocks for designing
systems:
properly. Tou and Gonzalez describe the recognition of concrete patterns or classes by
humans as a psychophysiological problem that involves a relationship between a person
and a physical stimulus .
When you perceive a real-world object, you make an inductive inference and
associate this perception with some general concepts or clues that you have derived from
your past experience. Human recognition, in reality, is a question of estimating the
relative odds that the input data can be associated with a class from a set of known
classes, which depend on our past experiences and clues for recognition. Intelligent
classification is intellectually hard work and may seem rather arbitrary. That is how our
minds work . Martin and Odell have observed in object-oriented analysis and design that,
"In fact, an object can be categorized in more than one way. For example, in Figure one
person may regard the object Betty as a Woman. Her boss regards her as an Employee.
The person who mows her lawn classifies her as an Employer. The local animal control
agency licenses her as a Pet Owner. The credit bureau reports that Betty is an instance of
the object types called Good Credit Risk-and so on."
The first two approaches have been included to increase your understanding of the
subject; the unified approach uses the use-case driven approach for identifying classes
and understanding the behavior of objects. However, you always can combine these
approaches to identify classes for a given problem.
Object analysis is a process by which we can identify the classes that playa role in
achieving the system goals and requirements. The problem of classification may be
regarded as one of discriminating things, not between the individual objects, but between
classes via the search for features or invariant attributes (or behaviors)among members of
a class. Finding classes is one of the hardest activities in object-oriented analysis.
12.8 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –printice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
131
CONTENTS
13.1 INTRODUCTION
irrelevant classes, which either have no purpose or will be unnecessary. Candidate classes
then are selected from the other two categories.
Keep in mind that identifying classes and developing a UML class diagram just
like other activities is an iterative process. Depending on whether such object modeling
is for the analysis or design phase of development, some classes may need to be added or
removed from the model and, remember, flexibility is a virtue. You must be able to
formulate a statement of purpose for each candidate class; if not, simply eliminate it.
The following are guidelines for selecting classes in an application: .Look for
nouns and noun phrases in the use cases. . Some classes are implicit or taken from
general knowledge. . All classes must make sense in the application domain; avoid
computer implementation classes-defer them to the design stage. . Carefully choose and
define class names.
As explained before, finding classes is not easy. The more practice you have, the
better you get at identifying classes. Finding classes is an incremental and iterative
process. Booch explains this point elegantly: "Intelligent classification is intellectually
hard work, and it best comes about through an incremental and iterative process. This
incremental and iterative nature is evident in the development of such diverse software
technologies as graphical user interfaces,
Using the noun phrase strategy, candidate classes can be divided into three
categories: Relevant Classes, Fuzzy Area or Fuzzy Classes (those classes that we are not
sure about), and Irrelevant Classes. database standards, and even fourth-generation
languages." As Shaw observed in software engineering, the development of individual
abstractions often follows a common pattern. First the problems are solved ad hoc. As
experience accumulates, some solutions turn out to work better than others, and a sort of
folklore is passed informally from person to person. Eventually, the useful solutions are
understood more systematically, and they are codified and analyzed. This enables the
development of models that support automatic implementation and theories that allow the
generalization of the solution. This in turn enables a more sophisticated level of practice
and allows us to tackle harder problems-which we often approach ad hoc, starting the
cycle over again.
133
The following guidelines help in selecting candidate classes from the relevant
and fuzzy categories of classes in the problem domain. .Redundant classes. Do not keep
two classes that express the same information.
If more than one word is being used to describe the same idea, select the one that
is the most meaningful in the context of the system. This is part of building a common
vocabulary for the system as a whole . Choose your vocabulary carefully; use the word
that is being used by the user of the system. .Adjectives classes. Wirfs-Brock, Wilkerson,
and Wiener warn us about adjectives:
"Be wary of the use of adjectives. Adjectives can be used in many ways. An
adjective can suggest a different kind of object, different use of the same object, or it
could be utterly irrelevant. Does the object represented by the noun behave differently
when the adjective is applied to it? If the use of the adjective signals that the behavior of
the object is different, then make a new class" . For example, Adult Members behave
differently than Youth Members, so ,the two should be classified as different classes.
.Attribute classes. Tentative objects that are used only as values should be defined or
restated as attributes and not as a class. For example, Client Status and Demographic of
Client are not classes but attributes of the Client class. .Irrelevant classes. Each class must
have a purpose and every class should be clearly defined and necessary. You must
formulate a statement of purpose for each candidate class. If you cannot come up with a
statement of purpose, simply eliminate the candidate class.
The process of eliminating the redundant classes and refining the remaining classes is not
sequential.
You can move back and forth among these steps as often as you like. Remember
that this is an incremental process. Some classes will be missing, others will be
eliminated or refined later. Unless you are starting with a lot of domain knowledge, you
probably are missing more classes than you will eliminate. Although some classes
ultimately may become superclasses, at this stage simply identify them as individual,
134
specific classes. Your design will go through many stages on its way to completion, and
you will have adequate opportunity to revise it .
Like any other activity of software development, the process of identifying relevant
classes and eliminating irrelevant classes is an incremental process. Each iteration often
uncovers some classes that have been overlooked. The repetition of the entire process,
combined with what you already have learned and the reworking of your candidate
classes will enable you to gain a better understanding of the system and the classes that
make up your application. Classification is the essence of good object-oriented analysis
and design. You must continue this refining cycle through the development process until
you are satisfied with the results. Remember that this process (of eliminating redundant
classes, classes containing adjectives, possible attributes, and irrelevant classes) is not
sequential. You can move back and forth among these steps as often as you like (see
Figure)
To better understand the noun phrase method, we will go through a case and
apply the noun phrase strategy for identifying the classes. We must start by reading the
use cases and applying the principles discussed in this chapter for identifying classes.
The initial study of the use cases of the bank system produces the following noun
phrases (candidate classes-maybe).
Account
Account Balance
Amount
Approval Process
ATM Card
ATM Machine
Bank
Bank Client
Card
Cash
Check
Checking
Checking Account
Client
Client's Account
135
Currency
Dollar
Envelope
Four Digits
Fund
Invalid PIN
Message
Money
Password
PIN
PIN Code
Record
Savings
Savings Account
Step.
System
Transaction
Transaction History
Password
PIN
PIN Code
Record
Savings
Savings Account
System
Transaction -
Transaction History
We need to review the candidate list to see which classes are redundant. If
different words are being used to describe the same idea, we must select the one that is
the most meaningfull the context of the system and eliminate the others. The following
are the different class names that are being used to refer to the same concept:
Client, BankClient Account, Client's Account PIN, PIN Code Checking,
Checking Account = BankClient (the term chosen)
Checking Account = Account
Checking Account = PIN
Checking Account = Checking Account
Savings, Savings Account = Savings Account
Fund, Money = Fund
ATM Card, Card = ATM Card
Here is the revised list of candidate classes:
Account
Account Balance
Amount
Approval Process
ATM Card
Bank
BankClient
6affi
Cash
Check
Checking Account
Currency
Dollar
Fund digits
Fund
Invalid PIN
Message
Message
Password
PIN
PIN Case
137
Record
Savings
Savings Account
System
Transaction
Transaction History
Veagain review the remaining list, now with an eye on classes with adjectives.
The lain question is this: Does the object represented by the noun behave differently
when the adjective is applied to it? If an adjective suggests a different kind of class or the
class represented by the noun behaves differently when the adjective is applied to it, then
we need to make a new class. However(it is a different use of the same object or the class
is irrelevant, we must eliminate it) In this example, we have no classes containing
adjectives that we can eliminate.
The next review focuses on identifying the noun phrases that are attributes, not
classes. The noun phrases used only as values should be restated as attributes. This
process also will help us identify the attributes of the classes in the system. Balance: An
attribute of the Account class.Invalid PIN: It is only a value, not a class. Password: An
attribute, possibly of the BankClient class.Transaction History: An attribute, possibly of
the Transaction class. ..PIN: An attribute, possibly of the BankClientclass. Here is the
revised list of candidate classes. Notice that the eliminated classes are strikeouts (they
have a line through them).
Account
Approval Process
ATM Card
Bank
BankClient
Cash
Check
CheelflRg
Checking Account
Currency
Dollar
Fund
Message
MaBey
PIN
Record
Savings Account
System
Transaction
138
Identifying the classes that playa role in achieving system goals and requirements
is a major activity of object-oriented analysis) Each class must have a purpose.Every
class should be clearly defined and necessary in the context of achieving the system's
goals. If you cannot formulate a statement of purpose for a class, simply eliminate it. The
classes that add no purpose to the system have been deleted from the list. The candidate
classes are these: /1\TM Machine class: Provides an interface to the ViaNet bank.
ATMCard class: Provides a client with a key to an account. BankClient class: A client is
an individual that has a checking account and, possibly, a savings account.
Bank class: Bank clients belong to the Bank. It is a repository of accounts and processes
the accounts' transactions.
Account class: An Account class is a formal (or abstract) class, it defines the common
behaviors that can be inherited by more specific classes such as CheckingAccount and
SavingsAccount. CheckingAccount class: It models a client's checking account and
provides more specialized withdrawal service.
.savingsAccount class: It models a client's savings account. Transaction class: Keeps
track of transaction, time, date, type, amount, and 'balance.
No doubt, some classes are missing from the list and others will be eliminated or refined
later. Unless you are starting with a lot of domain knowledge, you probably will miss
more classes than you will eliminate. After all, this is an incremental process; as you
learn more about the problem, your design will go through many stages on its way to
completion. Remember, there is no such thing as the "right" set of classes. However, the
process of identifying classes can improve gradually through this incremental process.
The major problem with the noun phrase approach is that it depends on the completeness
and correctness of the available document, which is rare in real life. On the other hand,
large volumes of text on system documentation might lead to too many candidate classes.
Even so, the noun phrase exercise can be very educational and useful if combined with
other approaches, especially with use cases as we did here.
In this chapter, we studied four approaches for identifying classes: the noun
phrase, common class patterns, use-case driven, and Classes, Responsibilities, and
Collaborators. The process of identifying classes can improve gradually through the
incremental process. Some classes will be missing in the first few cycles of identification,
and others will be eliminated or refined later. Unless you are starting with a lot of domain
knowledge, you probably will miss more classes than you will eliminate. Your design
will go through many stages on its way to completion as you learn more about the
problem. To identify classes using the noun phrase approach, read through use cases,
looking for noun phrases. Consider nouns in the textual description to be classes and
verbs to be methods of the classes.
139
13.7 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –printice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
140
CONTENTS
14.1 INTRODUCTION
This information guides us in defining mechanisms that properly manage object within-
object .
The use-case driven approach is the third approach that we examine in this
chapter and the one that is recommended. From the previous chapter, we learned that use
cases are employed to model the scenarios in the system and specify what external actors
interact with the scenarios. The scenarios are described in text or through a sequence of
steps. Use-case modeling is considered a problem-driven approach to object-oriented
analysis, in that the designer first considers the problem at hand and not the relationship
between objects, as in a data-driven approach.
Modeling with use cases is a recommended aid in finding the objects of a system
and is the technique used by the unified approach. Once the system has been described in
terms of its scenarios, the modeler can examine the textual description or steps of each
scenario to determine what objects are needed for the scenario to occur. However, this is
not a magical process in which you start with use cases, develop a sequence diagram, and
voila, classes appear before your eyes. The process of creating sequence or collaboration
diagrams is a systematic way to think about how a use case (scenario) can take place; and
by doing so, it forces you to think about objects involved in your application.
When building a new system, designers model the scenarios of the way the
system of business should work. When redesigning an existing system, many modelers
choose to first model the scenarios of the current system, and then model the scenarios of
the way the system should work. Developing scenarios also requires us to think about
class methods, which will be studied in later chapters.
142
The UML specification recommends that at least one scenario be prepared for
each significantly different use-case instance. Each scenario shows a different sequence
of interaction between actors and the system, with all decisions definite. In essence, this
process helps us to understand the behavior of the system's objects. When you have
arrived at the lowest use-case level, you may create a child sequence diagram or
accompanying collaboration diagram for the use case. With the sequence and
collaboration diagrams, you can model the implementation of the scenario .
Like use-case diagrams, sequence diagrams are used to model scenarios in the
systems. Whereas use cases and the steps or textual descriptions that define them offer a
high-level view of a system, the sequence diagram enables you to model a more specific
analysis and also assists in the design of the system by modeling the interactions between
objects in the system.
To identify objects of a system, we further analyze the lowest level use cases with
a sequence and collaboration diagram pair (actually, most CASE tools such as SA/Object
allow you to create only one, either a sequence or a collaboration diagram, and the
system generates the other one). Sequence and collaboration diagrams represent the order
in which things occur and how the objects in the system send messages to one another.
These diagrams provide a macro-level analysis of the dynamics of a system. Once you
start creating these diagrams, you may find that objects may need to be added to satisfy
the particular sequence of events for the given use case.
143
You can draw sequence diagrams to model each scenario that exists when a
BankClient withdraws, deposits, or needs information on an account. By walking through
the steps, you can determine what objects are necessary for those steps to take place.
Therefore, the process of creating sequence or collaboration diagrams can assist you in
identifying classes or objects of the system. This approach can be combined with noun
phrase and class categorization for the best results. We identified the use cases for the
bank system. The following are the low level (executable) use cases:
Deposit Checking
Deposit Savings
Invalid PIN
Withdraw Checking
Withdraw More from Checking
Withdraw Savings
Withdraw Savings Denied
Checking Transaction History
Savings Transaction History
through the ATM, and mayor may not have an account. The BankClient on the other
hand has an account.
The dotted lines are the lifelines. The line on the right represents an actor, in this
case the BankClient, or an event that is outside the system boundary. Recall from
previous chapter that an event arrow connect objects. In effect, the event arrow suggests
that a message is moving between those two objects. An example of an event message is
the request for a PIN. An event line can pass over an object without stopping at that
object. Each event must ha"\'e'a descriptive name. In some cases, several objects are
active simultaneously, even if they are only waiting for another object to return
information to them. In other cases, an object becomes active when it receives a message
and then becomes inactive as soon as it responds . Similarly, we can develop sequence
diagrams for other use cases (as in Figures ). Collaboration diagrams are just another
view of the sequence diagrams and therefore can be created automatically; most UML
modeling tools automatically create them (see Figures )
The following classes have been identified by modeling the UML sequence/
collaboration diagrams: Bank, BankClient, ATMMachine, Account, Checking Account,
and Savings Account. Similarly other classes can be identified by developing the
remaining sequence/ collaboration diagrams. Developing the other
sequence/collaboration diagrams has been left as an exercise; see problem
145
146
147
The collaboration diagram for the Withdraw More from Checkinguse case.
The class name should appear in the upper left-hand corner, a bulleted list of
responsibilities should appear under it in the left two thirds of the card, and the list of
collaborators should appear in the right third. However, rather than simply tracing the
details of a collaboration in the form of message sending, Classes, Responsibilities, and
Collaborators cards place the designer's focus on the motivation for collaboration by
representing (potentially) many messages as phrases of English text.
Classes are identified and grouped by common attributes, which also provides
candidates for super classes. The class names then are written onto Classes,
Responsibilities, and Collaborators cards. The card also notes sub- and super classes to
show the class structure. The application's requirements then are examined for actions
and information associated with each class to find the responsibilities of each class.
149
Next, the responsibilities are distributed; they should be as general as possible and
placed as high as possible in the inheritance hierarchy. The idea in locating collaborators
is to identify how classes interact. Classes (cards) that have a close collaboration are
grouped together physically.
The ViaNet Bank ATM System: Identifying Classes by Using Classes, Responsibilities,
and Collaborators
We already identified the initial classes of the bank system. The objective of this
example is to identify objects' responsibilities such as attributes and methods in that
system.
Account and Transaction provide the banking model. Note that Transaction
assumes an active role while money is being dispensed and a passive role thereafter. The
class Account is responsible mostly to the BankClient class and it collaborates with
several objects to fulfill its responsibilities. Among the responsibilities of the Account
class to the BankClient class is to keep track of the BankClient balance, account number,
and other data that need to be remembered. These are the attributes of the Account class.
Furthermore, the Account class provides certain services or methods, such as means for
BankClient to deposit or withdraw an amount and display the account's Balance (see
Figure ).
As cardsare written for familiar objects, all participants pick up the same context
and ready themselves for decision making. Then, by waving cards and pointing fingers
and yelling statements like, "no, this guy should do that," decisions are made. Finally, the
group starts to relax as consensus has been reached and the issue becomes simply finding
the right words to record a decision as a responsibility on a card.
In similar fashion other cards for the classes that have been identified earlier in
this chapter must be created, with the list of their responsibilities and their collaborators.
As you can see from Figure , this process is iterative. Start with few cards (classes) then
proceed to play "what if." If the situation calls for a responsibility not already covered by
one of the objects, either add the responsibility to an object or create a new object to
address that responsibility. If one of the objects becomes too cluttered during this
process, copy the information on
14.7 ASSOCIATIONS
The association name can be omitted if the relationship is obvious. In some cases,
you will want to provide names for the roles played by the individual classes making up
the relationship. The role name on the side closest to each class describes the role that
class plays relative to the class at the other end of the line, and vice versa .
Identifying Associations
The common association patterns are based on some of the common associations
defined by researchers and practioners: Rumbaugh et al. Coad and Yourdon , and others.
These include .ycation association-next to, part of, contained in. For example, consider a
soup object, cheddar cheese is a-part-of soup. The a-part-of relation is a special type of
association, discussed in more detail later in the chapter. .Communication association-
talk to, order to. For example, a customer places an order (communication association)
with an operator person (see Figure ).
These association patterns and similar ones can be stored in the repository and
added to as more patterns are discovered. However, currently, this capability of the
unified approach's repository is more conceptual than real, but it is my hope that CASE
tool vendors in the near future will provide this capability.
The second method for identifying classes is the common class patterns approach
based on the knowledge base of the common classes proposed by various researchers.
These researchers compiled and listed several categories for finding the candidate classes
and objects.
The third method we studied was use-case driven. To identify objects of a system
and their behaviors, the lowest level of executable use cases is further analyzed with a
sequence and collaboration diagram pair. By walking through the steps, you can
determine what objects are necessary for the steps to take place. Finally,
we looked at the Classes, Responsibilities, and Collaborators, which is a useful tool for
learning about class responsibilities and identifying classes. These approaches can be
mixed for identifying the classes of a given problem. Naming a class is an important
activity, too.
14.12 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –printice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
154
CONTENTS
You should be able to develop the relationship and its associations among classes.
15.1 INTRODUCTION.
The super-sub class hierarchy is a relationship between classes, where one class is
the parent class of another (derived) class. Recall from earlier chapter that the parent
class also is known as the base or super class or ancestor. The super-sub class hierarchy is
based on inheritance, which is programming by extension as opposed to programming by
reinvention . The real advantage of using this technique is that we can build on what we
already have and, more important, reuse what we already have. Inheritance allows classes
to share and reuse behaviors and attributes. Where the behavior of a class instance is
defined in that class's methods, a class also inherits the behaviors and attributes of all of
its superclasses. Now let us take a look at guidelines for identifying classes.
.Bottom-up. Look for classes with similar attributes or methods. In most cases,
you can group them by moving the common attributes and methods to an abstract class.
You may have to alter the definitions a bit; this is acceptable as long as generalization
truly applies. However, do not force classes to fit a preconceived generalization structure.
.jJeusability. Move attributes and behaviors (methods) as high as possible in the
hierarchy. At the same time, do not create very specialized classes at the top of the
hierarchy. This is easier said than done. The balancing act can be achieved through
several iterations. This process ensures that you design objects that can be reused in
another application.
156
One way to achieve the benefits of multiple inheritance is to inherit from the most
appropriate class and add an object of another class as an attribute. In essence, a multiple
inheritance can be represented as an aggregation of a single inheritance and aggregation.
This meta-model reflects this situation.
clear distinction between the part and the whole can help us determine where
responsibilities for certain behavior must reside. This is done mainly by asking the
following questions :
. Container. A physical whole encompasses but is not constructed from physical parts; for
example, a house can be considered as a container for furniture and appliances (see
Figure ).
To better gain experience in object relationship analysis, we use the familiar bank
system case and apply the concepts in this chapter for identifying associations, supersub
relationships, and a-part-of relationships for the classes identified. As explained before,
we must start by reading the requirement specification, which is presented here.
Furthermore, object-oriented analysis and design are performed in an iterative process
using class diagrams. Analysis is performed on a piece of the system, design details are
added to this partial analysis model, and then the design is implemented. Changes can be
made to the implementation and brought back into the analysis model to continue the
cycle. This iterative process is unlike the traditional waterfall technique, in which all
analysis is completed before design begins.
The UML class diagram is the main static analysis and design diagram of a
system. The analysis generally consists of the following class diagrams .One class
diagram for the system, which shows the identity and definition of classes in the system,
their interrelationships, and various packages containing groupings of classes.
160
UML class diagram for the ViaNet bank ATM system. Some CASE tools such as the
SA/Object Architect can automatically define classes and draw them from use cases or
collaboration/ sequence diagrams. However, presently, it cannot identify all the classes.
For this example, S/A Object was able to identify only the BankClient class.
. Multiple class diagrams that represent various pieces, or views, of the system class
diagram. .Multiple class diagrams, that show the specific static relationships between
various classes.
First, we need to create the classes that have been identified in the previous chapter; we
will add relationships later (see Figure ).
two accounts we need to change the cardinality of the association (see Figure ). Other
associations and their cardinalities are defined in Table 8-1 and demonstrated in Figure .
Let us review the guidelines for identifying super-sub relationships: . Top-down. Look
for noun phrases composed of various adjectives in the class name. . Bottom-up. Look
for classes with similar attributes or methods. In most cases, you can group them by
moving the common attributes and methods to an abstract class. .Reusability. Move
attributes and behaviors (methods) as high as possible in the hierarchy. .Multiple
inheritance. Avoid excessive use of multiple inheritance. CheckingAccount and
SavingsAccount both are types of accounts. They can be defined as specializations of the
Account class. When implemented, the Account
To identify a-part-of structures, we look for the following clues: .Assembly. A physical
whole is constructed from physical parts. . Container. A physical whole encompasses but
is not constructed from physical parts. . Collection-Member. A conceptual whole
encompasses parts that may be physical or conceptual.
generalization, and aggregation among the bank systems classes. If you are wondering
what is the relationship between the BankClient and ATMMachine, it is an interface.
Identifying a class interface is a design activity of object-oriented system development.
Some common associations patterns are next to, part of, and contained in a
relation; directed actions and communication associations include talk to or order from.
The process ensures that you design objects that can be reused in another
application. Finally, avoid excessive use of multiple inheritance. It is more difficult to
understand programs written in a multiple inheritance system. One way of achieving the
benefits of multiple inheritance is to inherit from the most appropriate class and add an
object of another class as an attribute. The a-part-of relationship, sometimes called
aggregation, represents a situation where a class comprises several component classes. A
class composed of other classes does not behave like its parts but very differently. For
example, a car consists of many other classes, one of which is a radio, but a car does not
behave like a radio. Some common aggregation/a-part-of patterns are assembly,
container, and collection-member. The a-part-of structure is a special form of association,
and similarly, association can be represented by the a-part-of relation.
Identifying attributes and methods is like finding classes, a difficult activity and
an iterative process. Once again, the use cases and other UML diagrams will be a guide
for identifying attributes, methods, and relationships among classes. Methods and
messages are the workhorses of object-oriented systems. The sequence diagrams can
assist us in defining services that the objects must provide.
15.9 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –printice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
165
UNIT – IV
CONTENTS
16.1 INTRODUCTION
It was explained in previous chapters that the main focus of the analysis phase of
software development is on "what needs to be done." The objects discovered during
analysis can serve as the framework for design . The class's attributes, methods, and
associations identified during analysis must be designed for implementation as a data
type expressed in the implementation language. New classes must be introduced to store
intermediate results during program execution. Emphasis shifts from the application
domain to implementation and computer concepts such as user interfaces or view layer
and access layer (see Figures ).
During the analysis, we look at the physical entities or business objects in the
system; that is, who the players are and how 'they cooperate to do the work of the
application. These objects represent tangible elements of the business. As we saw in
Chapter 7, these objects could be individuals, rganizations, machines, or whatever else
makes sense in the context of the real-world system. During the design phase, we elevate
the model into logical entities, some of which might relate more to the computer domain
(such as user interfaces or the access layer) than the realworld or the physical domain
(such as people or employees). This is where we begin thinking about how to actually
implement the problem in a program. The goal here is to design the classes that we need
to implement the system.
166
Fortunately, the design model does not look terribly different from the analysis
model. The difference is that, at this level, we focus on the view and access classes, such
as how to maintain information or the best way to interact with a user or present
information. It also is useful, at this stage, to have a good understanding of the classes in
a development environment that we are using to enforce reusability. In software
development, it is tempting not to be concerned with design. After all, you (the designer)
are so involved with the system that it might be difficult to stop and think about the
consequences of each design choice. However, the time spent on design has a great
impact on the overall success of the software development project. A large payoff is
associated with creating a good design "up front," before writing a single line of code.
While this is true of all programming, classes and objects underscore the approach even
more. Good design usually simplifies the implementation and maintenance of a project.
In this chapter, we look at the object-oriented design process and axioms. The
basic goal of the axiomatic approach is to formalize the design process and assist in
establishing a scientific foundation for the object-oriented design process, to provide a
fundamental basis for the creation of systems. Without scientific principles, the design
field never will be systematized and so will remain a subject difficult to comprehend,
codify, teach, and practice .
Consequently, a theorem is valid if its referent axioms and deductive steps are
valid. A corollary is a proposition that follows from an axiom or another proposition that
has been proven.
The author has applied Suh's design axioms to object-oriented design. Axiom 1
deals with relationships between system components (such as classes, requirements, and
software components), and Axiom 2 deals with the complexity of design.
Axiom 1 states that, during the design process, as we go from requirement and use
case to a system component, each component must satisfy that requirement without
affecting other requirements. You been asked to design a refrigerator door, and there are
two requirements: The door should provide access to food, and the energy lost should be
minimal when the door is opened and closed. In other words, opening the door should be
independent of losing energy. Is the vertically hung door a good design? We see that
vertically hung door violates Axiom 1, because the two specific requirements (i.e., access
to the food and minimal energy loss) are coupled and are not independent in the proposed
design. When, for example, the door is opened to take out milk, cold air in the
refrigerator escapes and warm air from the outside enters. What is an uncoupled design
that somehow does not combine these two requirements? Once such uncoupled design of
the refrigerator door is a horizontally hinged door, such as used in chest-type freezers.
When the door is opened to take out milk, the cold air (since it is heavier than warm air)
will sit at the bottom and not escape. Therefore, opening the door provides access to the
food and is independent of energy loss. This type of design satisfies the first axiom.
16.3 COROLLARIES
From the two design axioms, many corollaries may be derived as a direct consequence of
the axioms. These corollaries may be more useful in making specific design decisions,
since they can be applied to actual situations more easily than the original axioms. They
even may be called design rules, and all are derived from the two basic axioms (see
Figure ):
.Corollary 1. Uncoupled design with less information content. Highly cohesive objects
can improve coupling because only a minimal amount of essential information need be
passed between objects.
FIGURE
The origin of corollaries. Corollaries 1, 2, and 3 are from both axioms, whereas
corollary4 is from axiom 1 and corollaries 5 and 6 are from axiom 2.
.Corollary 2. Single purpose. Each class must have a single, clearly defined purpose.
When you document, you should be able to easily describe the purpose of a class in a few
sentences.
. Corollary 3. Large number of simple classes. Keeping the classes simple allows
reusability.
.Corollary 4. Strong mapping. There must be a strong association between the physical
system (analysis's object) and logical design (design's object).
The main goal here is to maximize objects cohesiveness among objects and
software components in order to improve coupling because only a minimal amount of
essential information need be passed between components. Coupling is a measure of the
strength of association established by a connection from one object or software
component to another. Coupling is a binary relationship: A is coupled with B. Coupling is
important when evaluating a design because it helps us focus on an important issue in
design. For example, a change to one component of a system should have a minimal
impact on other components. Strong coupling among objects complicates a system, since
the class is harder to understand or highly interrelated with other classes. The degree of
coupling is a function of
1. How complicated the connection is.
2. Whether the connection refers to the object itself or something inside it.
3. What is being sent or received.
The degree, or strength, of coupling between two components is measured by the amount
and complexity of information transmitted between them. Coupling increases (becomes
stronger) with increasing complexity or obscurity of the interface.
Coupling decreases (becomes lower) when the connection is to the component interface
rather than to an internal component. Coupling also is lower for data connections than for
control connections. Object-oriented design has two types of coupling: interaction
coupling and inheritance coupling .
Interaction coupling involves the amount and complexity of messages between
components. It is desirable to have little interaction. Coupling also applies to the
complexity of the message. The general guideline is to keep the messages as simple and
infrequent as possible. In general, if a message connection involves more than three
parameters (e.g., in Method (X, Y, Z), the X, Y, and Z are parameters), examine it to see
if it can be simplified. It has been documented that objects connected to many very
complex messages are tightly coupled, meaning any change to one invariability leads to a
ripple effect of changes in others (see Figure ).
170
coupling in a system, each specialization class should not inherit lots of unrelated and
unneeded methods and attributes. For example, if the subclass is overwriting most of the
171
methods or not using them, this is an indication inheritance coupling is low and the
designer should look for an alternative generalization specialization structure.
Cohesion Coupling deals with interactions between objects or software
components. We also need to consider interactions within a single object or software
.component, called cohesion. Cohesion reflects the "single-purposeness" of an object.
Highly cohesive components can lower coupling because only a minimum of essential
information need be passed between components. Cohesion also helps in designing
classes that have very specific goals and clearly defined purposes.
Method cohesion, like function cohesion, means that a method should carry only one
function. A method that carries multiple functions is undesirable. Class cohesion means
that all the class's methods and attributes must be highly cohesive, meaning to be used by
internal methods or derived classes' methods. Inheritance cohesion is concerned with the
following questions : .How interrelated are the classes? . Does specialization really
portray specialization or is it just something arbitrary? See Corollary 6, which also
addresses these questions.
Each class must have a purpose, as was explained in Chapter 7. Every class
should be clearly defined and necessary in the context of achieving the system's goals.
When you document a class, you should be able to easily explain its purpose in a
sentence or two. If you cannot, then rethink the class and try to subdivide it into more
independent pieces. In summary, keep it simple; to be more precise, each method must
provide only one service. Each method should be of moderate size, no more than a page;
half a page is better.
A great benefit results from having a large number of simpler classes. You cannot
possibly foresee all the future scenarios in which the classes you create will be reused.
The less specialized the classes are, the more likely future problems can be solved by a
recombination of existing classes, adding a minimal number of subclasses. A class that
easily can be understood and reused (or inherited) contributes to the overall system, while
a complex, poorly designed class is just so much dead weight and usually cannot be
reused. Keep the following guideline in mind: The smaller are your classes, the better are
your chances of reusing them in other projects. Large and complexclasses are too
specialized to be reused. Object-oriented design offers a path for producing libraries of
reusable parts . The emphasis object-oriented design places on encapsulation,
modularization, and polymorphism suggests reuse rather than building anew. Cox's
description of a software IC library implies a similarity between object-oriented
development and building hardware from a standard set of chips . The software IC library
is realized with the introduction of design patterns, discussed later in this chapter. Coad
and Yourdon argue that software reusability rarely is practiced effectively. But the
organizations that will survive in the 21st century will be those that have
172
achieved high levels of reusability-anywhere from 70-80 percent or more . Griss argues
that, although reuse is widely desired and often the...benefit of utilizing object
technology, many object-oriented reuse efforts fail because Qf too narrow a focus on
technology and not on the policies set forth by an organization. He recommended an
institutionalized approach to software development, in which software assets
intentionally are created or acquired to be reusable. These assets consistently are used and
maintained to obtain high levels of reuse, thereby optimizing the organization's ability to
produce high-quality software products rapidly and effectively .
Coad and Yourdon describe four reasons why people are not utilizing this concept:
1. Software engineering textbooks teach new practitioners to build systems from "first
principles"; reusability is not promoted or even discussed.
2. The "not invented here" syndrome and the intellectual challenge of solving an
interesting software problem in one's own unique way mitigates against reusing someone
else's software component.
3. Unsuccessful experiences with software reusability in the past have convinced many
practitioners and development managers that the concept is not practical.
4. Most organizations provide no reward for reusability; sometimes productivity is
measured in tenns of new lines of code written plus a discounted credit (e.g., 50 percent
less credit) for reused lines of code.
The primary benefit of software reusability is higher productivity. Roughly speaking, the
software development team that achieves 80 percent reusability is four times as
productive as the team that achieves only 20 percent reusability. Another fonn of
reusability is using a design pattern, which will be explained in the next section.
Object-oriented analysis and object-oriented design are based on the same model.
As the model progresses from analysis to implementation, more detail is added, but it
remains essentially the same. For example, during analysis we might identify a class
Employee. During the design phase, we need to design this classdesign its methods, its
association with other objects, and its view and access classes. A strong mapping links
classes identified during analysis and classes designed during the design phase (e.g., view
and access classes). Martin and Odell describe this important issue very elegantly:
With 00 techniques, the same paradigm is used for analysis, design, and implementation.
The analyst identifies objects' types and inheritance, and thinks about events that change
the state of objects. The designer adds detail to this model perhaps designing screens,
user interaction, and client-server interaction. The thought process flows so naturally
from analyst to design that it may be difficult to tell where analysis ends and design
begins.
Corollary 5. Standardization
To reuse classes, you must have a good understanding of the classes in the
objectoriented programming environment you are using. Most object-oriented systems,
such as Smalltalk, Java, C+ +, or PowerBuilder, come with several built-in class libraries.
Similarly, object-oriented systems are like organic systems, meaning that they grow as
173
you create new applications. The knowledge of existing classes will help you determine
what new classes are needed to accomplish the tasks and where you might inherit useful
behavior rather than reinvent the wheel. However, class libraries are not always well
documented or, worse yet, they are documented but not up to date. Furthermore, class
libraries must be easily searched, based on
users' criteria. For example, users should be able to search the class repository with
commands like "show me all Facet classes." The concept of design patterns might
provide a way to capture the design knowledge, document it, and store it in a repository
that can be shared and reused in different applications.
When you implement a class, you have to determine its ancestor, what attributes it
will have, and what messages it will understand. Then, you have to construct its methods
and protocols. Ideally, you will choose inheritance to minimize the amount of program
instructions. Satisfying these constraints sometimes means that a class inherits from a
superclass that may not be obvious at first glance.
For example, say, you are developing an application for the government that manages the
licensing procedure for a variety of regulated entities. To simplify the example, focus on
just two types of entities: motor vehicles and restaurants. Therefore, identifying classes is
straightforward. All goes well as you begin to model these two portions of class
hierarchy. Assuming that the system has no existing classes similar to a restaurant or a
motor vehicle, you develop two classes, MotorVehicle and Restaurant.
Subclasses of the MotorVehicle class are Private Vehicle and CommercialVehicleo These
are further subdivided into whatever level of specificity seems appropriate (see Figure ).
Subclasses of Restaurant are designed to reflect their own licensing procedures. This is a
simple, easy to understand design, although somewhat limited in the reusability of the
classes. For example, if in another project you must build a system that models a vehicle
assembly plant, the classes from the licensing application are not appropriate, since these
classes have instructions and data that deal with the legal requirements of motor vehicle
license acquisition and renewal.
You know you need to redesign the application-but redesign how? The answer
depends greatly on the inheritance mechanisms supported by the system's target
language. If the language supports single inheritance exclusively, the choices are
somewhat limited. You can choose to define a formal super class to both MotorVehicle
and Restaurant, License, and move common methods and attributes from both classes
into this License class (see Figure). However, the MotorVehicle and Restaurant classes
have little in common, and for the most part, their attributes and methods are
inappropriate for each other. For example, of what use is the gross weight of a diner or
the address of a truck? This necessi-tates a very weak formal class (License) or numerous
blocking behaviors in both MotorVehicle and Restaurant. This particular decision results
in the least reusable classes and potentially extra code in several locations. So, let us try
another approach. Alternatively, you could preserve the original formal classes,
MotorVehicle and Restaurant. Next, define a FoodTruck class to descend from
CommercialVehicle and copy enough behavior into it from the Restaurant class to
support the application's requirements (see Figure ).
You can give FoodTruck copies of data and instructions from the Restaurant class
that allow it to report on food type, health code categories, number of chefs and support
staff, and the like. The class is not very reusable (Coad and Yourdon call it cut-and-paste
reusability), but at least its extra code is localized, allowing simpler debugging and
enhancement. Coad and Yourdon describe cut-and-paste
type of reusability as follows :
This is better than no reuse at all, but is the most primitive form of reuse. The
clerical cost of transcribingthe code has largely disappearedwith today's cut-and-pastetext
editors; nevertheless,the software engineer runs the risk of introducing errors during the
copying (and modifications)of the original code. Worse is the configuration management
problem:it is almost impossiblefor the managerto keep track of the multiple mutated uses
of the original "chunk" of code.
If, on the other hand, the intended language supports multiple inheritance, another
route can be taken, one that more closely models the real-world situation. In this case,
you design a specialized class, FoodTruck, and specify dual ancestry. Our new class
alternative seems to preserve the integrity and code bulk of both ancestors and does
nothing that appears to affect their reusability.
175
In actuality, since we never anticipated this problem in the original design, there
probably are instance variables and methods in both ancestors that share the same names.
Most languages that support multiple inheritance handle these "hits" by giving
precedence to the first ancestor defined. Using this mechanism, reworking will be
required in the Food Truck descendant and, quite possibly, in both ancestors. It easily can
become difficult to determine which method,
ancestors define the same method. It also is more difficult to understand programs written
in a multiple inheritance system.
Often you will find that the latter is true, and if so, you should add an attribute
that incorporates the proposed superclass's behavior rather than an inheritance from the
superclass. This is because inheritors of a class must be intimate with all its
implementation details, and if some implementation is inappropriate, the inheritor's
proper functioning could be compromised. For example, if FoodTruck inherits from both
Restaurant and ConunercialVehicle classes, it might inherit a few inappropriate attributes
and methods. A better approach would be to inherit only from CommercialVehicle and
have an attribute of the type Restaurant (an instance of Restaurant class). In other words,
Restaurant class becomes a-part -of FoodTruck class (see Figure ).
Designing the access layer. .Designing the user interface. .Testing user satisfaction and
usability, based on the usage and use cases. .Iterating and refining the design.
The two design axioms are . Axiom 1. The independence axiom. Maintain the
independence of components. .Axiom 2. The information axiom. Minimize the
information content of the design. The six design corollaries are .Corollary 1. Uncoupled
177
design with less information content. .Corollary 2. Single purpose. .Corollary 3. Large
number of simple classes. .Corollary 4. Strong mapping. .Corollary 5. Standardization.
.Corollary 6. Design with inheritance.
16.7 REFERENCES
1. Norman,Ronald- object oriented system analysis and design – Prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
178
CONTENTS
17.1 INTRODUCTION
Underlying the functionality of any application is the quality of its design. Inthis
chapter, we look at guidelines and approaches to use in designing classes and their
methods. Although the design concepts to be discussed in this chapter are general, we
will concentrate on designing the business classes (see Chapter 6). The access and view
layer classes will be described in the subsequent chapters. However, the same concepts
will apply to designing access and view layer classes.
In designing methods or attributes for classes, you are confronted with two
problems. One is the protocol, or interface to the class operations and its visibility; and
179
the other is how it is implemented. Often the two have very little to do with each other.
For example, you might have a class Bag for collecting various objects that counts
multiple occurrences of its elements. One implementation decision might be that the Bag
class uses another class, say, Dictionary (assuming that we have a class Dictionary), to
actually hold its elements. Bags and dictionaries have very little in common, so this may
seem curious to the outside world. Implementation, by definition, is hidden and off limits
to other objects. The class's protocol, or the messages that a class understands, on the
other hand, can be hidden from other objects (private protocol) or made available to other
objects (public protocol). Public protocols define the functionality and external messages
of an object; private protocols define the implementation of an object (see Figure )
A class also might have a set of methods that it uses only internally, messages to
itself. This, the private protocol (visibility) of the class, includes messages that normally
should not be sent from other objects; it is accessible only to operations of that class. In
private protocol, only the class itself can use the method. The public protocol (visibility)
defines the stated behavior of the class as a citizen in a population and is important
information for users as well as future descendants, so it is accessible to all classes. If the
methods or attributes can be used by the class itself or its subclasses, a protected protocol
can be used. In a protected protocol (visibility), subclasses the can use the method in
addition to the class itself.
For example, public or protected methods that can access private attributes can
reveal an important aspect of your implementation. If anyone uses these functions and
you change their location, the type of attribute, or the protocol of the method, this could
make the client application inoperable. Design the interface between a superclass and its
subclasses just as carefully as the class's interface to clients; this is the contract between
the super- and subclasses. If this interface is not designed properly, it can lead to
violating the encapsulation of the superclass. The protected portion of the class interface
can be accessed only by subclasses. This feature is helpful but cannot express the totality
of the relationship between. a class and its subclasses.
180
Other important factors include which functions might or might not be overridden
and how they must behave. It also is crucial to consider the relationship among methods.
Some methods might need to be overridden in groups to preserve the class's semantics.
The bottom line is this: Design your interface to subclasses so that a subclass that uses
every supported aspect of that interface does not compromise the integrity of the public
interface. The following paragraphs summarize the differences between these layers.
Items in these layers define the implementation of the object. Apply the design
axioms and corollaries, especially Corollary 1 (uncoupled design with less information
content, see Chapter 9) to decide what should be private: what attributes (instance
variables)? What methods? Remember, highly cohesive objects can improve coupling
because only a minimal amount of essential information need be passed between objects.
Items in this layer define the functionality of the object. Here are some things to
keep in mind when designing class protocols: Good design allows for polymorphism.
Not all protocol should be public; again apply design axioms and corollaries 1.
Thefollowing key questions must be answered:
What are the class interfaces and protocols?
What public (external) protocol will be used or what external messages must the system
understand? .What private or protected (internal) protocol will be used or what internal
messages or messages from a subclass must the system understand?
The multiplicity or multivalue attribute is the opposite of the single-value attribute since,
as its name implies, it can have a collection of many values at any point in time . For
example, if we want to keep track of the names of people who have called a customer
support line for help, we must use the multivalues attributes. Instance connection
attributes are required to provide the mapping needed by an object to fulfill its
responsibilities, in other words, instance connection model association. For example, a
person might have one or more bank accounts. A person has zero to many instance
connections to Account{s). Similarly, an Account can be assigned to one or more persbns
(i.e., joint account). Therefore, an Account also has zero to many instance connections to
Person{s).
As discussed in Chapter 5, OCL can be used during the design phase to define the class
attributes. The following is the attribute presentation suggested by UML
: visibility name: type-expression =initial- value
Where visibility is one of the following:
+ public visibility (accessibility to all classes).
# protected visibility (accessibility to subclasses and operations of the class).
- private visibility (accessibility only to operations of the class).
Type-expression is a language-dependent specification of the implementation type of an
attribute.
Initial-value is a language-dependent expression for the initial value of a newly created
object. The initial value is optional. For example, + size: length = 100
The UML style guidelines recommend beginning attribute names with a lowercase letter.
In the absence of a multiplicity indicator (array), an attribute holds exactly one value.
Multiplicity may be indicated by placing a multiplicity indicator in brackets after attribute
name; for example,
names[lO]: String
points[2.. *]: Point
The multiplicity of 0..1 provides the possibility of null values: the absence of a value, as
opposed to a particular value from the range. For example, the following declaration
permits a dij;tinction between the null value and an empty string:
name[O..lj: String
In this section, we go through the ViaNet bank ATM system classes and refine the
attributes identified during object-oriented analysis.
pinNumber
cardNumber
At this stage, we need to add more information to these attributes, such as
visibility and implementation type. Furthermore, additional attributes can be identified
during this phase to enable implementation of the class:
#firstName: String
#lastName: String
#pinNumber: String
#cardNumber: String
#account: Account (instance connection)
In Chapters we identified an association between the BankClient and the Account classes
(see Figure ). To design this association, we need to add an account attribute of type
Account, since the BankClient needs to know about his or her account and this attribute
can provide such information for the BankClient class. This is an example of instance
connection, where it represents the association between the BankClient and the Account
objects. All the attributes have been given protected visibility.
Problem
Why do we not need the account attribute for the Transaction class? Hint: Do
transaction objects need to know about account objects?
Add the savings attribute to the class. The purpose of this attribute is to implement the
association between the CheckingAccount and SavingsAccount classes.
Add the checking attribute to the class. The purpose of this attribute is to implement the
association between the SavingsAccount and CheckingAccount classes. Figure 10-2 (see
Chapter 8) shows a more complete UML class diagram for the bank system. At this stage,
we also need to add a very short description of each attribute or certain attribute
constraints. For example,
Class ATMMachine
#address: String (The address for this ATM machine.)
#state: String (The state of operation for this ATM machine, such as running,
off, idle, out of money, security alarm.)
A more complete UML class diagram for the ViaNet bank system.
During the analysis phase, the name of the attribute should be sufficient.
However, during the design phase, detailed information must be added to the model
(especially, definitions of the class attributes and operations). The UML provides a
language to do just that. The rules and semantics of the UML can be expressed in
English, in a form known as object constraint language (OCL). OCL is a specification
language that uses simple logic for specifying the properties of a system.
17.9 REFERENCES
1. Norman,Ronald- object oriented system analysis and design –printice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
185
CONTENTS
18.1 INTRODUCTION
The main goal of this activity is to specify the algorithm for methods identified so
far. Once you have designed your methods in some formal structure such as UML
activity diagrams with an OCL description, they can be converted to programming
language manually or in automated fashion
.Conversion method. The method that converts a value from one unit of measure to
another.
.Copy method. The method that copies the contents of one instance to another instance. .
.Attribute set. The method that sets the values of one or more attributes.
.Attribute get. The method that returns the values of one or more attributes.
.I/O methods. The methods that provide or receive data to or from a device.
.Domain specific. The method specific to the application.
Corollary 1, that in designing methods and protocols you must minimize the complexity
of message connections and keep as low as possible the number of messages sent and
received by an object. Your goal should be to maximize cohesiveness among objects and
software components to improve coupling, because only a minimal amount of essential
information should be passed between components. Abstraction leads to simplicity and
straightforwardness and, at the same time, Increases class versatility. The requirement of
simplification, while retaining functionality, seems to lead to increased utility. Here are
five rules :
1. If it looks messy, then it's probably a bad design.
2. If it is too complex, then it's probably a bad design.
3. If it is too big, then it's probably a bad design.
4. If people don't like it, then it's probably a bad design.
5. If it doesn't work, then it's probably a bad design.
Take the time to think in this way-good news, this gets easier over time. Lost
object focus is another problem with class definitions. A meaningful class definition
starts out simple and clean but, as time goes on and changes are made, becomes larger
and larger, with the class identity becoming harder to state concisely (Corollary 2). This
happens when you keep making incremental changes to an existing class. If the class
does not quite handle a situation, someone adds a tweak to its description. When the next
problem comes up, another tweak is added. Or, when a new feature is requested, another
tweak is added, and so on.
Apply the design axioms and corollaries, such as Corollary 2 (which states that
each class must have a single, clearly defined purpose). When you document, you easily
187
should be able to describe the purpose of a class in a few sentences. These problems can
be detected early on. Here are some of the warning signs that something is going amiss.
There are bugs because the internal state of an object is too hard to track and solutions
consist of adding patches. Patches are characterized by code that looks like this: "If this is
the case, then force that to be true" or "Do this just in case we need to" or "Do this before
calling that function, because it expects this."
Some possible actions to solve this problem are these: .Keep a careful eye on the
class design and make sure that an object's role remains well defined. If an object loses
focus, you need to modify the design. Apply Corollary 2 (single purpose).
An activity diagram for the BankClient class verifyPassword method, using OCl to
describe the diagram. The syntax for describing a class's method is Class
name::methodName. We postpone design of the retrieveClient to Chapter 11, Section
11.10, Designing Access layer Classes.
The following describes the verifyPassword service in greater detail. A client PIN
code is sent from the ATMMachine object and used as an argument in the verify-
Password method. The verify Password method retrieves the client record and checks the
entered PIN number against the client's PIN number. If they match, it allows the user to
proceed. Otherwise, a message sent to the ATMMachine displays "Incorrect PIN, please
try again" (see Figure ).
The verifyPassword methods' performs first creates a bank client object and
attempts to retrieve the client data based on the supplied card and PIN numbers. At this
stage, we realize that we need to have another method, retrieveClient. The retrieveClient
method takes two arguments, the card number and a PIN number, and returns the client
object or "nil" if the password is not valid. We postpone design of the retrieveClient
method to Chapter 11 (Section 11.10, designing the access layer classes).
The following operation presentation has been suggested by the UML. The operation
syntax is this:
visibility name: (parameter-list): retum-type-expression
Where visibility is one of:
public visibility (accessibility to all classes).
protected visibility (accessibility to subclasses and operations of the class).
private visibility (accessibility only to operations of the class).
Here, name is the name of the operation.
Parameter-list: is a list of parameters, separated by commas, each specified by
name: type-expression = default value (where name is the name of the parameter, type-
expression is the language-dependent specification of an implementation type, and
default-value is an optional value).
Retum-type-expression: is a language-dependent specification of the implementation of
the value returned by the method. If return-type is omitted, the operation does not return a
value; for example,
+
#
+getNameO: aName
+getAccountNumber (account: type): account Number
The UML guidelines recommend beginning operation names with a lowercase letter.
At this point, the design of the bank business model is conceptually complete.
You have identified the objects that make up your business layer, as well as what services
they provide. All that remains is to design methods, the user interface, database access,
and implement the methods using any object-oriented programming language. To keep
the book language independent, we represent the methods' algorithms with UML activity
diagrams, which very easily can be translated into any language. this phase prepares the
189
system for the implementation. The actual coding and implementation (although they are
beyond the scope of this book) should be relatively easy and, for the most part, can be
automated by using CASE tools. This is because we know what we want to code. It is
always difficult to code when we have no clear understanding of what we want to do.
An activity diagram for the BankClient class verifyPassword method, using OCL to
describe the diagram. The syntax for describing a class's method is Class
name::methodName. We postpone design of the retrieveClient to Chapter 11, Section
11.10, Designing Access Layer Classes.
The following describes the verifyPassword service in greater detail. A client PIN
code is sent from the ATMMachine object and used as an argument in the verify-
Password method. The verify Password method retrieves the client record and checks the
entered PIN number against the client's PIN number. If they match, it allows the user to
proceed. Otherwise, a message sent to the ATMMachine displays "Incorrect PIN, please
try again" (see Figure ).
The verifyPassword methods' performs first creates a bank client object and
attempts to retrieve the client data based on the supplied card and PIN numbers. At this
stage, we realize that we need to have another method, retrieveClient. The retrieveClient
method takes two arguments, the card number and a PIN number, and returns the client
object or "nil" if the password is not valid. We postpone design of the retrieveClient
method to Chapter 11 (Section 11.10, designing the access layer classes).
The following describes the deposit service in greater detail. An amount to be deposited
is sent to an account object and used as an argument to the deposit service. The account
adjusts its balance to its current balance plus the deposit amount. The account object
records the deposit by creating a transaction object
190
containing the date and time, posted balance, and transaction type and amount (see
Figure).
Once again we have discovered another method, updateClient. This method, as the name
suggests, updates client data. We postpone design of the updateClient method to the
Chapter 11 (designing the access layer classes).
This is the generic withdrawal method that simply withdraws funds if they are
available. It is designed to be inherited by the CheckingAccount and SavingsAccount
classes to implement automatic funds transfer. The following describes the withdraw
method. An amount to be withdrawn is sent to an account object and used as the
argument to the withdraw service. The account checks its balance for sufficient funds. If
enough funds are available, the account makes the withdrawal and updates its balance;
otherwise, it returns an error, saying "insufficient funds." If successful, the account
records the withdrawal by creating a transaction object containing date and time, posted
balance, and transaction type and amount (see Figure).
perfonned against an account, the account object creates a transaction object to record it.
Arguments into this service include transaction type (withdrawal or deposit), the
transaction amount, and the balance after the transaction. The account creates a new
transaction object and sets its attributes to the desired infonnation. Add this description to
the create Transaction 's description field (see Figure ).
funds, the excess is withdrawn from there, and the checking account balance goes to zero
(0). If successful, the account records the
withdrawal by creating a transaction object containing the date and time, posted balance,
and transaction type and amount (see Figure ).
A package groups and manages the modeling elements, such as classes, their
associations, and their structures. Packages themselves may be nested within other
packages. A package may contain both other packages and ordinary model
For example, the bank system can be viewed as a package that contains other
packages, such as Account package, Client package, and so on. Classes can be packaged
based on the services they provide or grouped into the business classes, access classes,
and view classes (see Figure ). Furthermore, since packages
own model elements and model fragments, they can be used by CASE tools as the basic
storage and access control.
193
More complete UML class diagram for the ViaNet bank ATM system. Note that the
method parameter list is not shown.
The UML package is a grouping of model elements. It can organize the modeling
elements including classes. Packages themselves may be nested within other packages. A
package may contain both other packages and ordinary model elements. The entire
system description can be thought of as a single, high-level subsystem package with
everything else in it.
194
18.15 REFERENCES
1. Norman,Ronald- object oriented system analysis and design – Prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
195
CONTENTS
To understand
object store and persistence
database management system
19.1 INTRODUCTION
A program will create a large amount of data throughout its execution. Each item
of data will have a different lifetime. Atkinson et al. describe six broad categories for the
lifetime of data:
1. Transient results to the evaluation of expressions.
2. Variables involved in procedure activation (parameters and variables with a localized
scope).
3. Global variables and variables that are dynamically allocated.
196
The first three categories are transient data, data that cease to exist beyond the
lifetime of the creating process. The other three are nontransient, or persistent, data.
The same issues also apply to objects; after all, objects have a lifetime, too. They
are created explicitly and can exist for a period of time (during the application session).
However, an object can persist beyond application session boundaries, during which the
object is stored in a file or a database. A file or a database can provide a longer life for
objects-longer than the duration of the process in which they were created. From a
language perspective, this characteristic is called persistence. Essential elements in
providing a persistent store are :
Identification of persistent objects or reachability (object ID).
Properties of objects and their interconnections. The store must be able to coherently
manage nonpointer and pointer data (i.e., interobject references).
Scale of the object store. The object store should provide a conceptually infinite store.
Stability. The system should be able to recover from unexpected failures and return the
system to a recent self-consistent state. This is similar to the reliability requirements of a
DBMS, object-oriented or not.
Having separate methods of manipulating the data presents many problems.
Atkinson et al. [I] claim that typical programs devote significant amounts of code to
transferring data to and from the file system or DBMS. Additionally, the use of these
external storage mechanisms leads to a variety of technical issues, wJ1ichwill be
examined in the following sections. '
Databases usually are large bodies of data seen as critical resources to a company.
As mentioned earlier, a DBMS is a set of programs that enable the creation and
maintenance of a collection of related data. DBMSs have a number of properties that
distinguish them from the file-based data management approach. In traditional file
processing, each application defines and implements the files it requires. Using a
database approach, a single repository of data is maintained, which can be defined once
and subsequently accessed by various users (see Figure ).
DatabaseViews
The DBMS provides the database users with a conceptual representation that is
independent of the low-level details (physical view) of how the data are stored. The
database can provide an abstract data model that uses logical concepts such as field,
records, and tables and their interrelationships. Such a model is understood more easily
by the user than the low-level storage concepts.
This abstract data model also can facilitate multiple views of the same underlying
data. Many applications will use the same shared information but each will be interested
in only a subset of the data. The DBMS can provide multiple virtual views of the data
that are tailored to individual applications. This allows the convenience of a private data
representation with the advantage of globally managed information.
Database Models
conceptual model focuses on the logical nature of that data presentation. Therefore, the
conceptual model is concerned with what is represented in the database and the
implementation model is concerned with how it is represented .
Hierarchical Model The hierarchical model represents data as a singlerooted tree. Each
node in the tree represents a data object and the connections represent a parent-child
relationship. For example, a node might be a record containing information about Motor
vehicle and its child nodes could contain a record about Bus parts (see Figure ).
Interestingly enough, a hierarchical model resembles super-sub relationship of objects.
A hierarchical model. The top layer, the root, is perceived as the parent of the segment
directly below it. In this case motor vehicle is the parent of Bus, Truck, and Car. A
segment also is called a node. The segments below another node are the children of the
node above them. Bus, Truck,and Car are the children of MotorVehicle.
Network model. An Order contains data from both Customer and Soup.
Network Model A network database model is similar to a hierarchical database, with one
distinction. Unlike the hierarchical model, a network model's record can have more than
one parent. For example, in Figure , an Order contains data from the Soup and Customer
nodes.
Relational Model Of all the database models, the relational model has the simplest, most
uniform structure and is the most commercially widespread. The primary concept in this
database model is the relation, which can be thought of as a table. The columns of each
table are attributes that define the data or value domain for entries in that column. The
rows of each table are tuples representing individual data objects being stored. A
199
relational table should have only one primary key. A primary key is a combination of one
or more attributes whose value unambiguously locates each row in the table. In Figure ,
Soup-ID, Cust-ill, and Order-ill are primary keys in Soup, Customer, and Order tables. A
foreign key is a primary key of one table that is embedded in another table to link the
tables. In Figure , Soup-ill and Cust-ill are foreign keys in the Order table.
Database Interface
Data Manipulation Language and Query Capabilities Any time data are collected
on virtually any topic, someone will want to ask questions about it. Someone will want
the answers to simple questions like "How many of them are there?" or more intricate
questions like "What is the percentage of people between
ages 21 and 45 who have been employed for five years and like playing tennis?" Asking
questions-more formally, making queries of the data-is a typical and common use of a
database. A query usually is expressed through a query language.
The structured query language (SQL) is the standard DML for relational DBMSs. SQL
is widely used for its query capabilities. The query usually specifies
.The domain of the discourse over which to ask the query.
.The elements of general interest.
.The conditions or constraints that apply.
.The ordering, sorting, or grouping of elements and the constraints that,apply to the
ordering or grouping. "'-.
Query processes generally have sophisticated "engines" that determine the best way to
approach the database and execute the query over it. They may use information in the
database or knowledge of the whereabouts of particular data in the network to optimize
the retrieval of a query. Traditionally, DML are either procedural or nonprocedural. A
procedural DML requires users to specify what data are desired and how to get the data.
A nonprocedural DML, like most databases' fourth generation programming language
(4GLs), requires users to specify what data are needed but not how to get the data.
Object-oriented query and data manipulation languages, such as Object SQL, provide
object management capabilities to the data manipulation language. In a relational DBMS,
the DML is independent of the host programming language.
A host language such as C or COBOL would be used to write the body of the
application. Typically, SQL statements then are embedded in C or COBOL applications
to manipulate data. Once SQL is used to request and retrieve database data, the results of
201
the SQL retrieval must be transformed into the data structures of the programming
language. A disadvantage of this approach is that programmers code in two languages,
SQL and the host language. Another is that the structural transformation is required in
both database access directions, to and from the database.
For example, to check the table content, the SELECTcommand is used, followed by the
desired attributes. Or, if you want to see all the attributes listed, use the (*) to indicate all
the attributes: SELECT DESCRIPTION, PRICE FROMINVENTORY; where inventory
is the name of a table.
Data and objects in the database often need to be accessed and shared by different
applications. With multiple applications having access to the object concurrently, it is
likely that conflicts over object access will arise. The database then must detect and
mediate these conflicts and promote the greatest amount of sharing possible without
sacrificing the integrity of data. This mediation process is managed through concurrency
control policies, implemented, in part, by transactions. A transaction is a unit of change
in which many individual modifications are aggregated into a single modification that
occurs in its entirety or not at all. Thus, either all changes to objects within a given
transaction are applied to the database or none of the changes. A transaction is said to
commit if all changes can be made successfully to the database and to abort if canceled
because all changes to the database cannot be made successfully. This ability of
transactions ensures atomicity of change that maintain the database in a consistent state.
Many transaction systems are designed primarily for short transactions (lasting on
the order of seconds or minutes). They are less suitable for long transactions, lasting
hours or longer. Object databases typically are designed to support both short and long
transactions. A concurrence control policy dictates what happens when conflicts arise
betw een transactions that attempt access to the same object and how these conflicts are
to be resolved.
Concurrency Policy
As you might expect, when several users (or applications) attempt to read and
write the same object simultaneously, they create a contention for object. The
202
A basic goal of the transaction is to provide each user with a consistent view of
the database. This means that transactions must occur in serial order. In other words, a
given user must see the database as it exists either before a given transaction occurs or
after that transaction.
The most conservative way to enforce serialization is to allow a user to lock all
objects or records when they are accessed and to release the locks only after a transaction
commits. This approach, traditionally known as a conservative or pessimistic policy,
provides exclusive access to the object, despite what is done to it. The policy is very
conservative because no other user can view the data until the object is released.
Database management systems have progressed from indexed files to network and
hierarchical database systems to relational systems. The requirements of traditional
business data processing applications are well met in functionality and performance by
relational database systems focused on the needs of business data processing applications.
However, as many researchers observed, they are inadequate for a broader class of
applications with unconventional and complex data type requirements. These
requirements along with the popularity of object-oriented programming have resulted in
great demand for an object-oriented DBMS (OODBMS).
Therefore, the interest in OODBMS initially stemmed from the data storage requirements
of design support applications (e.g., CAD, CASE, office information systems).
The object-oriented database management system is a marriage of objectoriented
programming and database technology (see Figure ) to provide what we now call object-
203
4. The system must support types or classes. The system must support either the type
concept (embodied by C++ ) or the class concept (embodied by Smalltalk).
5. The system must support inheritance. Classes and types can participate in a class
hierarchy. The primary advantage of inheritance is that it factors out shared code and
interfaces.
6. The system must avoid premature binding. This feature also is known as late binding
or dynamic binding (see Chapter 2, which shows that the same method name can be used
in different classes). Since classes and types support encapsulation and inheritance, the
system must resolve conflicts in operation names at run time.
7. The system must be computationally complete. Any computable function should be
expressible in the data manipulation language (DML) of the system, thereby allowing
expression of any type of operation.
8. The system must be extensible. The user of the system should be able to create new
types that have equal status to the system's predefined types. These requirements are met
by most modem object-oriented programming languages such as Smalltalk and C+ +.
Also, clearly, these requirements are not met
directly (more on this in the next section) by traditional relational, hierarchical, or
network database systems. Second, these rules make it a DBMS:
9. It must be persistent, able to remember an object state. The system must allow the
programmer to have data survive beyond the execution of the creating process for it to be
reused in another process.
10. It must be able to manage very large databases. The system must efficiently manage
access to the secondary storage and provide performance features, such as indexing,
clustering, buffering, and query optimization.
11. It must accept concurrent users. The system must allow multiple concurrent users and
support the notions of atomic, serializable transactions.
12. It must be able to recover from hardware and software failures. The system must be
able to recover from software and hardware failures and return to a coherent state.
13. Data query must be simple. The system must provide some high-level mechanism for
ad-hoc browsing of the contents of the database. A graphical browser might fulfill this
requirement sufficiently. These database requirements are met by the majority of existing
database systems. From these two sets of definitions it can be argued that an OODBMS is
a DBMS with an underlying object-oriented model.
approach of traditional databases). The object identity is independent of the state of the
object. For example, if one has a car object and we remodel the car and change its
appearance, the engine, the transmission, and the tires so that it looks entirely different, it
would still be recognized as the same object we had originally. Within an object-oriented
database, one always can ask whether this is the same object I had previously, assuming
one remembers the object's identity. Object identity allows objects to be related as well as
shared within a distributed computing network.
1. Justify OODBMS
2. Validate database views
3. Validate Hierarchical models
4. Evaluate network model
5. Validate relational model
206
19.9 REFERENCES
1. Norman,Ronald- object oriented system analysis and design – Prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
207
CONTENTS
20.1 INTRODUCTION
For a tool to be able to define how relational data maps to and from application
objects, it must have at least the following mapping capabilities (note all these are two-
way mappings, meaning they map from the relational system to the object and from the
object back to the relational system):
.Table-class mapping.
Table-multiple classes mapping.
Table-inherited classes mapping.
Tables-inherited classes mapping.
Furthermore, in addition to mapping column values, the tool must be capable of
interpretation of relational foreign keys. The tool must describe both how the foreign key
can be used to navigate among classes and instances in the mapped object model and how
referential integrity is maintained. Referential integrity means making sure that a
dependent table's foreign key contains a value that refers to an existing valid tuple in
another relation.
In such mapping, it is common to map all the columns to properties. However, this is not
required, and it may be more efficient to map only those columns for which an object
model is required by the application(s). With the table-class
209
Table-multiple classes mapping. The custiD column provides the discriminant. If the
value for custlD is null, an Employee instance is created at run time; otherwise, a
Customer instance is created. In this approach, each row in the table represents an object
instance and each column in the table corresponds to an object attribute. This one-to-one
mapping of the table-class approach provides a literal translation between a relational
data representation and an application object. It is appealing in its simplicity but offers
little flexibility.
In table-inherited classes mapping, a single table maps to many classes that have
a common superclass. This mapping allows the user to specify the columns to be shared
among the related classes. The superclass may be either abstract or instantiated. In Figure
, instances of salariedEmployee can be created for any row in the Person table that has a
non null value for the Salary column. If Salary is null, the row is represented by an hourly
Employee instance.
.Another approach here is tables-inherited classes mapping, which allows the translation
of is-a relationships that exist among tables in the relational schema into class inheritance
relationships in the object model. In a relational database, an is-a relationship often is
210
modeled by a primary key that acts as a foreign key to another table. In the object model,
is-a is another term for an inheritance relation-
ship. By using the inheritance relationship in the object model, the mapping can express a
richer and clearer definition of the relationships than is possible in the relational schema.
Figure shows an example that maps a Person table to class Person and then maps a
related Employee table to class Employee, which is a subclass of class Person. In this
example, instances of Person are mapped directly from the Person table. However,
instances of Employee can be created only for the rows in the Employee table (the
joining of the Employee and Person tables on the SSN key).
Furthermore, SSN is used both as a primary key on the Person table for activating
instances of Person and as a foreign key on the Person table and a primary key on the
Employee table for activating instances of type Employee.
Instances of Person are mapped directly from the Person table. However,
instances of Employee can be created only for the rows in the Employee table (the
joining of the Employee and Person tables on the ssn key).The ssn is used both as a
primary key on the Person table and.as a foreign key on the Person table and a primary
key on the Employee table for activating instances of type Employee.
In Figure , the departmentID property of Employee uses the foreign key in column
Employee.departmentiD. Each Employee instance has a direct reference of class
Department (association) to the department object to which it belongs. A popular
mechanism in relational databases is the use of stored procedures. As mentioned earlier,
stored procedures are modules of precompiled SQL code stored in the database that
execute on the server to enforce rules the business has set about the data. Mapping should
support the use of stored procedures by allowing mapping of existing stored procedures
to object methods.
only exposed objects of an application with which users can interact.After all, view layer
classes or interface objects are objects that represent the set of operations in the business
that users must perform to complete their tasks, ideally in a way they find natural, easy to
remember, and useful. Any objectsthat have direct contact with the outside world are
visible in interface objects,whereas business or access objects are more independent of
their environment. As explained in Chapter 4, the view layer objects are responsible for
two majoraspects of the applications:
1. Input-responding to user interaction. The user interface must be designed totranslate
an action by the user, such as clicking on a button or selecting from amenu, into an
appropriate response. That response may be to open or closeanother interface or to send a
message down into the business layer to startsome business process. Remember, the
business logic does not exist here, just the knowledge of which message to send to which
business object.
2. Output-displaying or printing business objects. This layer must paint the best picture
possible of the business objects for the user. In one interface, this may mean entry fields
and list boxes to display an order and its items. In another, it may be a graph of the total
price of a customer's orders.
The process of designing view layer classes is divided into four major activities:
The macro level VI design process-identifying view layer objects. This activity, for the
most part, takes place during the analysis phase of system development. The main
objective of the macro process is to identify classes tha U nteract with human actors by
analyzing the use cases developed in the 'analysis phase. As described in previous
chapters, each use case involves actors and the task they want the system to do. These use
cases should capture a complete, unambiguous, and consistent picture of the interface
requirements of the system.
After all, use cases concentrate on describing what the system does rather than how it
does it by separating the behavior of a system from the way it is implemented, which
requires viewing the system from the user's perspective rather than that of the machine.
However, in this phase, we also need to address the issue of how the interface must be
implemented. Sequence or collaboration diagrams can help by allowing us to zoom in on
the actor-system interaction and extrapolate interface classes that interact with human
actors; thus, assisting us in identifying and gathering the requirements for the view layer
objects and designing them.
agree that usability evaluation should be part of the development process rather than a
post-mortem or forensic activity. Despite the importance of usability and user
satisfaction, many system developers still fail to pay adequate attention to usability,
focusing primarily on functionality" . In too many cases, usability still is not given
adequate consideration.
The interface object handles all communication with the actor but processes no
business rules or object storage activities. In essence, the interface object will
Effective interface design is more than just following a set of rules. It also involves early
planning of the interface and continued work through the software development process.
The process of designing the user interface involves cJanfying the specific needs of the
application, identifying the use cases and interface object and then devising a design that
best meets users' needs. The remainder of this chapter describes the micro-level VI
design process and the issues involved.
20.8 REFERENCES
UNIT – V:
CONTENTS
21.1 INTRODUCTION.
To develop and deliver robust systems, we need a high level of confidence that
Each component will behave correctly. . Collective behavior is correct. .No incorrect
collective behavior will be produced. Not only do we need to test components or the
individual objects, we also must examine collective behaviors to ensure maximum
operational reliability. Verifying components in isolation is necessary but not sufficient to
meet this end.
In the early history of computers, live bugs could be a problem (see Bugs and
Debugging). Moths and other forms of natural insect life no longer trouble digital
computers. However, bugs and the need to debug programs remain. In a 1966 article in
Scientific American, computer scientist Christopher Strachey wrote,
Although programming techniques have improved immensely since the early years, the
process of finding and correcting errors in prograrnming-"debugging" still remains a
most difficult, confused and unsatisfactory operation. The chief impact of this state of
affairs is psychological. Although we are happy to pay lip service to the adage that to
216
err is human, most of us like to make a small private reservation about our own
Although three decades have elapsed since these lines were written, they still
capture the essence and mystique of debugging. Precisely speaking, the elimination of
the syntactical bug is the process of debugging, whereas the detection and elimination of
the logical bug is the process of testing. Gruenberger writes, The logical bugs can be
extremely subtle and may need a great deal of effort to eliminate them. It is commonly
accepted that all large software systems(operating or application) have bugs remaining in
them. The number of possible paths through a large computer program is enormous, and
it is physically impossible to explore all of them. The single path containing a bug may
not be followed in actual production runs for a long time (if ever) after the program has
been certified as correct by its author or others.
In this previous chapter, we look at the testing strategies, the impact of an object
orientation on software quality, and some guidelines for developing comprehensive test
cases and plans that can detect and identify potential problems before delivering the
software to its users. After all, defects can affect how well the software satisfies the users'
requirements. Previous chapter addresses usability and user satisfaction tests.
One reason why quality assurance is needed is because computers are infamous
for doing what you tell them to do, not necessarily what you want them to do. To close
this gap, the code must be free of errors or bugs that cause unexpected results, a process
called debugging..
Scenario-based testing, also called usage-based testing, concentrates on what the user
does, not what the product does. This means capturing use cases and the tasks users
perform, then performing them and their variants as tests. These scenarios also can
identify interaction bugs. They often are more complex and realistic than error-based
tests. Scenario-based tests tend to exercise multiple subsystems in a single test, because
217
that is what users do. The tests will not find everything, but they will cover at least the
higher visibility system interaction bugs .
The extent of testing a system is controlled by many factors, such as the risks
involved, limitations on resources, and deadlines. In light of these issues, we must deploy
a testing strategy that does the "best" job of finding defects in a product within the given
constraints. There are many testing strategies, but most testing uses a combination of
these: black box testing, white box testing, top-down testing, and bottom-up testing.
However, no strategy or combination of strategies truly can prove the correctness of a
system; it can establish only its "acceptability."
The concept of the black box is used to represent a system whose inside workings
are not available for inspection . In a black box, the test item is treated as "black," since
its logic is unknown; all that is known is what goes in and what comes out, or the input
and output (see Figure 13-1). Weinberg describes writing a user manual as an example of
a black box approach to requirements. The user manual does not show the internal logic,
because the users of the system do not care about what is inside the system.
In black box testing, you try various inputs and examine the resulting output; you can
learn what the box does but nothing about how this conversion is implemented . Black
box testing works very nicely in testing objects in an object-oriented environment. The
black box testing technique also can be used for scenario-based tests, where the system's
inside may not be available for inspection but the input and output are defined through
use cases or other analysis information.
White box testing assumes that the specific logic is important and must be tested
to guarantee the system's proper functioning. The main use of the white box is in error-
based testing, when you already have tested all objects of an application and all external
or public methods of an object that you believe to be of greater importance (see Figure ).
218
In white box testing, you are looking for bugs that have a low probability of execution,
have been carelessly implemented, or were overlooked previously .
One form of white box testing, called path testing, makes certain that each path in
a object's method is executed at least once during testing. Two types of path testing are
statement testing coverage and branch testing coverage : .Statement testing coverage. The
main idea of statement testing coverage is to test every statement in the object's method
by executing it at least once. Murray states, "Testing less than this for new software is
unconscionable and should be criminalized" [quoted in 2]. However, realistically, it is
impossible to test a program on every single input, so you never can be sure that a
program will not fail on some input. .Branch testing coverage. The main idea behind
branch testing coverage is to perform enough tests to ensure that every branch alternative
has been executed at least once under some test . As in statement testing coverage, it is
unfeasible to fully test any program of considerable size.
Most debugging tools are excellent in statement and branch testing coverage. White box
testing is useful for error-based testing.
Top-Down Testing
Top-down testing assumes that the main logic or object interactions and systems
messages of the application need more testing than an individual object's methods or
supporting logic. A top-down strategy can detect the serious design flaws early in the
implementation.
In theory, top-down testing should find critical design errors early in the testing
process and significantly improve the quality of the delivered software because of the
iterative nature of the test . A top-down strategy supports testing the user interface and
event-driven systems. Testing the user interface using a top-down approach means testing
interface navigation. This serves two purposes, according to Conger. First, the top-down
approach can test the navigation through screens and verify that it matches the
requirements. Second, users can see, at an early stage, how the final application will look
and feel . This approach also is useful for scenario-based testing. Topdown testing is
useful to test subsystem and system integration.
219
Bottom-Up Testing
Bottom-up testing starts with the details of the system and proceeds to higher
levels by a progressive aggregation of details until they collectively fit the requirements
for the system. This approach is more appropriate for testing the individual objects in a
system. Here, you test each object, then combine them and test their interaction and the
messages passed among objects by utilizing the top-down approach.
In bottom-up testing, you start with the methods and classes that call or rely on no
others. You test them thoroughly. Then you progress to the next level up: those methods
and classes that use only the bottom level ones already tested. Next, you test
combinations of the bottom two layers. Proceed until you are testing the entire program.
This strategy makes sense because you are checking the behavior of a piece of
codebefore it is used by another.Bottom-up testing leads to integration testing, which
leads to systems testing.
Testing may be conducted for different reasons. Quality assurance testing looks
for potential problems in a proposed design. In this chapter, we looked at guidelines and
the basic concept of test plans and saw that, for the most part, use cases can be used to
describe the usage test cases. Also, some of the techniques, strategies, and approaches for
quality assurance testing and the impact of object orientation on testing are discussed.
21.8 REFERENCES
1. Norman,Ronald- object oriented system analysis and design – Prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
220
CONTENTS
To study about
Testing impacts and
Resuability tests.
22.1 INTRODUCTION
For example, when you invoke a method, it may be hard to tell exactly which
method gets executed. The method may belong to one of many classes. It can be hard to
tell the exact class of the method. When the code accesses it, it may get an unexpected
value. In a non-object-oriented system, when you looked at
x = computePayrollO;
221
Suppose you have this situation : The base class contains methods inheritedO and
redefinedO and the derived class redefines the redefinedO method.
If the base::inherited has been changed, the derived::inheritedO may not have to
be completely tested. Whether it does depends on the base methods; otherwise, it must be
tested again. The point here is that, if you do not follow the OOD guidelines, especially if
you don't test incrementally, you will end up with objects that are extremely hard to
debug and maintain.
Marick argues that the simpler is a test, the more likely it is to be reusable in
subclasses. But simple tests tend to find only the faults you specifically target; complex
tests are better at both finding those faults and stumbling across others by sheer luck.
There is a trade-off here, one of many between simple and complex tests. The models
developed for analysis and design should be used for testing as well. For example, the
class diagram describes relationships between objects; that is, an object of one class may
use or contain an object of another class, which is useful information for testing.
222
Furthermore, the use-case diagram and the highest level class diagrams can benefit the
scenario-based testing. Since a class diagram shows the inheritance structure, which is
important information for error-based testing, it can be used not only during analysis but
also during testing.
To have a comprehensive testing scheme, the test must cover all methods or a
good majority of them. All the services of your system must be checked by at least one
test. To test a system, you must construct some test input cases, then describe how the
output will look. Next, perform the tests and compare the outcome with the expected
output. The good news is that the use cases developed during analysis can be used to
describe the usage test cases. After all, tests always should be designed from
specifications and not by looking at the product! Myers describes the objective of testing
as follows. Testing is the process of executing a program with the intent of finding errors.
A good test case is the one that has a high probability of detecting an as-yet
undiscovered error. A successful test case is the one that detects an as-yet undiscovered
error.
Basically, a test case is a set of what-if questions. Freedman and Thomas have
developed guidelines that have been adapted for the UA: .Describe which feature or
service (external or internal) your test attempts to cover. .If the test case is based on a use
case (i.e., this is a usage test), it is a good idea to refer to the use-case name. Remember
that the use cases are the source of test cases. In theory, the software is supposed to match
the use cases, not the reverse. As soon as you have enough of use cases, go ahead and
write the test plan for that piece. . Specify what you are testing and which particular
feature (methods). Then, specify what you are going to do to test the feature and what
you expect to happen. .Test the normal use of the object's methods. .Test the abnormal
but reasonable use of the object's methods. .Test the abnormal and unreasonable use of
the object's methods.
to reach agreement on answers generally will raise other what-if questions. Add these to
the list and answer them, repeat the process until the list is stabilized, then you need not
add any more questions.
.The internal quality of the software, such as its reusability and extendability,
should be assessed as well. Although the reusability and extendability are more difficult
to test, nevertheless they are extremely important. Software reusability rarely is practiced
effectively. The organizations that will survive in the 21st century will be those that have
achieved high levels of reusability-anywhere from 70-80 percent or more . Griss argues
that, although reuse is widely desired and often the benefit of utilizing object technology,
many object-oriented reuse efforts fail because of too narrow a focus on technology
rather than the policies set forth by an organization. He recommends an institutionalized
approach to software development, in which software assets intentionally are created or
acquired to be reusable. These assets then are consistently used and maintained to obtain
high levels of reuse, thereby optimizing the organization's ability to produce high-quality
software products rapidly and effectively. Your test case may measure what percentage
of the system has been reused, say, measured in terms of reused lines of code as opposed
to new lines of code written. Specifying results is crucial in developing test cases. You
should test cases that are supposed to fail. During such tests, it is a good idea to alert the
person running them that failure is expected. Say, we are testing a File Open feature. We
need to specify the result as follows:
1. Drop down the File menu and select Open.
2. Try opening the following types of files:
. A file that is there (should work).
.A file that is not there (should get an Error message).
.A file name with international characters (should work).
.A file type that the program does not open (should get a message or conversion dialog
box).
Testing is a balance of art, science, and luck. It may seem that everything will fall
into place without any preparation and a bug-free product will be shipped. However, in
the real world, we must develop a test plan for locating and removing bugs. A test plan
offers a road map for testing activity; it should state test objectives and how to meet
them. The plan need not be very large; in fact, devoting too much time to the plan can be
counterproductive. There are no magic tricks to debugging; however, by selecting
appropriate testing strategies and a sound test plan, you can locate the errors in your
system and fix them by utilizing debugging tools.
22.9 REFERENCES
1. Norman,Ronald- object oriented system analysis and design – Prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”.
225
CONTENTS
23.1 INTRODUCTION
On paper, it may seem that everything will fall into place with no preparation and
a bug-free product will be shipped. However, in the real world, it may be a good idea to
use a test plan to find bugs and remove them. A dreaded and frequently overlooked
activity in software development is writing the test plan. A test plan offers a road map for
testing activities, whether usability, user satisfaction, or quality assurance tests. It should
state the test objectives and how to meet them. The test plan need not be very large; in
fact, devoting too much time to the plan can be counterproductive. The following steps
are needed to create a test plan:
1. Objectives of the test. Create the objectives and describe how to achieve them.
For example, if the objective is usability of the system, that must be stated and also how
to realize it. (Usability testing will be covered in Previous chapter.)
226
2.Development of a test case. Develop test data, both input and expected output, based on
the domain of the data and the expected behaviors that must be tested (more on this in the
next section).
3. Test analysis. This step involves the examination of the test output and the
documentation of the test results. If bugs are detected, then this is reported and the
activity centers on debugging. After debugging, steps 1 through 3 must be repeated until
no bugs can be detected.
All passed tests should be repeated with the revised program, called regression
testing, which can discover errors introduced during the debugging process. When
sufficient testing is believed to have been conducted, this fact should be reported, and
testing for this specific product is complete .
According to Tamara Thomas , the test planner at Microsoft, a good test plan is
one of the strongest tools you might have. It gives you the chance to be clear with other
groups or departments about what will be tested, how it will be tested, and the intended
schedule. Thomas explains that, with a good, clear test plan, you can assign testing
features to other people in an efficient manner. You then can use the plan to track what
has been tested, who did the testing, and how the testing was done. You also can use your
plan as a checklist, to make sure that you do not forget to test any features.
Who should do the testing? For a small application, the designer or the design team
usually will develop the test plan and test cases and, in some situations, actually will
perform the tests. However, many organizations have a separate team, such as a quality
assurance group, that works closely with the design team and is responsible for these
activities (such as developing the test plans and actually performing the tests). Most
software companies also use beta testing, a popular, inexpensive, and effective way to
test software on a select group of the actual users of the system. This is in contrast to
alpha testing, where testing is done by inhouse testers, such as programmers, software
engineers, and internal users. If you are going to perform beta testing, make sure to
include it in your plan, since it needs to be communicated to your users well in advance
of the availability of your application in a beta version.
The following guidelines have been developed by Thomas for writing test plans :
.You may have requirements that dictate a specific appearance or format for your test
plan. These requirements may be generated by the users. Whatever the appearance of
your test plan, try to include as much detail as possible about the tests. .The test plan
should contain a schedule and a list of required resources. List how many people will be
needed, when the testing will be done, and what equipment will be required.
227
After you have detennined what types of testing are necessary (such as black
box, white box, top-down, or bottom-up testing), you need to document specifically what
you are going to do. Document every type of test you plan to complete. The level of
detail in your plan may be driven by several factors, such as the following: How much
test time do you have? Will you use the test plan as a training tool for newer team
members? . A configuration control system provides a way of tracking the changes to the
code. At a minimum, every time the code changes, a record shouh l, De kept that tracks
which module has been changed, who changed it, and when it was altered, with a
comment about why the change was made. Without configuration control, you may have
difficulty keeping the testing in line with the changes, since frequent changes may occur
without being communicated to the testers. .
Furthennore, testing the whole system and detecting bugs is more difficult than
testing smaller pieces of the application as it is being developed. The practice of waiting
until after the development to test an application for bugs and perfonnance could waste
thousands of dollars and hours of time. ' Testing often uncovers design weaknesses or,
at least, provides infonnation you will want to use. Then, you can repeat the entire
process, taking what you have learned and reworking your design, or move onto
reprototyping and retesting. Testing must take place on a continuous basis, and this
refining cycle must continue
228
CASE STUDY: DEVELOPING TEST CASES FOR THE VIANET BANK ATM
SYSTEM
We identified the scenarios or use cases for the ViaNet bank ATM system. The ViaNet
bank ATM system has scenarios involving Checking Account, Savings Account, and
general Bank Transaction (see Figures. Here again is a list of the use cases that drive
many object-oriented activities, including the usability testing: .Bank Transaction (see
Figure ). .Checking Transaction History (see Figure ). .Deposit Checking (see Figure).
.Deposit Savings (see Figure ). .Savings Transaction History (see Figure ). .Withdraw
Checking (see Figure ). .Withdraw Savings (see Figure ). .Valid/Invalid PIN (see Figure).
The activity diagrams and sequence/collaboration diagrams created for these use cases
are used to develop the usability test cases. For example, you can draw activity and
sequence diagrams to model each scenario that exists when a bank client withdraws,
deposits, or needs information on an account. Walking through the steps can assist you in
developing a usage test case.
Let us develop a test case for the activities involved in the ATM transaction based on the
use cases identified so far. (See the activity diagram in Figure and the sequence diagram
of Figure to refresh your memory.)
Once you have created fully tested and debugged classes of objects, you can put
them into a library for use or reuse. The essence of an object-oriented system is that you
can take for granted that these fully tested objects will perform their desired functions and
seal them off in your mind like black boxes. Testing must take place on a continuous
basis, and this refining cycle must continue throughout the development process until you
are satisfied with the results.
229
23.9 REFERENCES
1. Norman,Ronald- object oriented system analysis and design – Prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5.Ali –Brahmi –Object oriented system development”
230
CONTENTS
24.1 INTRODUCTION
Quality refers to the ability of products to meet the users' needs and expectations.
The task of satisfying user requirements is the basic motivation for quality. Quality also
means striving to do the things right the first time, while always looking to improve how
things are being done. Sometimes, this even means spending more time in the initial
phases of a project-such as analysis and design-making sure that you are doing the right
things. Having to correct fewer problems means significantly less wasted time and
capital. When all the losses caused by poor quality are considered, high quality usually
costs less than poor quality.
Two main issues in software quality are validation or user satisfaction and
verification or quality assurance (see Previous chapter). There are different reasons for
testing. You can use testing to look for potential problems in a proposed design. You can
focus on comparing two or more designs to determine which is better, given
a specific task or set of tasks. Usability testing is different from quality assurance testing
in that, rather than finding programming defects, you assess how well the interface or the
software fits the use cases, which are the reflections of users' needs and expectations. To
ensure user satisfaction, we must measure it throughout the system development with
user satisfaction tests. Furthermore, these tests can be used as a communication vehicle
between designers and end users . In the next section, we look at user satisfaction tests
231
that can be invaluable in developing high- Once the design is complete, you can walk
users through the steps of the scenarios to determine if the design enables the scenarios to
occur as planned.
The phrase two sides of the same coin is helpful for describing the relationship
between the usability and functionality of a system. Both are essential for the
development of high-quality software . Usability testing measures the ease of use as well
as the degree of comfort and satisfaction users have with the software. Products with poor
usability can be difficult to learn, complicated to operate, and misused or not used at all.
Therefore, low product usability leads to high costs for users and a bad reputation for the
developers. Usability is one of the most crucial factors in the design and development of
a product, especially the user interface. Therefore, usability testing must be a key part of
the UI design process.
Usability testing should begin in the early stages of product development; for
example, it can be used to gather information about how users do their work and find out
their tasks, which can complement use cases. You can incorporate your findings into the
usability test plan and test cases. As the design progresses, usability testing continues to
provide valuable input for analyzing initial design concepts and, in the later stages of
product development, can be used to test specific product tasks, especially the ill.
Usability test cases begin with the identification of use cases that can specify the
target audience, tasks, and test goals. When designing a test, focus on use cases or tasks,
not features. Even if your goal is testing specific features, remember that your users will
use them within the context of particular tasks. It also is a good idea to run a pilot test to
work the bugs out of the tasks to be tested and make certain the task scenarios, prototype,
and test equipment work smoothly. Test cases must include all use cases identified so far.
Recall from Previous chapter that the use case can be used through most activities of
software development.
Furthermore, by following Jacobson's life cycle model, you can produce designs
that are traceable across requirements, analysis, design, implementation, and testing. The
main advantage is that all design traces directly back to the user requirements. Use cases
and usage scenarios can become test scenarios; and therefore, the use case will drive the
usability, user satisfaction, and quality assurance test cases (see Figure ).
232
The use cases identified during analysis can be used in testing the design. Once the
design is complete, walk users through the steps of the scenarios to determine if the
design enables the scenarios to occur as planned.
feel comfortable. It often helps to emphasize that you are testing the software, not the
participants. If the participants become confused or frustrated, it is no reflection on them.
Unless you have participated yourself, you may be surprised by the pressure many test
participants feel. You can alleviate some of the pressure by explaining the testing process
and equipment. . Tandy Trower, director of the Advanced User Interface group at
Microsoft, explains that the users must have reasonable time to try to work through any
difficult situation they encounter. Although it generally is best not to interrupt
participants during a test, they may get stuck or end up in situations that require
intervention. This need not disqualify the test data, as long as the test coordinator
carefully guides or hints around a problem. Begin with general hints before moving to
specific advice. For more difficult situations, you may need to stop the test and make
adjustments. Keep in mind that less intervention usually yields better results. Always
record the techniques and search patterns users employ when attempting to work through
a difficulty and the number and type of hints you have to provide them.
Ask subjects to think aloud as they work, so you can hear what assumptions and
inferences they are making. As the participants work, record the time they take to
perform a task as well as any problems they encounter. You may want to follow up the
session with the user satisfaction test (more on this in the next section) and a
questionnaire that asks the participants to evaluate the product or tasks they performed.
Record the test results using a portable tape recorder or, better, a video camera.Since
even the best observer can miss details, reviewing the data later will prove invaluable.
Recorded data also allows more direct comparison among multiple participants. It usually
is risky to base conclusions on observing a single subject. Recorded data allows the
design team to review and evaluate the results.
Whenever possible, involve all members of the design team in observing the test
and reviewing the results. This ensures a common reference point and better design
solutions as team members apply their own insights to what they observe. If direct
observation is not possible, make the recorded results available to the entire team. To
ensure user satisfaction and therefore high-quality software, measure user satisfaction
along the way as the design takes form . In the next section, we look at the user
satisfaction test, which can be an invaluable tool in developing highquality software.
In this chapter, we looked at guidelines and the basic concept of test plans and
saw that, for the most part, use cases can be used to describe the usage test cases.
The essence of an object-oriented system is that you can take for granted that
these fully tested objects will perform their desired functions and seal them off in your
mind like black boxes.
Testing must take place on a continuous basis, and this refining cycle must
continue throughout the development process until you are satisfied with the results.
234
24.9 REFERENCES
1. Norman, Ronald- object oriented system analysis and design – Prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”
235
CONTENTS
25.1 INTRODUCTION
A positive side effect of testing with a prototype is that you can observe how
people actually use the software. In addition to prototyping and usability testing, another
tool that can assist us in developing high-quality software is measuring and monitoring
user satisfaction during software development, especially during the design and
development of the user interface.
User satisfaction testing is the process of quantifying the usability test with some
measurable attributes of the test, such as functionality, cost, or ease of use. Usability can
be assessed by defining measurable goals, such as .95 percent of users should be able to
find how to withdraw money from the ATM machine without error and with no formal
236
training. .70 percent of all users should experience the new function as "a clear
improvement over the previous one." . 90 percent of consumers should be able to operate
the VCR within 30 minutes. Furthermore, if the product is being built incrementally, the
best measure of user satisfaction is the product itself, since you can observe how users are
using it-or avoiding it . Gause and Weinberg have developed a user satisfaction test that
can be used along with usability testing. Here are the principal objectives of the user
satisfaction test : .
Even if the results are never summarized and no one fills out a questionnaire, the
process of creating the test itself will provide useful information. Additionally, the test is
inexpensive, easy to use, and it is educational to both those who administer it and those
who take it.
The format of every user satisfaction test is basically the same, but its content is
different for each project. Once again, the use cases can provide you with an excellent
source of information throughout this process. Furthermore, you must work with the
users or clients to find out what attributes should be included in the test. Ask the users to
select a limited number (5 to 10) of attributes by which the final product can be
evaluated. For example, the user might select the following attributes for a customer
tracking system: ease of use, functionality, cost, intuitiveness of user interface, and
reliability.
A test based on these attributes is shown in Figure . Once these attributes have
been identified, they can playa crucial role in the evaluation of the final product. Keep
these attributes in the foreground, rather than make assumptions about how the design
will be evaluated . The user must use his or her judgment to answer each question by
selecting a number between 1 and 10, with 10 as the most favorable and 1 as the least.
Comments often are the most significant part of the test. Gause and Weinberg raise the
following important point in conducting a user satisfaction test : "When the design of the
test has been drafted, show it to the clients and ask, 'If you fill this out monthly (or at
whatever interval), will it enable you to express what you like and don't like?' If they
answer negatively then find out what attributes would enable them to express themselves
and revise the test."
237
Commercial off-the-shelf (COTS) software tools are already written and a few are
available for analyzing and conducting user satisfaction tests. However, here, I have
selected an electronic spreadsheet to demonstrate how it can be used to record and
analyze the user satisfaction test. The user satisfaction test spreadsheet (USTS) automates
many bookkeeping tasks and can assist in analyzing the user satisfaction
test results. Furthermore, it offers a quick start for creating a user satisfaction test for a
particular project.
Recall from the previous section that the tests need not involve many subjects.
More typically, quick, iterative tests with a small, well-targeted sample of 6 to 10
participants can identify 80-90 percent of most design problems. The spreadsheet should
be designed to record responses from up to 10 users. However, if there are inputs from
more than 10 users, it must allow for that (see Figures ).
One use of a tool like this is that it shows patterns in user satisfaction level. For
example, a shift in the user satisfaction rating indicates that something is happening (see
Figure . Gause and Weinberg explain that this shift is sufficient cause to follow up with
an interview. The user satisfaction test can be a tool for
238
Periodical plotting can reveal shifts in user satisfaction, which can pinpoint a problem-
Plotting the high and low responses indicates where to go for maximum information
(Gause and Weinberg)
239
finding out what attributes are important or unimportant. An interesting side effect of
developing a user satisfaction test is that you benefit from it even if the test is never
administered to anyone; it still provides useful information. However, performing the test
regularly helps to keep the user involved in the system. It also helps you focus on user
wishes. Here is the user satisfaction cycle that has been suggested by Gause and
Weinberg:
1. Create a user satisfaction test for your own project. Create a custom form that fits the
project's needs and the culture of your organization. Use cases are a great source of
information; however, make sure to involve the user in creation of the test.
2. Conduct the test regularly and frequently.
3. Read the comments very carefully, especially if they express a strong feeling.
Never forget that feelings are facts, the most important facts you have about the users of
the system.
4. Use the information from user satisfaction test, usability test, reactions to prototypes,
interviews recorded, and other comments to improve the product.
Another benefit of the user satisfaction test is that you can continue using it even
after the product is delivered. The results then become a measure of how well users are
learning to use the product and how well it is being maintained. They also provide a
starting point for initiating follow-up projects.
In previous previous chapter, we learned that test plans need not be very large; in
fact, devoting too much time to the plans can be counterproductive. Having this in mind
let us develop a usability test plan for the ViaNet ATM kiosk by going through the
followings steps.
The first step is to develop objectives for the test plan. Generally, test objectives are
based on the requirements, use cases, or current or desired system usage. In this case,
ease of use is the most important requirement, since the ViaNet bank customers should be
able to perform their tasks with basically no training and are not expected to read a user
manual before withdrawing money from their checking accounts.
Here are the objectives to test the usability of the ViaNet bank ATM kiosk and its user
interface:
95 percent of users should be able to find out how to withdraw money from the
ATM machine without error or any formal training. .90 percent of consumers should be
able to operate the ATM within 90 seconds.
240
Test cases for usability testing are slightly different from test cases for quality
assurance. Basically, here, we are not testing the input and expected output but how users
interact with the system. Once again, the use cases created during analysis can be used to
develop scenarios for the usability test. The usability test scenarios are based on the
following use cases:
Deposit Checking (see Figures).
Withdraw Checking (see Figures).
Deposit Savings (see Figures).
Withdraw Savings (see Figures).
Savings Transaction History (see Figures).
Checking Transaction History(see Figures).
Next we need to select a small number of test participants (6 to 10) who have never
before used the kiosk and ask them to perform the following scenarios based on the use
case:
1. Deposit $1056.65 to your checking account.
2. Withdraw $40 from your checking account.
3. Deposit $200 to your savings account.
4. Withdraw $55 from savings account.
5. Get your savings account transaction history.
6. Get your checking account transaction history.
Start by explaining the testing process and equipment to the participants to ease
the pressure. Remember to make participants feel comfortable by emphasizing that you
are testing the software, not them. If they become confused or frustrated, it is no
reflection on them but the poor usability of the system. Make sure to ask them to think
aloud as they work, so you can hear what assumptions and inferences they are making.
After all, if they cannot perform these tasks with ease, then the system is not useful.
As the participants work, record the time they take to perform a task as well as
any problems they encounter. In this case, we used the kiosk video...camera to record the
test results along with a tape recorder. This allowed the design team to review and
evaluate how the participants interacted with the user interface, like those developed in
Previous chapter . For example, look for things such as whether they are finding the
appropriate buttons easily and the buttons are the right size. Once the test subjects
complete their tasks, conduct a user satisfaction test to measure their level of satisfaction
with the kiosk.
The format of the user satisfaction test is basically the same as the one we studied
earlier in this previous chapter (see Figure ), but its content is different for the ViaNet
bank. The users, uses cases, and test objects should provide the attributes to be included
in the test. Here, the following attributes have been selected, since the ease of use is the
main issue of the user interface: .Is easy to operate. .Buttons are the right size and easily
241
located. . Is efficient to use. . Is fun to use. . Is visually pleasing. .Provides easy recovery
from errors.
Based on these attributes, the test shown in Figure can be performed. Remember,
as explained earlier, these attributes can playa crucial role in the evaluation of the final
product.
The final step is to analyze the tests and document the test results. Here, we need
to answer questions such as these: What percentage were able to operate the ATM within
90 seconds or without error? Were the participants able to find out how to withdraw
money from the ATM machine with no help? The results of the analysis must be
examined.
We also need to analyze the results of user satisfaction tests. The USTS described
earlier or a tool similar to it can be used to record and graph the results of user
satisfaction tests. As we learned earlier, a shift in user satisfaction pattern indicates that
something is happening and a follow-up interview is needed to find out the reasons for
the changes. The user satisfaction test can be used as a tool for finding out what attributes
are important or unimportant. For example, based 011 the user satisfaction test, we might
find that the users do not agree that the system "is efficient to use," and it got a low score.
A form for the ViaNet bank ATM kiosk user satisfaction test.
242
$60, $80, $100, and $200). This would speed up the process at the ATM kiosk. Based on
the result of the test, the UI was modified to reflect the wishes of the users. You need also
to pay close attention to comments, especially if they express a strong feeling.
Remember, feelings are facts, the most important facts you have about the users of the
system.
Even if your goal is testing specific features, remember that your customers will
use them within the context of particular tasks. The use cases identified during analysis
can be used in testing your design. Once the design is complete, you can walk users
through the steps of the scenarios to determine if the design enables the scenarios to
occur as planned. An interesting side effect of developing user satisfaction tests is that
you benefit from it even if the test is never administered to anyone; it still provides useful
information. However, performing the test regularly helps keep the user actively involved
in the system development. It also helps us stay focused on the users' wishes.
243
25.12 REFERENCES
1. Norman,Ronald- object oriented system analysis and design – Prentice hall 1996
2. Coad.P and Yourdon .E – “Object Oriented Analysis” – Yourdon press
3. Coad.P and Yourdon .E – “Object Oriented Design” – Yourdon press
4. Rambaugh, James ,Michael –Object oriented Modelling and design
5. Ali –Brahmi –Object oriented system development”