Professional Documents
Culture Documents
Chapter - 1
Introduction
There are a bewildering array of software applications and types. Primarily software is
classified into two: system and application software. A typical system software mainly
interacts with the computer, its components and peripherals such as printer, webcam,
scanner, mouse, USB drive etc besides with all the network infrastructure solutions such
as routers, switches, bridges, hubs, gateways, etc. The application software generally
interacts with the system software. The details are as follows.
• Involves concurrent operation that requires scheduling, slicing, time & resource
sharing, and sophisticated process management
Middleware is an emerging software type that sits in between application and system
software facilitating smooth interaction, collaboration, communication, integration,
connectivity, and adaptation purposes.
Real-time Software represents programs that monitor / analyze / control real world events
as they occur. Elements of real-time software include a data gathering component that
collects and formats information from an external environment, an analysis component
that transforms information as required by the application, a control / output component
that responds to the external environment, and a monitoring component that coordinates
all other components so that real-time response can be maintained. Thus a real-time
system must respond within strict time constraints.
Engineering and scientific software has been all along characterized primarily by
number crunching algorithms. Applications range from astronomy to volcanology, from
automotive stress analysis to space shuttle orbital dynamics, and from molecular biology
to automated manufacturing. These are processing-intensive applications.
Embedded software is becoming hugely popular these days. They are found in consumer
electronics, avionics, handhelds, wearables, portables, mobiles, automobiles, smart homes,
and manufacturing industries. Embedded software resides in real-only memory and is used
to control products and systems for the consumer and industrial markets. Embedded
software can perform very limited and esoteric functions such as key pad control for a
microwave oven or provide significant function and control capabilities (e.g., digital
functions in an automobile such as fuel control, dashboard displays, braking systems etc.).
There are many application software applications such as web-based, wireless, desktop,
financial, enterprise, logistics, retail, energy, governmental, healthcare and other business
software applications. Business software represents the discrete systems such as
enterprise resource planning (ERP), supply chain management (SCM), customer
relationship management (CRM), inventory, knowledge, and content management. Most
of the business software are data intensive and data-processing applications.
Similarly there are promising methods, technologies, strategies, tools, infrastructures, and
resources. Thus an appropriate software development process model has to be strictly
chosen based on the nature of the final software system to be built. In this chapter, we are
to see the well-known development process models.
2.1 The Linear Sequential Developmental Model for software engineering is called the
classic life cycle or the waterfall model. This model suggests a systematic, sequential
approach to software development that begins at the system level and progresses through
analysis, design, coding, testing and maintenance. Modeled after the conventional
engineering cycle, the linear sequential model encompasses the following activities:
• Code generation – The design must be translated into a machine readable form.
• Testing – Once code has been generated, program testing begins. The testing
process focuses on the logical internals of the software, assuring that all statements
have been tested and on the functional externals – that is, conducting tests to
uncover errors and ensure that defined input will produce actual results that agree
with required results.
The Prototyping Model – The prototyping paradigm begins with requirements gathering.
Developer and customer meet and define the overall objectives for the software, identify
whatever requirements are known, and outline areas where further definition is mandatory.
A quick design then occurs. The quick design focuses on a representation of those aspects
of the software that will be visible to the customer / user. The quick design leads to the
construction of a prototype. The prototype is evaluated by the customer / user and is used
to refine requirements for the software to be developed. Iteration occurs as the prototype is
tuned to satisfy the needs of the customer, at the same time enabling the developer to
better understand what needs to be done.
• Data modeling – the information flow defined as part of the business modeling
phase is refined into a set of data objects that are needed to support the business.
The characteristics (attributes) of each object are identified and the relationships
between these objects are defined.
• Process modeling – the data objects defined in the data modeling phase are
transformed to achieve the information flow necessary to implement a business
function. Processing descriptions are created for adding, modifying, deleting, or
retrieving a data object
• Testing and turnover – Since the RAD process emphasizes reuse, many of the
program components have already been testing.
2.2 Evolutionary Software Process Models – There is growing recognition that software,
like all complex systems, evolves over a period of time. Thus a few interesting
evolutionary models have emerged. Below a brief of each is supplied.
The Incremental model combines elements of the linear sequential model with the
iterative philosophy of prototyping. Each linear sequence produces a deliverable increment
of the software. For example, word-processing software developed using the incremental
paradigm might deliver basic file management, editing, and document production
functions in the first increment; more sophisticated editing and document production
capabilities in the second increment; spelling and grammar checking in the third
increment; and advanced page layout capability in the fourth increment. Thus when an
incremental model is used, the first increment is often a core product. That is, basic
requirements are addressed but many supplementary features remain undelivered. The
core product might be used by the customer or be subjected for detailed review. As a result
of use and / or evaluation, a plan is being developed for the next increment. The plan
addresses the modification of the core product to better meet the needs of the customer and
the delivery of additional features and functionality. This process gets repeated following
the delivery of each increment, until the complete product is produced. The iterative
process, like prototyping and other evolutionary approaches, is iterative in nature.
The Spiral Model is an evolutionary software process model that couples the iterative
nature of prototyping with the controlled and systematic aspects of the linear sequential
model. In this spiral model, software is developed in a series of incremental releases.
During early iterations, increasingly more complete versions of the engineered system are
produced. The spiral model is divided into a number of task regions.
2. planning – tasks required to define resources, timelines, and other project related
information
3. risk analysis – tasks required to assess both technical and management risks
5. construction & release – tasks required to construct, test, install and provide user
support
Each of the six regions is populated by a series of subtasks that are adapted according to
the characteristics of the project to be undertaken. The spiral model is a realistic approach
to the development of large scale systems and software.
Thus far, we have seen both old and new process models for generic software engineering.
Sometimes the process is being termed as software development life cycle (SDLC). There
are several techniques for simplifying each phase of this development process. Traditional
approaches such as functional / procedure –oriented and structured methods (Structured
analysis, design and implementation) C is the primary structured programming language.
In the recent past, OO paradigm (OO analysis, design, programming, and testing) have
emerged in the software market. Due to its soaring popularity and acceptance among the
professionals as well as the customers, it has become the dominant paradigm as far as the
task of engineering software for various personal, business as well as system domains.
Equally OO paradigm is being strengthened and supported by the grand arrival of a host of
OO programming languages such as C++, Java, C#, VB.NET etc.
abstractions for the real-world problems, it is logical, prudent and natural to think of
software solutions as an interacting, collaborating, and coexisting software objects. This
concept induced many to come out with an increasing array of OO technologies, methods,
models, and approaches. The interesting aspect of OO method includes realizing of
reusability. This reuse of program components leads to faster software development of
bug-free, quality-conscious, reusable, scalable, secure and flexible software applications.
Also OO software is easy to conceptualize, develop, deploy, manage, handle, use, and
maintain for analysts, architects, developers, administrators, and end users.
Building High-Quality Software - The software process transforms the users’ needs via
the application domain to a formidable software service / solution / product that satisfies
that sincerely satisfies those needs. Once the software is build, it is mandatory to check
whether the built software is free of errors, bugs, risks, dangers, defects and infirmities
besides it accomplishes all the core requirements, intentions and expectations of the users.
Thus customer satisfaction and delight is the main and focused target for software services
and solutions providers. There are two basic approaches for testing software systems. That
is, we can test a system according to how it has been built or what it should do. There are
four quality measures for evaluating a system: 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.
Validation is the task of predicting correspondence. True correspondence cannot be
determined until the system is fully built. Correctness measures the consistency of the
product requirements with respect to the design specification. Verification is the exercise
of determining correctness.
Correctness always is objective. That is, given a specification and a product, it should be
possible to determine if the product precisely satisfies the requirements of the
specification. Validation is always subjective. That is, it checks the appropriateness of the
specification itself. In hindsight, verification checks whether we build the product right
whereas the validation evaluates whether we build the right product. Validation begins as
soon as the project starts, but verification can begin only after a specification has been
accepted. Thus realizing high-quality software is ensured through these checks. OO
system development technologies, methodologies, strategies, tools, infrastructures and
resources are guaranteeing high-quality software. In the following, we are to discuss in
detail all about the OO software development.
2. OO Design
3. Prototyping
4. Component-based Development
5. Incremental Testing
Thus gathering system requirements in the form of use cases, studying, analyzing,
prioritizing, organizing, cataloguing, and documenting them for future references,
estimating risks, identifying the relevant classes, and establishing the plausible
relationships between the objects of those classes are some of the important activities of
the OO analysis phase.
3.2 The goal of Object-Oriented Design (OOD) phase is to design the classes identified
during the earlier phase and the user interface. Identifying and defining additional objects
and classes that support implementation of the requirements are the other important tasks
in this very crucial and critical phase. If the design is right, the product or the system to be
built would be right. During interface design, there will be a need for thinking about
incorporating additional objects. The activities of the design phase are summarized as
follows
Thus designing and refining the class and object structures, components and their
collaborations are the leading activities of the design phase.
In the picture drawn using IBM Rational tool, there are two classes (Shape and Controller)
and two subclasses (Rectangle and Circle) of Shape class. Each class has its own attributes
and methods as indicated in the class diagram.
3.3 Prototyping – It is gaining momentum to construct a prototype of the some of the key
system components before embarking on full-fledged system development. As often told
that a picture is worth a thousand words, a prototype is worth a thousand pictures. 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 to fully understand how
easy or difficult to implement certain aspects in the final commercial version. Also we can
understand what novel features need to be added or what sorts of risks are involved in
system development. A prototype is to tell an overall view of the system under
development. A prototype would clearly tell what sort of changes the developer has to
make, what sort of software toolkits, languages, and technologies need to be used etc.
Thus the benefits accrued out of prototyping are manifold including rescuing the project
from going down. The navigability, usability, and usefulness of user interfaces can be
enhanced with this prototyping. There are many commonly accepted prototypes as
follows.
3. An analysis prototype is an aid for exploring the problem domain. This class of
prototypes is used to inform the user and demonstrate the proof of a concept.
Thus prototyping is turning out to be a useful exercise at almost any stage of the
development.
Legacy applications coded using old technologies such as COBOL are made interoperable
with the modern applications using concepts such as wrapper, helper software suite etc.
Thus off-the-shelf components, wrappers, classes and other software modules are
encouraging the component-based development. The software components are the
functional units of a program and building blocks for offering a collection of core,
customized, and personalized services. Thus CBD is emerging as the hot cake for the
developers to develop next-generation software applications using the time-tested, quality-
conscious, refined, and highly reusable software components.
3.5 Rapid Application Development (RAD) is a set of software tools such as Delphi,
Visual Basic, VisualAge, or PowerBuilder and viable techniques that can be used to build
an application faster than typically possible with traditional methods. RAD is often
associated with development of software in quick time. The main objective of RAD is to
build a version of an application quickly to see whether the architects have understood the
system requirements correctly and the developers are moving in the right direction.
Further it determines whether the system does what it is expected to do. Thus RAD is an
interesting move in order to visualize what is to come and if there is any deviation, it can
be corrected in time.
3.6 Incremental testing – In the olden days, after fully completing the system or product
only, the testing team will come into picture. This will waste a lot of time and dollars and
hence in order to reduce the project completion time, testing is introduced at the earlier
stage. That is, when a small building block (a testable class or software module), it is sent
to testing department for thorough and comprehensive testing.
UNIT - II
There are too many OO methodologies proposed by many and the top three are from
Booch, Rumbaugh, and Jacobson. In this chapter, we are to study each of these leading
OOM and at the end; we derive the unified approach by composing the best methods,
concepts, diagrams, and initiatives. The key concepts in Object-Oriented Programming are
these:
Classes - A class is the definition of the behavior and properties of one or more objects
within a system. A class binds the data (attributes) of an object to the behavior
(operations) that it can perform.
Attributes - An attribute is a data value or state that describes an object and helps to tell
one object from another of the same class. In some OO languages, these data values are
called properties or member variables or member data; but in UML, the proper term is
attributes.
Objects - An object is an instance or specific example of a class. If Dog is the class, then
Betsy, Ladi, Patches, Jake, Radar, and Frosty are specific instances of the class found in a
house. The attributes of the class have specific values within an object of that class; and
the operations of a class operate on the attributes of individual objects.
Inheritance - This concept indicates that one class (the superclass) provides some
common or general behavior inherited by one or more specific classes (the subclasses).
The subclasses then provide more or different behavior beyond that defined in the
superclass. For example, besides the Dogs, I have Cat objects and Horse objects. Each
class has unique behaviors: Dogs must be walked, Cats use the litter box, and Horses drop
manure that must be scooped up and thrown in the manure pile. Yet all classes have some
common behavior: they must be fed, and they must have vet visits. So I can define a
superclass, Pet, and have my subclasses, Dog, Cat, and Horse, derive their shared behavior
from the Pet class. In UML, this concept is known under the slightly different term of
generalization, in which a superclass provides the generalized behavior of the subclasses.
Object-Oriented Methodology (OOM) is a set of proven methods, models, and rules for
developing systems. Modeling is the process of describing an existing or proposed system.
A model is an abstraction of a phenomenon for the purpose of understanding it. Since a
model excludes unnecessary details, it is easier to manipulate than the real object.
Modeling provides a means for communicating ideas in an easy to understand and
unambiguous form while also accommodating a system complexity.
To get a feel for object-oriented methodologies, in this section, we are to see look at some
of the methods
2. Sally Shlaer and Steve Mellor have created the concept of the recursive design
approach
5. Jim Rumbaugh led a team at the research labs of General Electric to develop the
object modeling technique (OMT)
6. Peter Coad and Ed Yourdon developed the Coad lightweight and prototype-
oriented approach to methods
7. Ivar Jacobson introduced the concept of the use case and object-oriented software
engineering
Many methodologies are available for system development. Each methodology is based on
modeling the business problem and implementing the application in an object-oriented
fashion. These methodologies and many other forms of notational language have provided
system designers and architects many choices but created a very confusing environment.
Most of the methods were very similar but contained a number of often annoying minor
differences. The differences lie primarily in the documentation of information and
modeling notations and language.
The OMT describes a method for the analysis, design, and implementation of a system
using an object-oriented technique. MT is a fast, intuitive approach for identifying and
modeling all the objects making up a system. OMT separates modeling into three different
parts as described below.
Functional model – 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. Data flow diagrams use four primary symbols:
1. The process is any function being performed; for example, verify Password
or PIN in the ATM system
2. The data flow shows the direction of data element movement; for example,
PIN code
3. The data store is a location where data are stored; for example, account is a
data store in the ATM example
2. System Design – The results are a structure of the basic architecture of the system
along with high-level strategy decisions
Booch define methodology consists of a lot symbols to document almost every design
decision. The Booch method consists of the following diagrams
1. Class Diagrams
2. Object Diagrams
4. Module Diagrams
5. Process Diagrams
6. Interaction Diagrams
The macro process serves as a controlling framework for the micro process. The primary
concern of the macro process is technical management of the system. Such management is
interested less in the actual OO design and instead focus on how well the project
corresponds to the requirements set for it and whether it is produced on time.
2. Analysis and development of the model – We can use the class diagram to describe
the roles and responsibilities objects are to carry out in performing the desired
behavior of the system. We can use object diagram or the interaction diagrams to
describe the behavior of the system.
3. Design or create the system architecture – In this phase, we can use the class
diagram to decide what classes exist and how they relate to each other. Next, we
can use the object diagram to decide what mechanisms are used to regulate how
objects collaborate. Then we can use the module diagram to map out where each
class and object should be declared. Finally, we can use the process diagram to
determine to which processor to allocate a process. Also this step determines the
schedules for multiple processes on each relevant processor.
The Micro Development process – Each macro development process has its own micro
development process, which has the following steps.
3. Jacobson Methodology
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. The use cases are described as text, easy to
read with a clear flow of events to follow. The use case description must contain
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
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 we have one use case that is similar
to another use case but does a bit more. That is, 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. Abstract use cases also are
the ones that have “uses” or “extends” relationships.
OOSE, also called Objectory is a method of OO development with the specific aim to fit
the development of large, real-time systems. The development process, called use-case
driven development, stresses that use cases are involved in several phases of the
development including analysis, design, validation and testing. The use case scenario
begins with a user of the system initiating a sequence of interrelated events. The highlight
of this methodology is that by organizing the analysis and design models around
sequences that are both more usable and more robust, adapting more easily to changing
usage.
The use-case model defines the outside (actors) and inside (use case) of the system
behavior
Domain object model – The objects of the real-world are mapped into the domain
object model
The analysis object model presents how the source code (implementation) should
be carried out and written
The test model constitutes the test plans, specifications and reports
The analysis phase defines the system to be built in terms of the problem-domain object
model, the requirements model, and the analysis model. The analysis phase should not
take into account the actual implementation environment parameters. This sort of analysis
helps to reduce complexity and promotes maintainability over the life of the system since
the description of the system will be independent of hardware and software requirements.
That is, this model should be developed just enough to form a base of understanding for
the requirements model. The analysis process is iterative but requirements and analysis
models should be stable before moving on to subsequent models
Testing phase – There are many testing types – unit testing, integration testing, system
testing etc.
Communication about patterns is enabled by a vocabulary that describes the pattern and its
related components such as name, context, motivation, and solution. By classifying these
components and their nature such as the structural or behavioral nature of the solution, we
can categorize patterns. The concept of patterns and their documentation is becoming
popular among the software professionals. They are being extensively used for shortening
the development time and to enhance the quality of software solutions. The OO thinkers
have come out with the roles of design patterns. They could identify the key aspects of a
common design structure that make it useful for creating a reusable OO design. Further
more, design patterns identify the participating classes and instances, their roles, and
collaborations and the distribution of responsibilities. Patterns also describe whet they can
be applied, whether they can be applied in view of other design constraints, and the
consequences and trade-offs of their use.
Patterns and pattern languages should be able to generate whole, living structures. Part of
the desire to create architectures emulating life lies in the unique ability of living things to
evolve and adapt to their ever-changing environments. Similarly, a good software
architecture is about being adaptable and resilient to change. The successive application of
several patterns, each encapsulating its own problem and forces, unfolds a larger solution,
which emerges indirectly as a result of the smaller solutions.
Pattern Types - A pattern in waiting, which is not yet known to recur, is called a proto-
pattern. 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 recurring system
architectures they helped shape. Non-generative patterns are static and passive. They
describe recurring phenomena without necessarily saying how to reproduce them. We
have to document generative patterns due to their significant contributions for efficient
software development.
Pattern Application Domains - Patterns are being largely used for software architecture
and design and more recently, for all aspects of software engineering, including
development organization, the software development process, project planning,
requirements engineering, and software configuration management. A good pattern will
do the following:
It is a proven concept. Patterns capture solutions with a track record, not theories
or speculation
The solution is not obvious. The best patterns generate a solution to a problem
indirectly
The pattern has a significant human component. All software serves human
comfort or quality of life; the best patterns explicitly appeal to aesthetics and
utility.
A good pattern description should fully encapsulate all the forces that have an
impact on it
Pattern Templates - Each 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. A pattern should contain certain essential components:
1. Name – Every pattern should contain a meaningful name, which may be a single
word or short phrase to refer to the pattern and the knowledge and structure it
describes.
2. Problem – A statement of the problem that describes its intent: the goals and
objectives it wants to reach within the given context and forces.
3. Context – The preconditions under which the problem and its solution seem to
recur and for which the solution is desirable. It can be thought of as the initial
configuration of the system before the pattern is applied to it.
4. 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. 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.
5. Solution – Static relationships and dynamic rules describe 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 the dynamic behavior. The static structure tells
us the form and organization of the pattern but the behavioral dynamics is what
makes the pattern “come alive”.
6. 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 to understand the
pattern’s use and applicability. Visual examples and analogies often can be very
useful.
7. Resulting Context – The state or configuration of the system after the pattern is
applied, including the consequences (both bad and good) of applying the pattern,
and other problems and patterns that may arise from the new context. It describes
the post conditions 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 unsolved, and which patterns may now be applicable. Documenting
the resulting context produced by one pattern helps to correlate it with the initial
context of other patters.
8. 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. That is, how the pattern actually works, why it works, and why it is good
9. Related patterns share the common forces. They also 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 be applied simultaneously with
this pattern.
10. Known Uses – The known occurrences and its applications within existing systems
need to be documented. This helps validate a pattern by verifying that it indeed is a
proven solution to a recurring problem.
Those describing how to get out of a bad situation and how to proceed
from there to a good solution
Capturing Patterns – A pattern should help its users to comprehend existing systems,
customize systems to fit user needs, and construct new systems. The process of looking for
patterns to document is called pattern mining. The following guidelines give what exactly
is a pattern.
Careful editing – The pattern authors should have the opportunity to incorporate all
the comments and insights during the shepherding and writers’ workshops before
presenting the patterns in their finished form.
5. Frameworks
A framework is a set of cooperating classes that make up a reusable design for a specific
class of software. A framework provides architectural guidance by partitioning the design
into abstract classes and defining their responsibilities and collaborations. A developer
customizes a framework to a particular application by subclassing the composing instances
of framework classes. The framework captures the design decisions that are common to its
application domain. Frameworks thus emphasize design reuse over code reuse, though a
framework will usually include concrete subclasses we can put to work immediately. Thus
a framework is a way of presenting a generic solution to a problem that can be applied to
all levels in a development. Design and software frameworks are currently popular.
A seasoned business consultant who has worked on many consulting projects performing
data modeling almost never builds a new data model from scratch. Instead, he will make
use of model fragments that have been developed over time to help new modeling projects
hit the ground running.
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.
This approach is based on the best practices that have proven successful in system
development and more specifically the work done by the stalwarts of OO paradigm. The
UA establishes a unifying and unitary framework around their works by utilizing the UML
to describe, model, and document the software development process. The main idea
behind this UA is to combine the best practices, processes, methodologies, and guidelines
along with UML notations and diagrams for better understanding OO concepts and
systems development. The UA revolves around the following processes
Object-oriented analysis
Object-oriented design
Continuous testing
Component-based development
The UA allows iterative development by allowing to go back and forth between the design
and modeling or analysis phases.
OOA – Analysis is the process of extracting the needs of a system and what the system
must do to satisfy the user requirements. The goal is to understand the domain of the
problem and the system’s responsibilities by understanding how the users or will use the
system. This is accomplishing by constructing several models of the system. The 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:
5. Identify classes
OOD – The UA utilizes Jacobson’s analysis and interaction diagrams, Booch’s object
diagrams and Rumbaugh’s domain model. Further more, by following Jacobson’s life
cycle model, we can produce designs that are traceable across requirements, analysis,
design, coding, and testing. OOD process consists of:
4. User satisfaction and usability tests based on the usage / use cases
Iterative Development and Continuous Testing – We must iterate and reiterate till we
are satisfied with the system. Since testing often uncovers design weaknesses, we need to
repeat the entire process, taking what we have learned and reworking our design or
moving on to reprototyping and retesting. During this iterative process, our prototypes will
be incrementally transformed into the actual application. The UA encourages the
integration of testing plans from day 1 of the project. Usage scenarios can be test scenarios
and use cases will drive the usability testing.
Unified Modeling Language (UML) – The UML merges the best of the notations used
by the three most popular analysis and design methodologies. UML is becoming the
universal for modeling OO systems. It is to express models of many different kinds and
purposes just as a programming language is used in different ways. The UA uses the UML
to describe and model the analysis and design phases of systems development.
Most systems being developed today are two-layered architecture: interface and data. The
three-layered approach consists of a view or user interface, a business layer and an access
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, inventory and invoice
exist. The responsibilities of business layer are: model the objects of the business and how
they interact to accomplish the business processes. These objects should not be responsible
for the following:
2. Data access details – Business objects also should have no special knowledge of
data and its origin. 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.
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 user interface (View) layer – The UI layer consists of objects with which the user
interacts as well as the objects needed to manage or control the interface.
2. 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.
The Access layer contains objects that know how to communicate with the place where
the data actually reside, whether it is a relational database, OODBMS. Regardless of
where the data actually reside, the objectives
1. Translate request – this layer must be able to translate any data-related requests
from the business layer into the appropriate protocol for data access. For example,
if customer number 55552 needs to retrieved, the access layer must be able to
create the correct SQL statement and execute it
2. Translate results – This layer also must be able to translate the data retrieved back
into the appropriate business objects and pass those objects back up into the
business layer.
8. The UA Repository
In modern businesses, best practice sharing is a way to ensure that solutions to process and
organization problems in one part of the business are communicated to other parts where
similar problem occur. Best practice sharing eliminates duplication of problem solving.
For many companies, best practice sharing is institutionalized as part of their constant goal
of quality improvement. Best practice sharing must be applied to application development
if quality and productivity are to be added to component reuse benefits.
The idea promoted here is to create a repository that allows the maximum reuse of
previous experiences, knowledge gathered and previously defined specifications, objects,
principles, practices, processes, procedures, software modules, classes, components,
services, and applications in an easily accessible manner with a completely available and
easily utilized format. Everything from the original user request to maintenance of the
project as it goes to production should be kept in the repository. The advantages of
repositories are many. If we store software objects from our projects implementations for
our clients in the repository, they can be reused for forthcoming projects. Any thing such
as the definition of data element, diagrams symbols, definitions, etc can be stored in the
repository. Thus software development becomes easier, and quicker. If new requirements
emerge, new objects will be design and stored in the main repository for future use. The
repository will be made available and accessible for many. Also there are UML diagrams,
design patterns, frameworks, CASE tools, IDEs etc that also facilitate quicker software
development.
reinforces learning and training. Manipulation of the model is much easier than
manipulation of a real system.
Why Models? - Models can represent static or dynamic models. A static model can be
viewed as a snapshot of a system’s parameters at rest or at a specific point in time. Static
models are needed to represent the structural or static aspect of a system. For example, a
customer could have more than one account or an order could be aggregated from one or
more line items. Static models assume stability and an absence of change of data over
time. The class diagram is an example of a static model
Due to the rise in complexity of present day systems, virtualization and modeling becomes
essential, as we cannot comprehend the total system. Visual notations bring us several
benefits relating to
Clarity – We are much better at picking out errors, and omissions from a graphical or
visual representation than from listings of code or tables of numbers
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.
Maintenance – Visual notation can improve the maintainability of a system. The visual
identification of locations to be changed and the visual confirmation of those changes will
reduce errors.
UML Diagrams
1. Class diagram
2. Use-case diagram
3. Behavior diagram
4. Implementation diagram
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. 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 world). The visual representation of the objects, their
relationships and their structures is for ease of understanding. It is essential to determine
all the objects required for the system. 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 and the relationships among objects by visual notation and determine what
behaviors fall within and outside the problem domain.
Dynamic Modeling
We need to understand both the structure and the function of the objects involved. We
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. Events happen dynamically in all systems. Objects are created, and destroyed.
Objects sends messages to one another in an orderly fashion and in some systems, external
events trigger operations on certain objects. Further more, objects have states and static
model fails to capture the state of an object. The state of an object is the result of its
behavior. Each class may have an associated activity diagram that indicates the behavior
of the class’s instance (its object).
UML Interaction diagrams 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.
Sequence Diagram is 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 arrange 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 the different objects. The vertical line is called the
object’s lifeline that represents the object’s existence during the interaction. 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. A sequence diagram is an alternative way to understand the overall flow of
the control of a program.
The disadvantage of interaction diagrams is they are great only for representing a single
sequential process. They begin to break down when we want to represent conditional
looping behavior. However, there are ways to represent condition behavior in interaction
diagrams. The preferred method is to use separate diagrams for each scenario. Another
way is to use conditions on messages to indicate the behavior. Activity diagram is the best
option for capturing complex behavior. Thus interaction diagrams are for examining the
behavior of objects within a single use case.
UML State-chart diagram – 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
state diagram may contain subdiagrams. A state diagram represents the state of the method
execution, that is, the state of the object executing the method. 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. The activity
symbol (a solid black dot) appears within a state symbol, it indicates the execution of an
operation.
A message is data passed from one object to another. A message is a name that will trigger
an operation associated with the target object. For example, an Employee object that
contains the name of an employee. If the employee object received a message
(getEmployeeName) asking for the name of the employee, an operation contained in the
Employee class would be invoked. That operation would check the attribute Employee
and then assign the value associated with that attribute back to the object that sent the
message in the first place. In this case, the state of the Employee object would not have
been changed. Now consider a situation where the same Employee object received a
message (updateEmployeeAddress). In this case, the object would invoke an operation
from its class that would modify the value associated with the attribute Employee,
changing it from the old address to the new address and hence the state of the employee
object has been changed.
A state is represented as a rounded box, which may contain one or more compartments.
The name compartment holds the optional name of the state and the internal transition
compartment holds a list of internal actions or activities performed in response to events
received while the object is in the state, without changing states.
Two special events are entry and exist. The statechart supports nested state machines. 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. A complex transition may have multiple
source and target states. It represents a synchronization or a splitting of control into
concurrent threads.
There is no need to prepare a state diagram for each class in the system. State diagrams are
useful if there is a dynamic class. In that situation, it is helpful to prepare a state diagram
to be sure we 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 determine the overall activity of
the system
UML Activity Diagram is a variation or special case of a state machine, in which the
states are activities representing the performance of operations and the transitions are
triggered by the completion of the operation. Unlike state diagrams that focus on the
events occurring to a single object as it responds to messages, an activity diagram can be
used to model an entire business process. The purpose of an activity diagram is to provide
a view of flows and what is going on inside a use case or among several classes. Activity
diagram is also used to represent a class’s method implementation.
An activity model is similar to state diagram, where a token (a black dot) represents an
operation. An activity is shown as a round box, containing the name of the operation.
When an operation symbol appears within an activity diagram, it indicates the execution
of the operation. An outgoing solid arrow attached to an activity symbol indicates a
transition triggered by the completion of the activity. Several transitions with different
conditions imply a branching off of control.
An activity diagram is mostly used to show the internal state of an object. Activity and
state diagrams express a decision when conditions are used to indicate possible transitions
that depend on Boolean conditions of container object.
Component diagrams model the physical components (such as source code, executable
diagram, user interface) in a design. A package is a collection of classes, which are smaller
scale components. A package is being used to group logical components of the application
such as classes and not necessarily physical components. A component diagram is a graph
of the design’s components connected by dependency relationships.
Deployment diagrams show the configuration of run-time processing elements and the
software components, processes, and objects that live in them. Software component
instances represent run-time manifestations of code units. In most cases, component
diagrams are used in conjunction with deployment diagrams to show how physical
UML Extensions
A note is a graphic symbol containing textual information and it also could contain
embedded images. A note is shown as a rectangle with a bent corner in the upper right
corner.
UML meta-model
The UML defines notations as well as a meta-model. UML graphic notations can be used
not only to describe the system’s components but also to describe a model itself. This is
known as meta-model. That is, a meta-model is a model of modeling elements. The
purpose of the UML meta-model is to provide a single common and definitive statement
of the syntax and semantics of the elements of the UML
The meta-model provides us a means to connect different UML diagrams. The connection
between the different diagrams is very important and the UML attempts to make these
couplings more explicit through defining the underlying model while imposing no
methodology.
UNIT - IV
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 in the implementation language. New classes must be
introduced to store intermediate results during program execution. Emphasizes shifts from
the application domain to implementation and computer concepts such as user interfaces
and access layer.
During the analysis, we look at the physical entities or business objects in the system.
These objects represent tangible elements of the business. These objects could be
individuals, organizations, machines, or something that makes sense in the context of the
real-world system. During the design phase, we must elevate the model into actual objects
that can perform the required task
Refine and complete the static UML class diagram by adding details to
the UML class diagram. This step consists of the following
1. Refine attributes
Create mirror classes – For every business class identified and created,
create one access class.
Design the macro level user interface, identifying view layer objects
Utilizing an incremental approach such as the UA, all stages of software development can
be accomplished incrementally. From the UML class diagram, we can begin to
extrapolate which classes we will have to build and which existing classes we can reuse.
OO Design Axioms
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. Axiom 2 is concerned with simplicity. That is, software components
should be with a minimum amount of complexity and maximum simplicity and
straightforwardness.
Corollaries – From the above 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. The corollaries are design rules.
Corollary 1 – Uncoupled design with less information content – Highly cohesive objects
can improve coupling because only a minimal amount of essential information needs to be
passed between objects.
Method 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.
Corollary 2 – Single purpose – Each class must have a purpose. Every class should be
clearly defined. When we document a class, we should be able to do it in a sentence or
two. That is, keep it simple, precise and concise. Each method should provide only one
service.
Corollary 3 – Large number of Simpler Classes and Reusability – A great benefit results
from having a large number of simpler classes. 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. The primary benefit of reusability is higher productivity
Corollary 4 – Strong mapping – OOA and OOD 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 class – design 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
Corollary 5 - Standardization – Several OO languages have come out with built-in class
libraries. So to reuse classes, we need to have a good understanding of the classes in OO
environment. So class libraries need to be well documented. In essence, standardization of
classes and their libraries is the primary need.
How to decide inheritance – There are possibilities for designing subclasses that inherit
from inappropriate superclasses. So the questions to be asked are
Is it an entirely new thing that simply wants to borrow some expertise from its
superclass (low inheritance coupling)?
One way of achieving the benefits of multiple inheritance in a language with single
inheritance is to inherit from the most appropriate class and add an object of another class
as an attribute or aggregation. Thus there are two ways to borrow existing functionality in
a class. One is to inherit it and the other is to use the instance (object) of the class as an
attribute.
Design Patterns
As we studied in a earlier chapter, a design pattern provides a scheme for refining the
subsystems or components of a software system or the relationships among them. In other
words, they are devices that allow systems to share knowledge about their design, by
describing commonly recurring structures of communicating components that solve a
general design problem within a particular context. For example, while programming, we
have encountered many problems that occurred before and will occur again. Here comes a
design pattern by Kurotsuchi
Rationale and Motivation – The façade pattern can make the task of accessing a large
number of modules much simpler by providing an additional interface layer. When
designing good programs, programmers usually attempt to avoid excess coupling between
modules / classes. Using this pattern to simplify much of the interfacing. That is, a small
collection of classes will access a single class, which is the façade.
Classes – There can be any number of classes in this façade system but at least four or
more classes are required
There are too many OO methodologies proposed by many and the top three are from
Booch, Rumbaugh, and Jacobson. In this chapter, we are to study each of these leading
OOM and at the end, we derive the unified approach by composing the best methods,
concepts, diagrams, and initiatives. The key concepts in Object-Oriented Programming are
these:
Classes - A class is the definition of the behavior and properties of one or more objects
within a system. A class binds the data (attributes) of an object to the behavior
(operations) that it can perform.
Attributes - An attribute is a data value or state that describes an object and helps to tell
one object from another of the same class. In some OO languages, these data values are
called properties or member variables or member data; but in UML, the proper term is
attributes.
Objects - An object is an instance or specific example of a class. If Dog is the class, then
Betsy, Ladi, Patches, Jake, Radar, and Frosty are specific instances of the class found in a
house. The attributes of the class have specific values within an object of that class; and
the operations of a class operate on the attributes of individual objects.
Inheritance - This concept indicates that one class (the superclass) provides some
common or general behavior inherited by one or more specific classes (the subclasses).
The subclasses then provide more or different behavior beyond that defined in the
superclass. For example, besides the Dogs, I have Cat objects and Horse objects. Each
class has unique behaviors: Dogs must be walked, Cats use the litter box, and Horses drop
manure that must be scooped up and thrown in the manure pile. Yet all classes have some
common behavior: they must be fed, and they must have vet visits. So I can define a
superclass, Pet, and have my subclasses, Dog, Cat, and Horse, derive their shared behavior
from the Pet class. In UML, this concept is known under the slightly different term of
generalization, in which a superclass provides the generalized behavior of the subclasses.
Object-Oriented Methodology (OOM) is a set of proven methods, models, and rules for
developing systems. Modeling is the process of describing an existing or proposed system.
A model is an abstraction of a phenomenon for the purpose of understanding it. Since a
model excludes unnecessary details, it is easier to manipulate than the real object.
Modeling provides a means for communicating ideas in an easy to understand and
unambiguous form while also accommodating a system complexity.
To get a feel for object-oriented methodologies, in this section, we are to see look at some
of the methods
Many methodologies are available for system development. Each methodology is based on
modeling the business problem and implementing the application in an object-oriented
fashion. These methodologies and many other forms of notational language have provided
system designers and architects many choices but created a very confusing environment.
Most of the methods were very similar but contained a number of often annoying minor
differences. The differences lie primarily in the documentation of information and
modeling notations and language.
The OMT describes a method for the analysis, design, and implementation of a system
using an object-oriented technique. MT is a fast, intuitive approach for identifying and
modeling all the objects making up a system. OMT separates modeling into three different
parts as described below.
Functional model – 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. Data flow diagrams use four primary symbols:
1. The process is any function being performed; for example, verify Password
or PIN in the ATM system
2. The data flow shows the direction of data element movement; for example,
PIN code
3. The data store is a location where data are stored; for example, account is a
data store in the ATM example
Booch define methodology consists of a lot symbols to document almost every design
decision. The Booch method consists of the following diagrams
1. Class Diagrams
2. Object Diagrams
4. Module Diagrams
5. Process Diagrams
6. Interaction Diagrams
The macro process serves as a controlling framework for the micro process. The primary
concern of the macro process is technical management of the system. Such management is
interested less in the actual OO design and instead focus on how well the project
corresponds to the requirements set for it and whether it is produced on time. The macro
development process consists of the following steps:
2. Analysis and development of the model – We can use the class diagram to describe
the roles and responsibilities objects are to carry out in performing the desired
behavior of the system. We can use object diagram or the interaction diagrams to
describe the behavior of the system.
3. Design or create the system architecture – In this phase, we can use the class
diagram to decide what classes exist and how they relate to each other. Next, we
can use the object diagram to decide what mechanisms are used to regulate how
objects collaborate. Then we can use the module diagram to map out where each
class and object should be declared. Finally, we can use the process diagram to
determine to which processor to allocate a process. Also this step determines the
schedules for multiple processes on each relevant processor.
The Micro Development process – Each macro development process has its own micro
development process, which has the following steps.
3. Jacobson Methodology
This traceability enables reuse of analysis and design work in the reduction of
development time. At the heart of this OOM is the use case concept.
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. The use cases are described as text, easy to
read with a clear flow of events to follow. The use case description must contain
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
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 we have one use case that is similar
to another use case but does a bit more. That is, 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. Abstract use cases also are
the ones that have “uses” or “extends” relationships.
OOSE, also called Objectory is a method of OO development with the specific aim to fit
the development of large, real-time systems. The development process, called use-case
driven development, stresses that use cases are involved in several phases of the
development including analysis, design, validation and testing. The use case scenario
begins with a user of the system initiating a sequence of interrelated events. The highlight
of this methodology is that by organizing the analysis and design models around
sequences that are both more usable and more robust, adapting more easily to changing
usage. Objectory is built around several different models:
The use-case model defines the outside (actors) and inside (use case) of the system
behavior
Domain object model – The objects of the real-world are mapped into the domain
object model
The analysis object model presents how the source code (implementation) should
be carried out and written
The test model constitutes the test plans, specifications and reports
The analysis phase defines the system to be built in terms of the problem-domain object
model, the requirements model, and the analysis model. The analysis phase should not
take into account the actual implementation environment parameters. This sort of analysis
helps to reduce complexity and promotes maintainability over the life of the system since
the description of the system will be independent of hardware and software requirements.
That is, this model should be developed just enough to form a base of understanding for
the requirements model. The analysis process is iterative but requirements and analysis
models should be stable before moving on to subsequent models
Testing phase – There are many testing types – unit testing, integration testing, system
testing etc.
from prefabricated and predefined system components. There are commonly encountered
and difficult problems that are recurring and repetitive and hence a need arises for a
standard vocabulary for communicating insight and experience about these problems and
their solutions. This enforces the view of having a body of literature consisting of both the
identified problems and solutions to help software analysts, architects, and developers.
Thus the focus here is on inculcating the culture of document creation in order to support
sound engineering architecture, design, best practices, guidelines etc. as the documentation
immensely helps to categorize and communicate about solutions to recurring problems.
The pattern has a name to facilitate discussion, and the information it represents. The
documentation of a pattern, in essence, provides the contexts under which it is suitable and
the constraints and forces that may affect a solution or its consequences.
Communication about patterns is enabled by a vocabulary that describes the pattern and its
related components such as name, context, motivation, and solution. By classifying these
components and their nature such as the structural or behavioral nature of the solution, we
can categorize patterns. The concept of patterns and their documentation is becoming
popular among the software professionals. They are being extensively used for shortening
the development time and to enhance the quality of software solutions. The OO thinkers
have come out with the roles of design patterns. They could identify the key aspects of a
common design structure that make it useful for creating a reusable OO design. Further
more, design patterns identify the participating classes and instances, their roles, and
collaborations and the distribution of responsibilities. Patterns also describe whet they can
be applied, whether they can be applied in view of other design constraints, and the
consequences and trade-offs of their use.
Patterns and pattern languages should be able to generate whole, living structures. Part of
the desire to create architectures emulating life lies in the unique ability of living things to
evolve and adapt to their ever-changing environments. Similarly, a good software
architecture is about being adaptable and resilient to change. The successive application of
several patterns, each encapsulating its own problem and forces, unfolds a larger solution,
which emerges indirectly as a result of the smaller solutions.
Pattern Types - A pattern in waiting, which is not yet known to recur, is called a proto-
pattern. 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 recurring system
architectures they helped shape. Non-generative patterns are static and passive. They
AVCCE, Dept. of MCA – III Semester 49
CA 5202 – Object Oriented Analysis and Design
Pattern Application Domains - Patterns are being largely used for software architecture
and design and more recently, for all aspects of software engineering, including
development organization, the software development process, project planning,
requirements engineering, and software configuration management. A good pattern will
do the following:
It is a proven concept. Patterns capture solutions with a track record, not theories
or speculation
The solution is not obvious. The best patterns generate a solution to a problem
indirectly
The pattern has a significant human component. All software serves human
comfort or quality of life; the best patterns explicitly appeal to aesthetics and
utility.
A good pattern description should fully encapsulate all the forces that have an
impact on it
Pattern Templates - Each 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. A pattern should contain certain essential components:
Those describing how to get out of a bad situation and how to proceed
from there to a good solution
Capturing Patterns – A pattern should help its users to comprehend existing systems,
customize systems to fit user needs, and construct new systems. The process of looking for
patterns to document is called pattern mining. The following guidelines give what exactly
is a pattern.
Careful editing – The pattern authors should have the opportunity to incorporate all
the comments and insights during the shepherding and writers’ workshops before
presenting the patterns in their finished form.
5. Frameworks
A framework is a set of cooperating classes that make up a reusable design for a specific
class of software. A framework provides architectural guidance by partitioning the design
into abstract classes and defining their responsibilities and collaborations. A developer
customizes a framework to a particular application by sub classing the composing
instances of framework classes. The framework captures the design decisions that are
common to its application domain. Frameworks thus emphasize design reuse over code
reuse, though a framework will usually include concrete subclasses we can put to work
immediately. Thus a framework is a way of presenting a generic solution to a problem that
can be applied to all levels in a development. Design and software frameworks are
currently popular.
A seasoned business consultant who has worked on many consulting projects performing
data modeling almost never builds a new data model from scratch. Instead, he will make
use of model fragments that have been developed over time to help new modeling projects
hit the ground running.
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.
This approach is based on the best practices that have proven successful in system
development and more specifically the work done by the stalwarts of OO paradigm. The
UA establishes a unifying and unitary framework around their works by utilizing the UML
to describe, model, and document the software development process. The main idea
behind this UA is to combine the best practices, processes, methodologies, and guidelines
along with UML notations and diagrams for better understanding OO concepts and
systems development. The UA revolves around the following processes
Object-oriented analysis
Object-oriented design
Continuous testing
Component-based development
The UA allows iterative development by allowing to go back and forth between the design
and modeling or analysis phases.
OOA – Analysis is the process of extracting the needs of a system and what the system
must do to satisfy the user requirements. The goal is to understand the domain of the
problem and the system’s responsibilities by understanding how the users or will use the
system. This is accomplishing by constructing several models of the system. The 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.
5. Identify classes
OOD – The UA utilizes Jacobson’s analysis and interaction diagrams, Booch’s object
diagrams and Rumbaugh’s domain model. Further more, by following Jacobson’s life
cycle model, we can produce designs that are traceable across requirements, analysis,
design, coding, and testing. OOD process consists of:
4. User satisfaction and usability tests based on the usage / use cases
Iterative Development and Continuous Testing – We must iterate and reiterate till we
are satisfied with the system. Since testing often uncovers design weaknesses, we need to
repeat the entire process, taking what we have learned and reworking our design or
moving on to reprototyping and retesting. During this iterative process, our prototypes will
be incrementally transformed into the actual application. The UA encourages the
integration of testing plans from day 1 of the project. Usage scenarios can be test scenarios
and use cases will drive the usability testing.
Unified Modeling Language (UML) – The UML merges the best of the notations used
by the three most popular analysis and design methodologies. UML is becoming the
universal for modeling OO systems. It is to express models of many different kinds and
purposes just as a programming language is used in different ways. The UA uses the UML
to describe and model the analysis and design phases of systems development.
Most systems being developed today are two-layered architecture: interface and data. The
three-layered approach consists of a view or user interface, a business layer and an access
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, inventory and invoice
exist. The responsibilities of business layer are: model the objects of the business and how
they interact to accomplish the business processes. These objects should not be responsible
for the following:
2. Data access details – Business objects also should have no special knowledge
of data and its origin. 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.
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 user interface (View) layer – The UI layer consists of objects with which the user
interacts as well as the objects needed to manage or control the interface.
2. 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.
The Access layer contains objects that know how to communicate with the place where
the data actually reside, whether it is a relational database, OODBMS. Regardless of
where the data actually reside, the objectives
1. Translate request – this layer must be able to translate any data-related requests
from the business layer into the appropriate protocol for data access. For example,
if customer number 55552 needs to retrieved, the access layer must be able to
create the correct SQL statement and execute it
2. Translate results – This layer also must be able to translate the data retrieved back
into the appropriate business objects and pass those objects back up into the
business layer.
8. The UA Repository
In modern businesses, best practice sharing is a way to ensure that solutions to process and
organization problems in one part of the business are communicated to other parts where
similar problem occur. Best practice sharing eliminates duplication of problem solving.
For many companies, best practice sharing is institutionalized as part of their constant goal
of quality improvement. Best practice sharing must be applied to application development
if quality and productivity are to be added to component reuse benefits.
The idea promoted here is to create a repository that allows the maximum reuse of
previous experiences, knowledge gathered and previously defined specifications, objects,
principles, practices, processes, procedures, software modules, classes, components,
services, and applications in an easily accessible manner with a completely available and
easily utilized format. Everything from the original user request to maintenance of the
project as it goes to production should be kept in the repository. The advantages of
repositories are many. If we store software objects from our projects implementations for
our clients in the repository, they can be reused for forthcoming projects. Any thing such
as the definition of data element, diagrams symbols, definitions, etc can be stored in the
repository. Thus software development becomes easier, and quicker. If new requirements
emerge, new objects will be design and stored in the main repository for future use. The
repository will be made available and accessible for many. Also there are UML diagrams,
design patterns, frameworks, CASE tools, IDEs etc that also facilitate quicker software
development.
Time Dimension:
• Inception – In the inception phase the scope and rational for the project are
determined. Economic, organizational, political and technical issues are considered.
In determining the scope of the project, all persons/organizations/items that interact
with the system are identified, and the nature of the interactions is determined. At the
end of this phase, the objectives of the project are examined (taking into account the
issues examined during this phase), and a decision is make whether or not to proceed
with the project.
• Elaboration – In the Elaboration Phase, the problem is examined in greater depth, and
issues of what to build, how to build it, and what technologies to use are considered.
The requirement, technical, skill, and political risks are accessed. “Use cases” are used
improve the communication between sponsors and developers, thus reducing the
requirement risks. Technical risks are mitigated by the use of prototypes. The
elaboration stage should result in a list of use case detailing the requirements, and a
domain model that captures the developers understanding of the business.
• Transition Phase – In this phase, the software product is deployed into the user
community. Starting with a Beta release, user feedback is used to identify and fix
problems with the product. After the beta period, a general release of the product is
performed.
Process Dimension:
• Requirements Process – The requirements model is built during this process, in order
to determine what the system should do. Expanded use cases, use case diagrams, flow
of events, and requirement reviews are all tools uses in this process. An expanded use
case identifies the actors involved in the use case, the purpose and type of use case,
lists any cross references with system functions, and describes ( in detail ) how the
system interacts with the relevant actors using a flow of events ( scenario ). The flow
of events in a use case should include information on when and how the use case
starts, what interactions the use case has with the actors, what data is needed by the use
case, the normal sequence of events in the use case and a description of any alternate
flows.
• Analysis Process – The use cases from the requirements process are examined and
used in the creation of a list of candidate classes. In this phase, a conceptual model of
the system is built. A conceptual model may display the classes, the associations that
exist between the classes, and the class attributes. Sequence diagrams and state
transition diagrams can be used to assist in identifying the system’s behavior.
• Design Process – The definitions of the classes ( class diagrams ) and system
architecture are developed during the design process. A project plan is developed that
schedules the iterations for the implementation stage, and identifies/priorities the
major risks.
• Testing Process – The software is tested during this process. Use cases and sequence
diagrams can be useful tools in verifying the system meets the user requirements.
Critique:
The object oriented approach to software development has become extremely popular as
of late. The idea is that using objects allows developers to create a system architecture
that more closely matches the real world situation. Object oriented (OO) also promotes
the concept of reuse, as inheritance can make this an easier task. However much of these
advantages of object oriented development also depend on the skill and inclination of the
developers involved in a project. For example, a developer that is unfamiliar with the OO
methodology could write a OO program that makes little use of inheritance, and reuse.
Similarly a skilled developer could use reuse in a structured project.
In terms of requirements elicitation, I think that Use Cases and Sequence diagrams would
be effective tools in gaining a shared understanding of the system with users. Use Cases
describe actual events that would occur when the users ( actors ) interact with the system.
Sequence diagrams provide a graphical display of these user/system interactions. Since
either technique details events based on the users actual working environment, the users
would be able to provide valuable feedback on whether or not the proposed system will
meet their requirements.
In comparing the object oriented approach to structured analysis and design (as this is the
topic I am presenting), my impression is that the object oriented approach has better tools
for requirements elicitation and confirmation than the traditional structured approach has.
This may be due to the fact that OO is a more recent technique, and thus has been shaped
by current knowledge of the importance of the requirements process. However, the OO
techniques for requirements elicitation ( use cases and sequence diagrams ) could
effectively be used during the requirements stage of a structured project.
Exercises:
Overview Statement: Using the object-oriented approach, develop a POS terminal system
that can be used in retail.
System Functions:
• The system shall allow the cashier to override the price of an item if the manager
enters an override code.
• The system shall allow the cashier to enter the price of an item that does not have a
product code.
• The system shall record the items purchased on a sale, and calculate a total ( including
tax ).
• The system shall print a receipt on a sale, detailing the items purchased and the total.
• The system shall allow the customer to pay by cash, debit card, credit card or check.
• The system shall get authorization for all debit card, credit card or check payments
before proceeding with the sale.
• The system will only allow access to individuals with a valid security code.
A cashier record purchase items and shows the customer the total.
Description
Customer selects payment method and pays
IN UML, the L is for language, one of the definitions of which is “any means of
communicating,” according to the Merriam-Webster Dictionary. That is the single
overriding purpose of UML, or the Unified Modeling Language: to provide a
comprehensive notation for communicating the requirements, architecture,
implementation, deployment, and states of a system.
UML communicates these aspects from the particular perspective of Object Orientation
(OO), in which everything is described in terms of objects: the actions that objects take,
the relationships between the objects, the deployment of the objects, and the way the states
of the objects change in response to external events.
The starting point in this chapter will be an overview of Object-Oriented Analysis and
Design (OOAD), focusing in on the three most important concepts it encompasses—
objects, analysis, design—because to understand UML, you first must understand these
broader concepts. If you’ve programmed with any OO language, then you’re probably
already familiar with a lot of these ideas, so I’ll keep this discussion brief. Besides, a full
discussion of OOAD is beyond the scope of this book. If you want to explore OOAD
further, you should read Booch’s Object-Oriented Analysis and Design with Applications.1
Next, I’ll discuss the results of the OOAD process, namely, a model. I’ll take a bit of a
diversion to discuss the nature of models, how you use them, and why they’re important.
For the rest of the chapter, I’ll be focusing on UML, looking at what it is, and— perhaps
more importantly—what it isn’t. But before I get started into the nitty gritty of all the
different UML elements and diagrams and what the notation looks like (I’ll save that for
the next chapter!), I’ll be showing you some UML diagrams from the case study that I’ll
be developing in detail in the next part of the book. Now these diagrams aren’t there to
scare you off: quite the contrary. When you start to look at some real-world UML, you’ll
see how intuitive it is, and how you can understand much of it without any formal
teaching.
Objects
One reason why objects are a powerful programming technique—the reason most often
touted in the early literature on Object-Oriented Programming— is that programmatic
objects map naturally to real-world objects. Suppose, for example, that your company has
to deal with orders. These orders would probably have an ID number and contain
information on products. You could create Order objects, which would map to these real-
world objects, and which would have properties such as ID and ProductList. You’d
probably want to be able to add a product to the order and to submit the order, so you
could write AddProduct and SubmitOrder methods. This mapping between objects in
the real world and more abstract code objects encourages programmers to think in the
problem domain, rather than in computer science terms. This benefit has perhaps been
overstated, however; unless you’re building a simulator of a real-world process, such
surrogate “real-world” objects form just the surface of your system. The complexity of
your design lies underneath that surface, in code that reflects business rules, resource
allocation, algorithms, and other computer science concerns. If you only use objects to
reflect the real world, you leave yourself with a lot of work.
A more important benefit of classes and objects is that they form a nice syntactic
mechanism for achieving some classic aspects of well-designed code:2
Loose coupling. Coupling refers to the ways in which and degrees to which one part of
the system relies on the details of another part. The tighter the coupling, the more changes
in one part of the system will ripple throughout the system. With loose coupling, the
interfaces between subsystems are well defined and restricted. What lies beyond those
interfaces can change without any changes needed in the client sub systems. Object-
Oriented Programming supports loose coupling by allowing you to define and publish a
class’s methods without publishing how those methods are carried out. This principle goes
even further in OO languages that support interfaces (described later in this section).
Strong cohesion. Cohesion refers to the degree in which elements within a subsystem
form a single, unified concept, with no excess elements. Where there is high cohesion,
there is easier comprehension and thus more reliable code. Object-Oriented Programming
supports strong cohesion by allowing you to design classes in which the data and the
functions that operate on them are tightly bound together.
Does OO force you to have these quality attributes in your code? I wish! No matter the
language, you can write shoddy code with no encapsulation, pathological coupling, and no
cohesion. Furthermore, some OO languages are less rigid than others in how much they
require you to design around objects. But OO languages certainly support these quality
attributes if you take the time to pursue them.
Classes. A class is the definition of the behavior and properties of one or more objects
within your system. A class binds the data (attributes) of an object to the behavior
(operations) that it can perform.
Attributes. An attribute is a data value or state that describes an object and helps you to
tell one object from another of the same class. It seems that every new OO language
author feels the need to distinguish their language by coming up with new terminology. In
some OO languages, these data values are called properties or member variables or
member data; but in UML, the proper term is attributes.
Objects. An object is an instance or specific example of a class. If Dog is the class, then
Betsy, Ladi, Patches, Jake, Radar, and Frosty are specific instances of the class found in
my house. The attributes of the class have specific values within an object of that class;
and the operations of a class operate on the attributes of individual objects.
Inheritance. This concept indicates that one class (the superclass) provides some common
or general behavior inherited by one or more specific classes (the subclasses). The
subclasses then provide more or different behavior beyond that defined in the superclass.
For example, besides the Dogs, I have Cat objects and Horse objects that live on my
property. Each class has unique behaviors: Dogs must be walked, Cats use the litter box,
and Horses drop manure that must be scooped up and thrown in the manure pile. Yet all
classes have some common behavior: they must be fed, and they must have vet visits. So I
can define a superclass, Pet, and have my subclasses, Dog, Cat, and Horse, derive their
shared behavior from the Pet class. In UML, this concept is known under the slightly
different term of generalization, in which a superclass provides the generalized behavior
of the subclasses. It’s really the same concept, but just looking at it the other way up.
Each of these concepts will be explored in more detail as I discuss the UML diagrams that
represent them.
In software development, analysis is the process of studying and defining the problem to
be resolved. (We all define the problem before we start solving it, right? Right? Oh,
please, somebody say “Right!” We can’t all be that screwed up, can we?) It involves
discovering the requirements that the system must perform, the underlying assumptions
with which it must fit, and the criteria by which it will be judged a success or failure.
Object-Oriented Analysis (OOA), then, is the process of defining the problem in terms of
objects: real-world objects with which the system must interact, and candidate software
objects used to explore various solution alternatives. The natural fit of programming
objects to real-world objects has a big impact here: you can define all of your real-world
objects in terms of their classes, attributes, and operations.
Design
If analysis means defining the problem, then design is the process of defining the solution.
It involves defining the ways in which the system satisfies each of the requirements
identified during analysis.
Models
Did you ever build a model ship? When I was young, my mom and I built a model of the
famous clipper ship Cutty Sark.3 I’ve always been fascinated by the tall ships of old; but I
really learned about how they work when we built that model. All of the strange nautical
terminology from the old pirate movies—forecastle, capstan, main mast, and especially
belaying pins (“You mean they’re not just there so somebody can pull one out and swing it
as a club?”) — gained concrete meaning when I assembled them and saw them in the
context of the entire system.
Well, that’s a central goal of using UML in OOAD: to let you study and understand a
system via a model of that system. Like aerodynamic engineers, construction architects,
and others in the physical engineering world, you’ll build models of systems yet to be
built, not just models of existing systems. Your models will let you explore design
alternatives and test your understanding of the system at a much faster rate and much
lower cost than the rate and cost associated with actually building the system.
“But wait a minute!” the skeptic in the crowd shouts. “I can see the Cutty Sark, if I travel
to London. And I can see the model Cutty Sark, if I visit your home. I can look at the two,
and see how the model relates to the real thing. But I can’t ‘look at’ software, except at its
user interface. So your model looks like the UI? Isn’t that just a prototype?” That’s the
problem with the usual engineering model analogy as applied to software models: there’s
no direct physical correspondence between the model and the final product. A better
analogy is to models in less tangible scientific disciplines. Quantum physics is a good
example of a field in which models help you to understand things you can’t see: no one
can see quarks or leptons or hadrons or any of the many subatomic particles; and attributes
like charm and strangeness have only metaphorical meaning. The models of quantum
physics aren’t literally true, yet they’re very useful in understanding physical phenomena.
Software models are like that: useful metaphors and abstractions to help you think about a
problem and a solution, not literal depictions of the code itself.
In the case of OOAD with UML, your models consist primarily of diagrams: static
diagrams that depict the structure of the system, and dynamic diagrams that depict the
behavior of the system. With the dynamic diagrams, you can trace through the behavior
and analyze how various scenarios play out. With the static diagrams, you can ensure that
each component or class has access to the interfaces and information that it needs to carry
out its responsibilities. And it’s very easy to make changes in these models: adding or
moving or deleting a line takes moments; and reviewing the change in a diagram takes
minutes. Contrast that with actually building the code: hours to implement the change,
hours more to test and review it.
To use UML effectively, you should never be simply drawing pretty pictures; you should
always be editing an underlying model, using the pretty pictures as your user interface.
Your core artifact of the OOAD process is the model. In fact, you will likely have multiple
models:
• Analysis Model. This is a model of the existing system, the end user’s
requirements, and a high-level understanding of a possible solution to those
requirements.
Depending on your development process, you may have even more models: a Business
Model, a Domain Model, possibly others. The major benefit of models is that you can
make model changes far earlier in the development cycle than you can make code changes,
and far easier. And because you can make changes early, you can make your mistakes
early. And that’s a good thing, because early detection and correction is cheap detection
and correction. Modeling will let you catch your most costly bugs early; and early
detection and correction can save you a factor of 50 to 200 on the cost and schedule of a
bug fix.4
Although software engineering literature is rife with research that demonstrates that the
cost to fix a defect rises catastrophically over time, those in the Extreme Programming
camp disagree. They argue that all such research is dated, and that modern development
tools and techniques allow a maximum limit to the cost of change.5 They see not an
exponential growth, but an asymptotic approach, as shown in Figure 1-1.
• First, their theory is a prediction, not a guarantee: if you apply the techniques they
advocate and if you do everything correctly and if you are working in the right sort
of environment on the right sort of project, then the lessons of 30 years of software
engineering will allow you to attain the asymptotic curve. Good for you, if you can
do that; but the exponential curve is the default behavior. (Furthermore, I would
argue that modeling is a useful tool for attaining that asymptotic curve.)
• Second, look at those curves. Do you want to argue over which curve is “right” at
the 8-weeks mark? Or would you rather just fix the problem at the 1-week mark?
(Beck argues that there is benefit in waiting for the latest possible time, so that you
have the maximum information when you make the fix and also so that you don’t
waste time fixing problems that never really arise; but his actual example shows
the benefits of making a change as soon as you are aware of it. These concerns
aren’t incompatible.)
Modeling has another benefit, one I call The Outline Effect. Back in high school, I never
needed study habits: I liked to read, and I liked to learn, so school came easy to me at my
small rural high school. Then I went to a Big Ten university, and reality came crashing in
on me. I didn’t understand that learning at that level was supposed to be work, a job you
tackled in a systematic fashion with specific goals and strategies. My “strategy” was sort
of like code-and-fix: just tackle whatever came along, and hope it all worked out. It didn’t,
and I didn’t understand why. Every night, I sat in my room, reading the textbooks . . until
something distracted me, which happened far too often. Meanwhile, every night, a friend
sat in his room across the hall, outlining the textbooks. And surprise—he had a much
better GPA than I did.
It took me years to appreciate my friend’s study skills. The process of outlining the text
forced him to focus: he had a concrete goal in mind, and wouldn’t allow distractions until
he finished it. Furthermore, the outlining involved more of his brain: in order to produce
an outline of the textbook, he first had to comprehend the textbook; and then to actually
write the outline in his own words, he had to involve yet more areas of his brain, as he had
to formulate what he wanted to write. Heck, he even had to involve his tactile and motor
areas of his brain in order to write the words. He had a much more fully involved brain,
and thus he much more fully understood the material.
This is a benefit you can gain from modeling: by listening and talking and reading and by
then translating what you learn into a model, you learn it more thoroughly. This is even
more important in system design than in studying from a textbook: in a textbook, you
expect that the text will be more or less consistent, and that any seeming inconsistency is
most likely a sign of something you misunderstood; but in requirements gathering,
contradiction and inconsistency are inevitable parts of the process. By modeling the
requirements, you may highlight the inconsistencies, particularly when you gather details
from many different parts of a specification and put them together in the same diagram.
And there’s one more modeling benefit, one I believe I may have mentioned earlier:
communication. It’s easier to communicate with models than with text, or even with code;
and you can communicate with a wider audience with models than with other forms of
expression. Once you’ve created a diagram “in your own words,” I can more easily
comprehend how you comprehend things by comparing your diagram with what I
comprehend.
UML, the Unified Modeling Language, is a graphical language designed to capture the
artifacts of an OOAD process. It provides a comprehensive notation for communicating
the requirements, behavior, architecture, and realization of an Object-Oriented design. As
you saw in the last section, UML provides you with a way to create and document a model
of a system.
To answer that, you need to jump in the WayBack Machine and travel back to the ancient
history of OOAD—say, 1995. At that time, Object-Oriented Programming had proven its
worth as a way of building applications and systems; and the hot new topics in the OO
world were OOA and OOD. Since these topics were larger in scope than mere
programming, the practitioners needed a way of displaying large, complex concepts in a
simple graphical fashion. A number of competing OO notations emerged, chief among
them being the Booch Notation designed by Grady Booch and the Object Modeling
Technique (OMT) designed by James Rumbaugh (and others). And then began the
religious wars: fanatical adherents of the competing notations fought petty little battles
over clouds (Booch’s symbol for a class) versus rectangles (OMT’s symbol for a class).
Booch and Rumbaugh looked on this confusion with dismay: they saw the differences
between their notations as minor, unworthy of so much rancor. And worse, they saw the
religious wars detracting from what they felt should be the new focus: the OOAD process
itself, particularly as a means for capturing requirements and behavior. They were very
impressed by some of Ivar Jacobson’s work on Sequence Diagrams and his Objectory
methodology; but with all the shouting about notation, no one was talking about process.
So Booch and Rumbaugh and Jacobson (the Three Amigos) went on retreat to hammer out
differences in their notations in private, and to adopt other useful notations as well (chief
among these being David Harel’s State Diagram notation). They emerged with the Unified
Modeling Language 0.8, a response to the Object Management Group’s call for a standard
object modeling notation; and Booch’s company, Rational6 (which had hired Rumbaugh
and Jacobson) incorporated UML into Rational ROSE, their OOAD tool. The UML then
went through a few cycles of response and revision by the OO community; and UML 1.1
was adopted as a standard by the OMG in 1997. UML has been further refined, and is
currently at version 1.4, with version 2.0 on the near horizon.
With so much in UML, it’s worth mentioning what’s not UML. The following sections
describe some related concepts that are often confused with UML itself.
A Process
Remember the goal of the Three Amigos: to focus attention on the OOAD process, not on
the notation. Their notation isn’t a process in itself; rather, it’s designed to support a wide
range of OO processes. There are a number of UML-based OOAD processes, including
Fowler’s outline process,7 controlled iteration,8 Texel and Williams’s complete OO
process,9 and, of course, the Unified Process (formerly Objectory) from the Three
Amigos.10 A full list would be much longer, but would have a lot in common with these
prominent examples. These processes differ somewhat in the degree of formality and the
order of operations; but all involve using UML to identify and refine requirements,
allocate those requirements to functional modules, and refine those modules. Without a
process, new UML students are often adrift in a sea of concepts, with nothing to guide
their course.
In this book, you’ll learn UML within the framework of Five-Step UML, which I find to
be a “just enough” process: just enough process to help you understand the purpose of
UML, but not so much as to bury you in paperwork and obscure the benefits of UML.
Five-Step UML isn’t a large, full-featured OOAD process, falling somewhere between an
academic exercise and Ambler’s Agile Modeling.11 Still, I find that some particularly
process-averse teams that tend to reject a more formal process will accept Five-Step UML.
In the next chapter, I’ll show you how the Five-Step process works, and along the way,
you should pick up a broad working knowledge of UML. In Chapter 3, I’ll talk about
some pragmatic rules I like to apply to the Five-Step (and indeed any other) modeling
process. Throughout the core chapters of this book (Part Two), we’ll work through each of
the five steps in more detail, applying it to a real-world case study. Although the focus of
this book is on Five-Step UML, we will look in more detail at some other processes and
how they work in Chapter 12.
Many UML practitioners—and of course, many UML tool vendors—tend to blur the line
between UML and a given tool. I myself am prone to equating “what XDE can do” with
“what UML can do,” since I do most of my UML work with Rational’s XDE tool. This
habit isn’t inherently bad, since it’s usually easier to work with your tools than against
them; but it’s important to realize that the features and capabilities of any given tool—
even the market-leading UML tool from the people who gave us UML—may differ from
the features and capabilities of UML itself. If UML is a language, then every tool speaks
with a unique accent.
A Silver Bullet
Good code will still require blood, sweat, tears, pizza, good management, and lots of
thought. UML will help you to organize these factors (except the pizza), but you won’t be
able to avoid them.
UML consists of nine different diagram types, each focused on a different way to analyze
and define the system. These diagrams are summarized briefly here:
• Use Case Diagrams show the externally visible behavior of the system. You’ll see
these in the next chapter (Chapter 2) and later on when we look at Step 1 of Five-
Step UML in Chapter 6.
• Activity Diagrams show an elaboration of the behavior of the system. You’ll see
these in the next chapter, and use them during Step 2 of Five- Step UML in
Chapter 7. A recent addition to UML is the division of Activity Diagrams into
swimlanes, which you’ll see in the next chapter, and we’ll use during Step 3 of
Five-Step UML in Chapter 8.
• Component Diagrams show architecture of the system. You’ll see these in the
next chapter, and we’ll use them during Step 4 of Five-Step UML in Chapter 9.
• Sequence Diagrams show object interactions over time. We don’t use these
diagrams as part of Five-Step UML, but we’ll look at them in Chapter 13.
• Class Diagrams show class definition and relations. You’ll see these in the next
chapter, and we’ll use them during Step 5 of Five-Step UML in Chapter 10.
• Deployment Diagrams show physical architecture of the system. We’ll use these
in Chapter 11.
• Package Diagrams show the hierarchical structure of your design. These can be
useful for organizing many different types of elements and you’ll be seeing this
type of diagram often throughout the book.
I have a secret. You know those different UML diagram types? Does it annoy you just a
bit, having to learn so many new notations to use UML? Does it make you feel like
skipping OOAD and just jumping into code?
Well, it’s true that making good UML diagrams takes some skill and some practice; but
reading well-crafted diagrams is a very different matter. Just between you and me, I’ll bet
you already know how to read UML diagrams, and you don’t even know it. For the rest of
this chapter, I’m going to show you some examples of the different UML diagrams, and
ask you a few simple questions about what it is they are saying. Don’t worry if you can’t
follow all of the notation at this stage—or indeed if you find the questions too simplistic—
the point of the following exercises is simply to show you how straightforward it is to read
UML diagrams, and how you’ll be able to answer questions about them right away. You
won’t be an expert by any measure—that comes in later chapters—but you’ll be able to
understand the information contained in the diagrams.
The exercises and examples in this book all derive from the Kennel Management System
(KMS) for Sandy’s Pets, a high-tech kennel providing temporary and long-term care for
cats, dogs, birds, and exotic pets. The Kennel Management System must provide familiar
features tailored to the pet care domain:
• Reservations and occupancy. Like a good hotel, the KMS must allow pet owners
to reserve kennel space (i.e., “pens”) and to check pets in and out. Unlike a hotel, a
significant fraction of the occupants reside in the kennel long term or even full
time.
• Exercise and grooming schedule. Like a good physical therapy clinic, the KMS
must support and maintain exercise and grooming schedules for each resident.
Unlike a clinic, these schedules are dictated by the pet owner rather than by a
physician or therapist.
• Nutrition and dietetics. Like a good health spa, the KMS must support both
standard and customized diets for each resident. Unlike a health spa, some of the
residents only eat live food.
• Inventory and ordering. Like a good restaurant, the KMS must keep food (and
other supplies) on hand to meet the needs of a varied clientele. Unlike most
restaurants (and as noted previously), some of the food must be stored live.
• Surveillance and tracking. Like a good day care center, the KMS must ensure
that its residents are safe and secure, including allowing the pet owners to view
their pets via Web cams. Unlike day care centers, each resident will be equipped
with a computerized collar or tag, which will allow sensors in the kennel to locate
and check the status of each pet.
• Health care and medication. Like a good health care management system, the
KMS must schedule regular and emergency medical visits, maintain a medical
history, and manage dispensing of medications. Unlike typical health care systems,
the residents come from a wide variety of species and thus need species-specific
medications and treatment programs.
• Customer relations and pedigrees. Like a good contact management system, the
KMS must track information about residents past, present, and possibly future.
Unlike typical contact management systems, the KMS must maintain information
about both a pet’s parentage and future breeding plans.
The KMS must also provide basic human resources, accounting, and administration
functions. For a more detailed specification of the Kennel Management System, see
Appendix A.
A Use Case Diagram depicts actions by people and systems outside your system, along
with what your system does in response. It’s useful for depicting the functional
requirements of your system. Figure 1-2 shows an example of a simple Use Case Diagram
for the Kennel Management System.
1. What does the KMS do when the care giver checks a pet in?
2. What does the KMS do when the care giver checks a pet out?
3. What action or actions by the care giver will cause the KMS to update a kennel
assignment?
4. What action or actions by the Care Giver will involve the Veterinarian?
Activity Diagrams
An Activity Diagram depicts the detailed behavior inside a single functional requirement,
including a primary scenario and a number of alternate scenarios. It’s useful for ensuring
that you thoroughly understand a given functionality. Figure 1-3 presents an Activity
Diagram for the one functional requirement of the Kennel Management System for
Sandy’s Pets.
1. What is the sequence of steps the system performs when assigning a pen to a pet
that has visited previously?
2. What additional steps are performed for a pet that is new to the kennel?
1. The Care Giver Center is the Web page that the care giver uses to enter
information about a pet. What interface does it use to provide data to the KMS?
2. What other components provide data to the KMS, and through what interfaces?
3. What types of contacts can be made through the Comm Center component?
Sequence Diagrams
A Sequence Diagram depicts the detailed behavior over time within one path or scenario
of a single functional requirement. It’s useful for understanding the flow of messages
between elements of your system. Figure 1-5 presents an example of a Sequence Diagram
for the Kennel Management System.
2. Which actors outside the system are involved in creating a vet record?
3. What interface does the Vet Record Page use for creating a vet record?
Class Diagrams
A Class Diagram depicts the classes and interfaces within the design of your system, as
well as the relations between them. It’s useful for defining the internal, Object-Oriented
structure of your code. Figure 1-6 presents an example Class Diagram from the Kennel
Management System.
1. What three classes are associated with the Kennel Assignment class?
A State chart Diagram depicts how the state of your system changes in response to internal
and external events. It’s useful for ensuring that each event is handled properly no matter
what state your system may be in. Figure 1-7 presents an example of a State chart
Diagram from the Kennel Management System. This diagram illustrates events involving
the availability of kennel spaces.
1. What event causes a kennel space, or pen, to enter the Defined state?
2. What events (from which states) cause a pen to enter the Available state?
3. What state does a pen enter when it’s currently in the Available state, and a
Dismantled event occurs?
4. How can a pen go from the In Use state to the Deconstructed state?
Deployment Diagrams
and as a means for studying the load across your system. Figure 1-8 presents a simple
example of a Deployment Diagram for the Kennel Management System.
3. How does the owner’s PC access pet information on the KMS server?
4. How does information go from the care giver station to the reception station?
A Package Diagram depicts how related elements of your design are grouped together, as
well as how the groups depend upon each other. It’s useful for dividing a complex design
into multiple, more manageable smaller designs. Figure 1-9 presents an example of a
Package Diagram from the Kennel Management System.
1. Which packages make use of information from the KMS Interfaces package?
2. Which packages does the KMS Central Classes package make use of?
In UML, the dependency arrows (- - - - >) indicate the direction of knowledge and control.
To those people familiar with ERDs and DFDs, this seems exactly backwards. Their
instinct is to interpret Figure 1-9 as meaning that KMS Interfaces make use of Care Giver
Classes, Accounting Classes, Reservation Classes, and KMS Central Classes.
The UML convention isn’t quite as backwards as it seems. How would a class in Care
Giver Classes make use of an interface in KMS Interfaces? By calling its methods, of
course. And very likely, the class would pass data to the interface as well. So control and
even some data do indeed flow in the direction of the dependency arrow.
And if that doesn’t help you to keep the meaning of the arrows straight, I can only
apologize, and claim innocence: I didn’t write the UML (though its convention seems
“correct” in my biased perspective). I do know that this is a source of confusion for ERD
and DFD practitioners; and I hope that this warning will help to minimize your confusion.
Introduction
There are a bewildering array of software applications and types. Primarily software is
classified into two: system and application software. A typical system software mainly
interacts with the computer, its components and peripherals such as printer, webcam,
scanner, mouse, USB drive etc besides with all the network infrastructure solutions such
as routers, switches, bridges, hubs, gateways, etc. The application software generally
interacts with the system software. The details are as follows.
1. Software Types
• Involves concurrent operation that requires scheduling, slicing, time & resource
sharing, and sophisticated process management
Middleware is an emerging software type that sits in between application and system
software facilitating smooth interaction, collaboration, communication, integration,
connectivity, and adaptation purposes.
Real-time Software represents programs that monitor / analyze / control real world events
as they occur. Elements of real-time software include a data gathering component that
Engineering and scientific software has been all along characterized primarily by
number crunching algorithms. Applications range from astronomy to volcanology, from
automotive stress analysis to space shuttle orbital dynamics, and from molecular biology
to automated manufacturing. These are processing-intensive applications.
Embedded software is becoming hugely popular these days. They are found in consumer
electronics, avionics, handhelds, wearables, portables, mobiles, automobiles, smart homes,
and manufacturing industries. Embedded software resides in real-only memory and is used
to control products and systems for the consumer and industrial markets. Embedded
software can perform very limited and esoteric functions such as key pad control for a
microwave oven or provide significant function and control capabilities (e.g., digital
functions in an automobile such as fuel control, dashboard displays, braking systems etc.).
There are many application software applications such as web-based, wireless, desktop,
financial, enterprise, logistics, retail, energy, governmental, healthcare and other business
software applications. Business software represents the discrete systems such as
enterprise resource planning (ERP), supply chain management (SCM), customer
relationship management (CRM), inventory, knowledge, and content management. Most
of the business software are data intensive and data-processing applications.
Similarly there are promising methods, technologies, strategies, tools, infrastructures, and
resources. Thus an appropriate software development process model has to be strictly
chosen based on the nature of the final software system to be built. In this chapter, we are
to see the well-known development process models.
2.1 The Linear Sequential Developmental Model for software engineering is called the
classic life cycle or the waterfall model. This model suggests a systematic, sequential
approach to software development that begins at the system level and progresses through
analysis, design, coding, testing and maintenance. Modeled after the conventional
engineering cycle, the linear sequential model encompasses the following activities:
• Code generation – The design must be translated into a machine readable form.
• Testing – Once code has been generated, program testing begins. The testing
process focuses on the logical internals of the software, assuring that all statements
have been tested and on the functional externals – that is, conducting tests to
uncover errors and ensure that defined input will produce actual results that agree
with required results.
The Prototyping Model – The prototyping paradigm begins with requirements gathering.
Developer and customer meet and define the overall objectives for the software, identify
whatever requirements are known, and outline areas where further definition is mandatory.
A quick design then occurs. The quick design focuses on a representation of those aspects
of the software that will be visible to the customer / user. The quick design leads to the
construction of a prototype. The prototype is evaluated by the customer / user and is used
to refine requirements for the software to be developed. Iteration occurs as the prototype is
tuned to satisfy the needs of the customer, at the same time enabling the developer to
better understand what needs to be done.
• Data modeling – the information flow defined as part of the business modeling
phase is refined into a set of data objects that are needed to support the business.
The characteristics (attributes) of each object are identified and the relationships
between these objects are defined.
AVCCE, Dept. of MCA – III Semester 89
CA 5202 – Object Oriented Analysis and Design
• Process modeling – the data objects defined in the data modeling phase are
transformed to achieve the information flow necessary to implement a business
function. Processing descriptions are created for adding, modifying, deleting, or
retrieving a data object
• Testing and turnover – Since the RAD process emphasizes reuse, many of the
program components have already been testing.
2.2 Evolutionary Software Process Models – There is growing recognition that software,
like all complex systems, evolves over a period of time. Thus a few interesting
evolutionary models have emerged. Below a brief of each is supplied.
The Incremental model combines elements of the linear sequential model with the
iterative philosophy of prototyping. Each linear sequence produces a deliverable increment
of the software. For example, word-processing software developed using the incremental
paradigm might deliver basic file management, editing, and document production
functions in the first increment; more sophisticated editing and document production
capabilities in the second increment; spelling and grammar checking in the third
increment; and advanced page layout capability in the fourth increment. Thus when an
incremental model is used, the first increment is often a core product. That is, basic
requirements are addressed but many supplementary features remain undelivered. The
core product might be used by the customer or be subjected for detailed review. As a result
of use and / or evaluation, a plan is being developed for the next increment. The plan
addresses the modification of the core product to better meet the needs of the customer and
the delivery of additional features and functionality. This process gets repeated following
the delivery of each increment, until the complete product is produced. The iterative
process, like prototyping and other evolutionary approaches, is iterative in nature.
The Spiral Model is an evolutionary software process model that couples the iterative
nature of prototyping with the controlled and systematic aspects of the linear sequential
model. In this spiral model, software is developed in a series of incremental releases.
During early iterations, increasingly more complete versions of the engineered system are
produced. The spiral model is divided into a number of task regions.
2. planning – tasks required to define resources, timelines, and other project related
information
3. risk analysis – tasks required to assess both technical and management risks
5. construction & release – tasks required to construct, test, install and provide user
support
Each of the six regions is populated by a series of subtasks that are adapted according to
the characteristics of the project to be undertaken. The spiral model is a realistic approach
to the development of large scale systems and software.
Thus far, we have seen both old and new process models for generic software engineering.
Sometimes the process is being termed as software development life cycle (SDLC). There
are several techniques for simplifying each phase of this development process. Traditional
approaches such as functional / procedure –oriented and structured methods (Structured
analysis, design and implementation) C is the primary structured programming language.
In the recent past, OO paradigm (OO analysis, design, programming, and testing) have
emerged in the software market. Due to its soaring popularity and acceptance among the
professionals as well as the customers, it has become the dominant paradigm as far as the
task of engineering software for various personal, business as well as system domains.
Equally OO paradigm is being strengthened and supported by the grand arrival of a host of
OO programming languages such as C++, Java, C#, VB.NET etc.
concept induced many to come out with an increasing array of OO technologies, methods,
models, and approaches. The interesting aspect of OO method includes realizing of
reusability. This reuse of program components leads to faster software development of
bug-free, quality-conscious, reusable, scalable, secure and flexible software applications.
Also OO software is easy to conceptualize, develop, deploy, manage, handle, use, and
maintain for analysts, architects, developers, administrators, and end users.
Building High-Quality Software - The software process transforms the users’ needs via
the application domain to a formidable software service / solution / product that satisfies
that sincerely satisfies those needs. Once the software is build, it is mandatory to check
whether the built software is free of errors, bugs, risks, dangers, defects and infirmities
besides it accomplishes all the core requirements, intentions and expectations of the users.
Thus customer satisfaction and delight is the main and focused target for software services
and solutions providers. There are two basic approaches for testing software systems. That
is, we can test a system according to how it has been built or what it should do. There are
four quality measures for evaluating a system: 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.
Validation is the task of predicting correspondence. True correspondence cannot be
determined until the system is fully built. Correctness measures the consistency of the
product requirements with respect to the design specification. Verification is the exercise
of determining correctness.
Correctness always is objective. That is, given a specification and a product, it should be
possible to determine if the product precisely satisfies the requirements of the
specification. Validation is always subjective. That is, it checks the appropriateness of the
specification itself. In hindsight, verification checks whether we build the product right
whereas the validation evaluates whether we build the right product. Validation begins as
soon as the project starts, but verification can begin only after a specification has been
accepted. Thus realizing high-quality software is ensured through these checks. OO
system development technologies, methodologies, strategies, tools, infrastructures and
resources are guaranteeing high-quality software. In the following, we are to discuss in
detail all about the OO software development.
2. OO Design
3. Prototyping
4. Component-based Development
5. Incremental Testing
Thus gathering system requirements in the form of use cases, studying, analyzing,
prioritizing, organizing, cataloguing, and documenting them for future references,
estimating risks, identifying the relevant classes, and establishing the plausible
relationships between the objects of those classes are some of the important activities of
the OO analysis phase.
3.2 The goal of Object-Oriented Design (OOD) phase is to design the classes identified
during the earlier phase and the user interface. Identifying and defining additional objects
and classes that support implementation of the requirements are the other important tasks
in this very crucial and critical phase. If the design is right, the product or the system to be
built would be right. During interface design, there will be a need for thinking about
incorporating additional objects. The activities of the design phase are summarized as
follows
Thus designing and refining the class and object structures, components and their
collaborations are the leading activities of the design phase.
In the picture drawn using IBM Rational tool, there are two classes (Shape and Controller)
and two subclasses (Rectangle and Circle) of Shape class. Each class has its own attributes
and methods as indicated in the class diagram.
3.3 Prototyping – It is gaining momentum to construct a prototype of the some of the key
system components before embarking on full-fledged system development. As often told
that a picture is worth a thousand words, a prototype is worth a thousand pictures. 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 to fully understand how
easy or difficult to implement certain aspects in the final commercial version. Also we can
understand what novel features need to be added or what sorts of risks are involved in
system development. A prototype is to tell an overall view of the system under
development. A prototype would clearly tell what sort of changes the developer has to
make, what sort of software toolkits, languages, and technologies need to be used etc.
Thus the benefits accrued out of prototyping are manifold including rescuing the project
from going down. The navigability, usability, and usefulness of user interfaces can be
enhanced with this prototyping. There are many commonly accepted prototypes as
follows.
3. An analysis prototype is an aid for exploring the problem domain. This class of
prototypes is used to inform the user and demonstrate the proof of a concept.
Thus prototyping is turning out to be a useful exercise at almost any stage of the
development.
Legacy applications coded using old technologies such as COBOL are made interoperable
with the modern applications using concepts such as wrapper, helper software suite etc.
Thus off-the-shelf components, wrappers, classes and other software modules are
encouraging the component-based development. The software components are the
functional units of a program and building blocks for offering a collection of core,
customized, and personalized services. Thus CBD is emerging as the hot cake for the
developers to develop next-generation software applications using the time-tested, quality-
conscious, refined, and highly reusable software components.
3.5 Rapid Application Development (RAD) is a set of software tools such as Delphi,
Visual Basic, VisualAge, or PowerBuilder and viable techniques that can be used to build
an application faster than typically possible with traditional methods. RAD is often
associated with development of software in quick time. The main objective of RAD is to
build a version of an application quickly to see whether the architects have understood the
system requirements correctly and the developers are moving in the right direction.
Further it determines whether the system does what it is expected to do. Thus RAD is an
interesting move in order to visualize what is to come and if there is any deviation, it can
be corrected in time.
3.6 Incremental testing – In the olden days, after fully completing the system or product
only, the testing team will come into picture. This will waste a lot of time and dollars and
hence in order to reduce the project completion time, testing is introduced at the earlier
stage. That is, when a small building block (a testable class or software module), it is sent
to testing department for thorough and comprehensive testing.
UNIT - 5
In a robust system,
We need to test each component / object. We also should examine collective behaviors to
ensure maximum operational reliability. Although programming techniques have
improved immensely since the early years, the process of finding and correcting errors in
programming is still difficult, complicated and complex. Debugging is the process of
finding out where something went wrong and correcting the code to eliminate the errors or
bugs that cause unexpected results. Precisely speaking, the elimination of the syntactical
bug is the process of debugging whereas the detection and elimination of the logical bug.
The logical bugs are extremely subtle and may need a great deal of effort to eliminate
them.
One reason why quality assurance is needed is because computers are infamous for doing
what we tell them to do, not necessarily what we want them to do. To close this gap, the
code must be free of errors or bugs that cause unexpected results. For example, if an
incorrect result was produced at the end of a long series of computations, perhaps we
forgot to assign the correct value to a variable, chose the wrong operator, or used an
incorrect formula.
2. Run-time errors occur and are detected as the program is running, when a
statement attempts an operation that is impossible to carry out. For example, if the
program tries to access a nonexistent object say a file, a run-time error will occur
3. Logic errors occur when code does not perform the way we intended. The code
might be syntactically valid and run without performing any invalid operations and
yet produce incorrect results. Logic errors produce run-time errors
Quality assurance testing can be divided into two major categories: error-based testing and
scenario-based testing. Error-based testing techniques search a given class’s method for
particular clues of interests, then describe how these cues should be tested. For example,
we want to test the payrollComputation method of an Employee class:
anEmployee.computePayroll (hours). To test this method, we must try different values for
hours (say 40, 0, 100, -10) to see if the program can handle them (this is also called as the
testing the boundary conditions). The method must be able to handle any value; if not, the
error must be recorded and reported. Similarly, the technique can be used to perform
integration testing by testing the object that processes a message and not the object that
sends the message.
Scenario-based testing, also called usage-based testing, concentrates on 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. Scenario-based tests tend to exercise multiple subsystems in a single test, because
that is what users do.
Testing Strategies
The extent of testing a system is controlled by many factors, such as the risks involved,
limitations on resources, and deadlines. The testing strategy within the constraints has to
use a combination of these: black box testing, white box testing, top-down testing and
bottom-up testing.
Black Box testing – 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. 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 made the system
In black box testing, we try various inputs and examine the resulting output. We can learn
what the box does but nothing about how this conversion is implemented. 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 we already have tested all objects of an application and all external or public
methods of an object that we believe to be of greater importance. In white box testing, we
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, is to check each path in an object’s
method. 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.
Branch testing coverage – The main idea behind this testing is to perform enough tests to
ensure that every branch alternative has been executed at least once under some test.
Top-down testing assumes that the main logic or object interactions and system 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 approach can test the navigation through screens and verify that it
matches the requirements. Users can also see at an early stage, how the final application
will look and feel. This approach is for scenario-based testing. This testing is useful for
testing subsystems and systems integration.
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 we test each object, then combine them and test their interaction and the messages
passed among objects by utilizing the top-down approach.
UML Tutorial
Goals of UML
As the strategic value of software increases for many companies, the industry looks for
techniques to automate the production of software and to improve quality and reduce cost
Each UML diagram is designed to let developers and customers view a software system
from a different perspective and in varying degrees of abstraction. UML diagrams
commonly created in visual modeling tools include:1
Use Case Diagram displays the relationship among actors and use cases.1
Class Diagram models class structure and contents using design elements such as classes,
packages and objects. It also displays relationships such as containment, inheritance,
associations and others. 1
Interaction Diagrams
• Sequence Diagram displays the time sequence of the objects participating in the
interaction. This consists of the vertical dimension (time) and horizontal dimension
(different objects).1
State Diagram displays the sequences of states that an object of an interaction goes
through during its life in response to received stimuli, together with its responses and
actions.1
Activity Diagram displays a special state diagram where most of the states are action
states and most of the transitions are triggered by completion of the actions in the source
states. This diagram focuses on flows driven by internal processing.1
Physical Diagrams
A use case is a set of scenarios that describing an interaction between a user and a system.
A use case diagram displays the relationship among actors and use cases. The two main
components of a use case diagram are use cases and actors.
An actor is represents a user or another system that will interact with the system you are
modeling. A use case is an external view of the system that represents some action the
user might perform in order to complete a task.
Use cases are used in almost every project. The are helpful in exposing requirements and
planning the project. During the initial stage of a project most use cases should be defined,
but as the project continues more might become visible.
Use cases are a relatively easy UML diagram to draw, but this is a very simplified
example. This example is only meant as an introduction to the UML and use cases. If
you would like to learn more see the Resources page for more detailed resources on UML.
Start by listing a sequence of steps a user might take in order to complete an action. For
example a user placing an order with a sales company might follow these steps.
This example shows the customer as a actor because the customer is using the ordering
system. The diagram takes the simple steps listed above and shows them as actions the
customer might perform. The salesperson could also be included in this use case diagram
because the salesperson is also interacting with the ordering system.
From this simple diagram the requirements of the ordering system can easily be derived.
The system will need to be able to perform actions for all of the use cases listed. As the
project progresses other use cases might appear. The customer might have a need to add
an item to an order that has already been placed. This diagram can easily be expanded
until a complete description of the ordering system is derived capturing all of the
requirements that the system will need to perform.
Class diagrams are widely used to describe the types of objects in a system and their
relationships. Class diagrams model class structure and contents using design elements
such as classes, packages and objects.2 Class diagrams describe three different
perspectives when designing a system, conceptual, specification, and implementation.1
These perspectives become evident as the diagram is created and help solidify the design.
This example is only meant as an introduction to the UML and class diagrams. If you
would like to learn more see the Resources page for more detailed resources on UML.
Classes are composed of three things: a name, attributes, and operations. Below is an
example of a class.
The association relationship is the most common relationship in a class diagram. The
association shows the relationship between instances of classes. For example, the class
Order is associated with the class Customer. The multiplicity of the association denotes
the number of objects that can participate in then relationship.1 For example, an Order
object can be associated to only one customer, but a customer can be associated to many
orders.
In this example the classes Corporate Customer and Personal Customer have some
similarities such as name and address, but each class has some of its own attributes and
operations. The class Customer is a general form of both the Corporate Customer and
Personal Customer classes.1 This allows the designers to just use the Customer class for
modules and do not require in-depth representation of each type of customer.
Class diagrams are used in nearly all Object Oriented software designs. Use them to
describe the Classes of the system and their relationships to each other.
Class diagrams are some of the most difficult UML diagrams to draw. To draw detailed
and useful diagrams a person would have to study UML and Object Oriented principles
for a long time. Therefore, this page will give a very high level overview of the process.
To find list of where to find more information see the Resources page.
Before drawing a class diagram consider the three different perspectives of the system the
diagram will present; conceptual, specification, and implementation. Try not to focus on
one perspective and try see how they all work together.
When designing classes consider what attributes and operations it will have. Then try to
determine how instances of the classes will interact with each other. These are the very
first steps of many in developing a class diagram. However, using just these basic
techniques one can develop a complete view of the software system.
This example is only meant as an introduction to the UML and use cases. If you would
like to learn more see the Resources page for more detailed resources on UML.
Interaction diagrams model the behavior of use cases by describing the way groups of
objects interact to complete the task. The two kinds of interaction diagrams are sequence
and collaboration diagrams. This example is only meant as an introduction to the UML
and interaction diagrams. If you would like to learn more see the Resources page for a list
of more detailed resources on UML.
Interaction diagrams are used when you want to model the behavior of several objects in a
use case. They demonstrate how the objects collaborate for the behavior. Interaction
diagrams do not give a in depth representation of the behavior. If you want to see what a
specific object is doing for several use cases use a state diagram. To see a particular
behavior over many use cases or threads use an activity diagrams. 1
Sequence diagrams:
Sequence diagrams demonstrate the behavior of objects in a use case by describing the
objects and the messages they pass. the diagrams are read left to right and descending.
The example below shows an object of class 1 start the behavior by sending a message to
an object of class 2. Messages pass between the different objects until the object of class
1 receives the final message.
Below is a slightly more complex example. The light blue vertical rectangles the objects
activation while the green vertical dashed lines represent the life of the object. The green
vertical rectangles represent when a particular object has control. The represents when the
object is destroyed. This diagrams also shows conditions for messages to be sent to other
object. The condition is listed between brackets next to the message. For example, a
[condition] has to be met before the object of class 2 can send a message() to the object of
class 3.
The next diagram shows the beginning of a sequence diagram for placing an order. The
object an Order Entry Window is created and sends a message to an Order object to
prepare the order. Notice the the names of the objects are followed by a colon. The names
of the classes the objects belong to do not have to be listed. However the colon is required
to denote that it is the name of an object following the objectName:className naming
system.
Next the Order object checks to see if the item is in stock and if the [InStock] condition is
met it sends a message to create an new Delivery Item object.
The next diagrams adds another conditional message to the Order object. If the item is
[OutOfStock] it sends a message back to the Order Entry Window object stating that the
object is out of stack.
This simple diagram shows the sequence that messages are passed between objects to
complete a use case for ordering an item.
Collaboration diagrams:
Collaboration diagrams are also relatively easy to draw. They show the relationship
between objects and the order of messages passed between them. The objects are listed as
icons and arrows indicate the messages being passed between them. The numbers next to
the messages are called sequence numbers. As the name suggests, they show the sequence
of the messages as they are passed between the objects. There are many acceptable
sequence numbering schemes in UML. A simple 1, 2, 3... format can be used, as the
example below shows, or for more detailed and complex diagrams a 1, 1.1 ,1.2, 1.2.1...
scheme can be used.
The example below shows a simple collaboration diagram for the placing an order use
case. This time the names of the objects appear after the colon, such as :Order Entry
Window following the objectName:className naming convention. This time the class
name is shown to demonstrate that all of objects of that class will behave the same way.
State diagrams are used to describe the behavior of a system. State diagrams describe all
of the possible states of an object as events occur. Each diagram usually represents
objects of a single class and track the different states of its objects through the system.
Use state diagrams to demonstrate the behavior of an object through many use cases of the
system. Only use state diagrams for classes where it is necessary to understand the
behavior of the object through the entire system. Not all classes will require a state
diagram and state diagrams are not useful for describing the collaboration of all objects in
a use case. State diagrams are other combined with other diagrams such as interaction
diagrams and activity diagrams. 1
State diagrams have very few elements. The basic elements are rounded boxes
representing the state of the object and arrows indicting the transition to the next state.
The activity section of the state symbol depicts what activities the object will be doing
while it is in that state.
All state diagrams being with an initial state of the object. This is the state of the object
when it is created. After the initial state the object begins changing states. Conditions
based on the activities can determine what the next state the object transitions to.
Below is an example of a state diagram might look like for an Order object. When the
object enters the Checking state it performs the activity "check items." After the activity
is completed the object transitions to the next state based on the conditions [all items
available] or [an item is not available]. If an item is not available the order is canceled. If
all items are available then the order is dispatched. When the object transitions to the
Dispatching state the activity "initiate delivery" is performed. After this activity is
complete the object transitions again to the Delivered state.
State diagrams can also show a super-state for the object. A super-state is used when many
transitions lead to the a certain state. Instead of showing all of the transitions from each
state to the redundant state a super-state can be used to show that all of the states inside of
the super-state can transition to the redundant state. This helps make the state diagram
easier to read.
The diagram below shows a super-state. Both the Checking and Dispatching states can
transition into the Canceled state, so a transition is shown from a super-state named
Active to the state Cancel. By contrast, the state Dispatching can only transition to the
Delivered state, so we show an arrow only from the Dispatching state to the Delivered
state.
Activity diagrams describe the workflow behavior of a system. Activity diagrams are
similar to state diagrams because activities are the state of doing something. The diagrams
describe the state of activities by showing the sequence of activities performed. Activity
diagrams can show activities that are conditional or parallel.
Activity diagrams should be used in conjunction with other modeling techniques such as
interaction diagrams and state diagrams. The main reason to use activity diagrams is to
model the workflow behind the system being designed. Activity Diagrams are also useful
for: analyzing a use case by describing what actions need to take place and when they
should occur; describing a complicated sequential algorithm; and modeling applications
with parallel processes. 1
However, activity diagrams should not take the place of interaction diagrams and state
diagrams. Activity diagrams do not give detail about how objects behave or how objects
1
collaborate.
Activity diagrams show the flow of activities through the system. Diagrams are read from
top to bottom and have branches and forks to describe conditions and parallel activities. A
fork is used when multiple activities are occurring at the same time. The diagram below
shows a fork after activity1. This indicates that both activity2 and activity3 are occurring
at the same time. After activity2 there is a branch. The branch describes what activities
will take place based on a set of conditions. All branches at some point are followed by a
merge to indicate the end of the conditional behavior started by that branch. After the
merge all of the parallel activities must be combined by a join before transitioning into the
final activity state.
Whole-Part Relationships
Generalization-Specialization (Gen-Spec)
Relationships
Generalization-Specialization relationships refer to
classes that inherit attributes and services from other
classes. One class can inherit from multiple
superclasses.
Connections
Connections illustrate the dependency of one object on
the services or processing of another object.
Below is a possible activity diagram for processing an order. The diagram shows the flow
of actions in the system's workflow. Once the order is received the activities split into two
parallel sets of activities. One side fills and sends the order while the other handles the
billing. On the Fill Order side, the method of delivery is decided conditionally.
Depending on the condition either the Overnight Delivery activity or the Regular Delivery
activity is performed. Finally the parallel activities combine to close the order.
There are two types of physical diagrams: deployment diagrams and component
diagrams. Deployment diagrams show the physical relationship between hardware and
software in a system. Component diagrams show the software components of a system
1
and how they are related to each other. These relationships are called dependencies.
Physical diagrams are used when development of the system is complete. Physical
diagrams are used to give descriptions of the physical information about a system.
Many times the deployment and component diagrams are combined into one physical
diagram. A combined deployment and component diagram combines the features of both
diagrams into one diagram.
The deployment diagram contains nodes and connections. A node usually represents a
piece of hardware in the system. A connection depicts the communication path used by
the hardware to communicate and usually indicates a method such as TCP/IP.
The combined deployment and component diagram below gives a high level physical
description of the completed system. The diagram shows two nodes which represent two
machines communicating through TCP/IP. Component2 is dependant on component1, so
changes to component 2 could affect component1. The diagram also depicts component3
interfacing with component1. This diagram gives the reader a quick overall view of the
entire system.
Designing Classes
OO development requires us to think in terms of objects and classes. The classes organize
related properties into units that stand on their own. OO Design requires taking the objects
identified during OO Analysis and designing classes to represent them. That is, class
designers having identified the classes and their interactions, he could start designing
classes. Underlying the functionality of any application is the quality of its design. In this
chapter, the objective is to look at guidelines and approaches to use in designing classes
and their methods.
In the last chapter, we looked at the OO design process. In this, we focus on the step 1 of
the OO design process.
Refine and complete the static UML class diagram by adding details to that
diagram
Refine attributes
Attribute Types
1. Single-value attributes
Attributes represent the state of an object. When the state of the object changes, these
changes are reflected in the value of attributes. A single value attribute has only one value
or state. For example, attributes such as name, address, or salary are of the single-value
type. Mulivalue attributes can have a collection of many values at any point of 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 multivalue attributes.
Instance connection attributes – a person might have one or more bank accounts. A
personal has zero to many instance connections to Account(s). Similarly, an account can
be assigned to one or more persons (joint accounts). Thus attribute can be a reference to
another object.
firstName
lastName
pinNumber
cardNumber
#firstName: String
#lastName: String
#pinNumber: String
#cardNumber: String
The main goal of this activity is to specify the algorithm for methods identified so far. If
we design the 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 using CASE tools. A class can provide several types of methods.
3. Conversion method – the method that converts a value from one unit of measure to
another
4. Copy method – the method that copies the contents of one instance to another
instance
5. Attribute set – The method that sets the values of one or more attributes
6. Attribute get – The method that returns the values of one or more attributes
7. I/O methods – The methods that provide or receive data to or from a device
UML Operation Presentation – The following operation presentation has been suggested
by the UML. The operation syntax is
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.
Examples
+getName(): aName
In general, the methods’ algorithms are represented using UML activity diagrams, which
can be translated into any programming language.