502 Object Oriented Analysis and Design
502 Object Oriented Analysis and Design
502 Object Oriented Analysis and Design
UNIT NO - I
OBJECT-ORIENTED CONCEPTS,
NOTES
Introduction
Object Oriented Analysis and Design (OOAD) subject deals with analysis
and design of the system which is to be developed using any object oriented
platform. If, a software as a system is analyzed and designed using a scientific
approach, then the end product i.e. the software is always a quality product which
can get through the acceptance test as well as satisfies the user. System Analysis
and Design (SAD) and Software Engineering like subjects helps to develop this
approach while developing any software. But these subjects deals with general
software and does not applies to software being developed using any Object
Oriented Language. Object Oriented Languages are featured with concepts like
data abstraction, data hiding, data binding, class, object, inheritance,
polymorphism and message passing. If the software is featured with these
concepts, makes the software more secure for data, durable and easily upgradable.
Any previously used techniques like software engineering does not consider these
concepts while designing software. Hence a need for other approach for
designing Object Oriented System was observed, named as Object Oriented
Analysis and Design.
Now a day’s mostly software are application softwares, which helps to store
and process business data. Hence the software is responsible for business data.
But the software defines different procedures which processes the business data
which has become now precious for business decisions. Which has given rise to
a need for the software which limits the procedures from processing data.
Software, most of the times is seen as collection of programs. But in actual
sense it is not only programs but also data, platform being used (machine
specifications, operating system, memory size available and many more Object-Oriented
characteristics of system). By considering all specifications at clients location Concepts,
Modeling and UML 1
Object Oriented Analysis designer of software designs the software. The major decision is about
and Design programming paradigm. Section 1.1 discusses about programming paradigms
and object orientation.
NOTES
What is Object Orientation
Programming paradigm is the way to classify different programming
languages depending on their features. Features of every programming language
used decides features of the software. Roughly software can be system software
or application software. The category of software helps to define general features
hold by the software and consequently helps to select proper programming
language an also programming paradigm to be followed.
Generally the data centric application software follows Object Oriented
Paradigm. Object- Oriented Programming (OOP) is one of programming
paradigm, considered next to Procedure Oriented Programming. The objective
of OOP is to secure data from unintended access of procedures. Here procedures
are programming constructs or functions which accepts data as input, processes
it and generates output, and hence are responsible for changing or damaging data.
In the previous semester while studying Java you have seen characteristics
of OOP. With respect to design of a software we will revise here some of the
characteristics of OOP languages.
Class
Class is a basic software construct of any OOP language. The concept of
‘class’ helps to achieve basic objective of any OOP language like data hiding,
data binding, data abstraction and data encapsulation. Class is always termed as
a blueprint of an object. Class is treated as user defined data type and helps user
to bind data and methods together. The class defines data as properties and
methods
More than a software construct, class plays crucial role in any Object
Oriented system. Design of an Object Oriented System is always seen as sharing
of responsibilities. Here system data and methods (processes) for processing
system data are assigned as responsibilities to classes in the system. Hence classes
in any Object Oriented Systems forms its base structure.
Object
Object is a runtime entity defined on a class. An object is responsible for
storing system data and process it. An object is responsible for carrying out major
functionalities in a system. While designing a system an object view helps to
design classes. While designing software classes, visualization of objects can
help us for defining properties and add methods after understanding role of each
object in the system.
Object-Oriented One need to imagine what different roles will be played by an object in the
Concepts, system while accomplishing its functionalities.
2 Modeling and UML
Inheritance Object Oriented Analysis
and Design
The concept of inheritance allows reusability. With the help of inheritance,
a previously developed system can be easily upgraded. On the base of the existing
system, with the help of the concept of inheritance one can modify or add new NOTES
functionalities. For the purpose previously defined classes and interfaces can be
used for modification and defining new classes and interfaces.
But the basic condition for upgrading the system, classes in the system needs
to be designed and developed so that those can be inherited. The designer of an
original system should visualize future enhancement which can be introduced in
the system.
Polymorphism
The word ‘polymorphism’ is a Greek word which means ‘One Thing
Having Many Forms’. In OOP polymorphism is achieved through method
overloading, method overriding and Dynamic Method Dispatch (DMD) which
is also known as virtual functions. The concept of polymorphism can be
considered as a major advantage of OOP. Without giving much pain to user it
allows user to add variations in functionalities. Major advantages of
polymorphism can be observed while upgrading any system.
Model
Model represents, not all but, major features original system. From the
model one can, get idea about the original system. The model may not represent
minute features, but it clears major part of system. For example, the model of
building kept at builders or architecture’s office which represents original
building, a small representation of real one. Object-Oriented
Concepts,
Modeling and UML 3
Object Oriented Analysis Model for software system is its design, diagrams explaining processes and
and Design data in system. Various diagrams help stakeholders to understand and to visualize
the system. This section helps in understanding modeling of software.
NOTES
Introduction to Modeling
As discussed while introducing with word ‘model’, for understanding any
new system being developed or under construction, model of the system is
required. Every system’s modeling is done differently depending on nature of
system. The software after development cannot be seen and touched, and hence
modeling of any becomes tough. In this case a software can be represented using
diagrams explaining major features of software. Through different diagrams we
can understand working of software, interaction between its processes and data
as well as data stores. Along with software design, for explaining each program
also different diagrams are also available. In this section we are going to revise
traditionally used diagrams for designing software.
Object-Oriented
Concepts,
Modeling and UML 5
Object Oriented Analysis
and Design
NOTES
Object-Oriented
Fig 3.3 : Algorithm for Order Processing System
Concepts,
6 Modeling and UML
• Flow Chart Object Oriented Analysis
and Design
As discussed earlier understanding a diagram is more easy than
understanding any textual information. The algorithm written for the
process can be represented diagrammatically with the help of NOTES
flowchart. Flowchart is defined as diagrammatic representation of
algorithm. Following diagram shows the flowchart for the same
algorithm given above.
Object-Oriented Modeling
In the above section we have discussed about modeling a system. In the
section we have discussed about the techniques used traditionally for designing
any software system. But these techniques were observed to have certain
drawbacks. The drawback of these techniques was observed after development
of new programming paradigm i.e. Object Oriented Programming (OOP)
Paradigm.
This new paradigm has presented totally new concepts of programming.
These new concepts entirely changed programming scenario. Model of the
software is considered to be a bridge between user of the system and developers
of the system. Developers refers model to understand requirements and
expectations of client and direct users of system. But the modeling done through
previous techniques does not consider these newly introduced concepts and hence
development of system becomes challenging job for developing team and may
fail to implement the model properly. Consequently the end product was unable
to satisfy the end user. This happened though model of the system was designed
after considering all user requirements. Hence some new changes were expected Object-Oriented
in modeling of software system following OOP concepts. Concepts,
Modeling and UML 7
Object Oriented Analysis Here to avoid failures in acceptance test of the software, need for
and Design development of new techniques which can help in representing OOP concepts
was observed. The concepts of OOP, which are implemented as programming
NOTES constructs are discussed in section 1.1, like class, object, polymorphism etc. Now
the requirement of new technique is to model the software in the form of these
concepts, so that development of software will become easier and will meet the
requirements of the developer team and user.
In this subject ‘Object Oriented Analysis and Design’ we are going to
discuss about Object- Oriented Modeling.
Object-Oriented Construction
Once the analysis for the system is completed, the first iteration of class
diagram is ready for further improvements in upcoming iterations.
Simultaneously the team starts with the development of artifacts (small software
constructs which may include rough definition of classes or functions) and thus Object-Oriented
construction of system starts. While defining these artifacts the designer come Concepts,
Modeling and UML 9
Object Oriented Analysis forward with some constructional problems, like setting relation between classes,
and Design or for smoothing the communication between two classes associate class may be
needed. Accordingly again the previously designed diagrams and defined artifacts
NOTES are modified. This process is done iteratively.
While the construction process with the help of artifacts is going on, for
better understanding of system different UML diagrams are designed like state
transition diagram(STD), activity diagram, sequence diagram which helps
development of artifacts more easy. With the end of every iteration much part of
construction is done.
In construction one cannot concentrate on only coding of classes and their
interaction, but need to think and design for software architecture and hardware
architecture. The OOP platforms are very powerful to support different types of
software and hardware architectures. With the development of different types of
software and hardware architectures. Hence going beyond only coding part of
software, designer now has to think about architecture of software and hardware.
Therefore while constructing system designer uses component diagram and
deployment diagram which are UML architectural diagrams.
Thus the OOAD system is constructed iteratively. With the end of
construction phase, the system enters in the next phase of testing. The testing
phase of testing is discussed in the next sub-section 1.3.4.
Object-Oriented Testing
Like a Procedure Oriented software, Object Oriented Software also need to
undergo various rigorous tests for assuring its quality and acceptance. For testing
any software different techniques are developed like unit testing, integration
testing. These testing techniques are carried out at different levels of software
development lifecycle. The steps undertaken for testing considers testing of
procedure oriented software. Applying the same techniques for Object Oriented
software becomes difficult. Research confirms that testing methods proposed for
procedural approach are not adequate for OO approach. These testing problems
are faced due to distinguishing characteristics of Object Oriented Languages.
Typical OO software characteristics that affects testing can be stated as –
• State dependent behavior
• Encapsulation
• Inheritance
• Polymorphism and dynamic binding
• Abstract and generic classes
• Exception handling
Hence there is need to think differently and redesign the testing strategies
Object-Oriented for Object Oriented Software.
Concepts,
10 Modeling and UML
Though Unit testing and Integration testing are considered to be better Object Oriented Analysis
techniques for testing of any software, for applying same for testing of Object and Design
Oriented Software need to be modified. These techniques to be applied for OO
systems are discussed below – NOTES
• Unit Testing - Considering any procedure oriented system the term unit
testing defines testing of individual programs or functions. But in Object
Oriented Software unit testing need to be carried out at different levels.
In any OO program definition of a ‘class’ forms a unit. Hence at unit
testing individual classes are tested for their functionalities. This is also
called as ‘intra-class Testing’. In intra class testing, class functionalities
are tested as reference to the system working. The testing of OO software
is more time consuming and hence it becomes expensive to test every
event individually. Therefore every event is tested with context with class.
• Integrated Testing – once every class functionalities are tested, the next
step is to carry out integrated testing. For any OO software in integrated
testing inter-class testing is carried out. The classes of any system cannot
work individually, and need to have interaction with other classes in the
system. These interactions between classes takes place with data sharing.
These interactions are tested in integration testing.
Conclusion
The Object Oriented Paradigm introduces new concepts of programming
which are more powerful and useful for data centric as well as network systems.
Using Object Oriented platform for development of softwares is the demand of
time. But at the same time just switching from other paradigm to OOP paradigm
is not sufficient. Hence the process of software development need to rethink and
new techniques for analysis and design of the software need to be developed.
The chapter has discussed how OOP is different than other programming
paradigms, and a base has been created for study of Object Oriented Analysis
and Design (OOAD).
*****
Object-Oriented
Concepts,
Modeling and UML 11
Object Oriented Analysis
and Design
UNIT NO - II
ITERATIVE DEVELOPMENT
NOTES
AND UML
Introduction
In the first chapter we have discussed characteristics of object-oriented
languages, and with reference to these characteristics, we have also seen why
and how designing for object-oriented software is different. Hence need for some
different techniques for designing object-oriented software was observed.
In this chapter, we are going to learn a new technique, Unified Modeling
Language (UML), which is a powerful method for designing object-oriented
software. UML is the latest designing tool and is being used for designing any
type of software like a desktop application, or a website or web application, or a
complex system software. UML as a designing tool provides collection of
different diagrams dealing with various aspects of software. The designer can
select required diagrams that are sufficient for explaining the system and can be
referred by a developing team while working on development of the software.
These diagrams are so self-explanatory and can be used by the client to cross-
verify various functionalities being covered under the software. This helps client
to get idea about the software and its working. After understanding the system
diagrams, if in case the client feels he may come up with some new requirements
and accordingly the system diagrams consequently system can be modified. In
the sense this reduces the possibility of occurrence of problems while acceptance
test.
Moreover UML supports iterative development of system, which allows
designer and developer to entertain new requirements or modify existing one at
Iterative Development
12 and UML any stage of development. This iterative development is possible due to the
concept of RUP (Rational Unified Process). In the chapter we are also going to Object Oriented Analysis
study about RUP and phases in RUP. and Design
The chapter also discusses about the different types of diagrams and
introduces them with short explanation for each. After going through these NOTES
various types of diagrams you will understand as a designing tool, UML is
powerful.
The same chapter discusses about the Use case diagram and activity diagram
which are the diagrams from which designing process for system starts. As
discussed earlier, you will observe how UML diagrams are easy to draw and
understand. It will also explain interdependency among the various diagrams
which we are going to study through.
Understanding Requirements
Before starting software system design or development, firstly the team
needs to work on the requirements of the client. The software development
lifecycle initiates with the collection of requirements from different users, may
be direct or indirect. For collecting requirements from users of system different
methods like interviews, questionnaires, creation of a particular scenario and
understanding the flow of process, etc. are used. But gathering and writing of
requirements is not enough to design the software. Further work need to be done
on these collected requirements so that designing the software will be more easy
for designer.
Previously in software engineering for processing requirements a scientific
process was used which is termed as requirement engineering. Requirement
engineering is a technical term that consists of various stages which helps for
defining, documenting and maintaining the requirements. Phases of requirement
engineering process are requirement elicitation, requirement specifications,
requirement verification and validation, and the last phase is requirement
management. Every phase gives the output as some model of the system under
study like DFD, ERD, Functional Dependencies etc. these models are used or
referred as design of the system which are interdependent.
The major problem faced with the requirement engineering is each phase
goes on finalizing the requirements and hence modification of existing
requirements or addition of new requirements becomes tough task. For adding
any new requirement one need to modify all dependent diagrams and hence
software may not be able to satisfy the client or the user. Implementing these
changes are more time consuming and hence are not affordable for the company.
Hence need for iterative development was felt.
With the development of new techniques, researchers and designers of
software also started thinking for iterative development lifecycle. The advantage
of iterative development lifecyle, improved or new requirements can be easily
added to the designing and development process and satisfaction of client
improves result of acceptance test. The iterative development lifecycle is Iterative Development
and UML 13
Object Oriented Analysis discussed in 2.2 section. For improving the processing of requirement and for
and Design accepting the challenge the designing of software the new concept is used is –
‘understanding of requirements’. Only technical writing of requirements is not
NOTES sufficient for designing an object oriented software. And, therefore, while
working on any requirement, it is explained with the scenario, to explain how
the process is carried out in reality at the working place. The advantage of
scenarios is, various small and apparently negligible requirements are covered
with every scenario. This also helps in finding relations and dependencies
between different data collected and used in different scenarios. To understand
writing scenario with example, we will consider Hospital Management System,
discussed in previous chapter. In the hospital instead of writing requirements just
as –
a) For new patient generate new OPD card by entering patient
information.
b) If the OPD card is existing already then renew it after checking validity
date, else just charge minimum.
c) Open the case paper for the patient and add to the queue for doctor.
d) Generate receipt.
Here if the requirements are written like above it does not clear the situation
and does not help in writing programs.
Instead, the above related requirements can be explained well with the
following scenario as –
a) A patient arrives at the reception table. He was asked to provide OPD
card number which is his unique ID in the system. The patient says he
didn’t have OPD card. The receptionist asks him if he is visiting
hospital for the first time. If he says ‘yes’, receptionist will ask him to
fill up the form. The form accepts the patient’s information as his
name, address, contact number, age, disease, allergies. While accepting
the filled form the receptionist will take his snap which will be stored
with his file. The receptionist will ask him to pay charges for new OPD
card. The receptionist will enter his information and will print card as
well as receipt for him. At the same time a new case-paper will be
generated with same information as for OPD card, and will be added
to queue. The patient will receive the OPD card and receipt from
receptionist.
b) A patient arrives at the reception table. He was asked to provide OPD
card number which is his unique ID in the system. The patient will
provide the OPD card. The receptionist will enter the card number.
b1) If the validity duration, as set by the administrator, is over, the
patient will be asked to pay renewal charges for the card. The
Iterative Development receipt will give receipt to the patient. The case paper for the
14 and UML patient will be opened and will be added to the queue.
b2) If date of card is within validity period, the patient will be asked Object Oriented Analysis
to pay visiting charges. The receipt will give receipt to the patient. and Design
The case paper for the patient will be opened and will be added
to the queue. NOTES
If the requirements are written like these scenarios it explains more better
as well as helps designer and developer to imagine the situation and develop
artifacts also. Developing artifacts with analysis phase is one of the characteristic
of iterative development and scenarios helps this with the chance of improvement
in upcoming stages. How iterative development works that will be explained in
the next section.
RUP Phases
The RUP, as a software development process, has determined a project life-
cycle consisting of four phases. Like SDLC in Software Engineering, these
phases, at a high level appear in a similar way. Although the deatails of the
process explains every phase as an iterative phase. Also, each phase sets an
objective and at the end of the phase fulfillment of objectives is assured.
Iterative Development
16 and UML
Following subsections explains four phases of RUP. Object Oriented Analysis
and Design
I Inception
The word inception itself explains role of the phase in software NOTES
development. The phase can be compared with feasibility study, where initial
study for the project is carried out. A thorough study about the system under study
is carried out and objectives of the study are to get knowledge about –
• Business context i.e. to understand and get current working system details
• Success factors which includes expected revenue generated, market
recognition, etc.
• Financial forecast which helps to budget the cost of the final product.
In the phase the working team’s objective is to generate –
• Basic use case model
• Project plan
• Project description which includes core project requirements, constraints
and key features
• Initial risk Assessment
Once all above reports are ready with the team, now the project is
checked against the following criteria:
• Discussion with Stakeholder regarding project scope with reference to
use case model and other estimates about cost and schedule estimates.
• ‘Requirements understanding’ as represented in use cases.
If the project does not pass this the life cycle objective milestone, it either
can be cancelled or repeated after being redesigned to better meet the criteria.
II Elaboration
In the phase, as the name suggests, the system is more elaborated or
explained with some more depth. With the help of different diagrams artifacts
from the system are elaborated. The phase is iteratively executed, till artifacts
for most of the use cases are not being generated. Along with the development
of various diagrams and artifacts primary objective is to minimize the key risk
items identified by analysis up to the end of this phase. The elaboration phase is
where the project starts to take shape. In this phase the problem domain analysis
is made and the architecture of the project gets its basic form.
The outcome of the elaboration phase is
• A use-case model in which the use-cases and the actors have been
identified and most of the use-case descriptions are developed. The use-
case model should be 80% complete.
Iterative Development
and UML 17
Object Oriented Analysis • A description of the software architecture in a software system
and Design development process.
An executable architecture that realizes architecturally significant use cases.
NOTES
• Business case and risk list which are revised.
• A development plan for the overall project.
• Prototypes that demonstrably mitigate each identified technical risk.
• A preliminary user manual (optional)
If the project cannot pass this milestone, there is still time for it to be
canceled or redesigned. However, after leaving this phase, the project transitions
into a high-risk operation where changes are much more difficult and detrimental
when made.
The key domain analysis for the elaboration is the system architecture.
III Construction
The primary objective is to build the software system. In this phase, the
main focus is on the development of components and other features of the system.
This is the phase when the bulk of the coding takes place. In larger projects,
several construction iterations may be developed in an effort to divide the use
cases into manageable segments produce demonstrable prototypes.
IV Transition
The primary objective is to 'transit' the system from development into
production, making it available to and understood by the end user. The activities
of this phase include training the end users and maintainers and beta testing the
system to validate it against the end users' expectations. The system also goes
through an evaluation phase, any developer which is not producing the required
work is replaced or removed. The product is also checked against the quality
level set in the Inception phase.
With the end of Transition Phase it is checked if all requirements are met.
The requirements of the system defines the objectives of the system and on
satisfaction of these objectives the RUP lifecycle ends here. If the elaboration
phase takes sufficient iterations chance of satisfaction of objectives gets
improved. Theoretically at least three to four iterations for elaboration are
suggested.
Overview of UML
As per previous discussion, UML has many features which makes it unique
as a designing tool. Due to this Unified Modeling Language is now accepted as
a standardized general- purpose modeling language and is managed as a de facto
industry standard by the Object Management Group (OMG). Though still it is
under development and keep on modifying with new concepts it is accepted by
software industry as it enables designer to view the system with two different
views - Static vs Dynamic View. For expressing system with these two different
views UML takes help of various diagrams. Hence the diagrams in UML are
categorize under two headings as – structural modeling which explains the static
view of the system; while behavioural modeling and interaction modeling which
explains the dynamic view of the system.
Iterative Development
20 and UML
Static view is used to specify the static structure of the objects, classes or Object Oriented Analysis
components that exist in the problem domain which are expressed using class, and Design
object or component. It includes class diagrams and composite structure
diagrams. NOTES
While dynamic view refers to the dynamic behaviour of the system. Objects
defined for the classes are responsible for adding dynamic behaviour to the
system. The dynamic behaviour of an object can be its reactions to the external
environment, or its involvement in different situations faced by the system or its
interaction with other objects in the system. For explaining object’s dynamic
behaviour two types of modeling is used, the first is behavioural modeling while
the other is interaction modeling. Both these helps to represent the object’s
behaviour during runtime. It is represented by use case, sequence, activity,
collaboration, and state.
Over the time period UML has go on developing and different versions of
UML were introduced. The current version used of UML is 2.5.1 which was
released in December 2017. According to this version there are 11 different
diagrams which are used majorly, which are divided into three categories:
• 5 diagrams represent structural information,
• 3 represents general behavioural diagrams,
• While 3 other represents different aspects of interactions among objects.
These diagrams will be discussed briefly in next section.
Diagrams in UML
After conceptual model which explains how efficiently different concepts
of OOP can be used in the system, the next task is to design various diagrams
for the system under study. UML provides a rich collection of diagrams which
tries to cover all aspects of Object Oriented Software. As discussed in subsection
2.3.2, UML diagrams covers two views of the system, the structural view and
behavioural view. The behavioural view again with behavioural covers
interaction view of the diagram. Accordingly diagrams in UML are divided in
three categories –
Iterative Development
22 and UML
• Structural Diagrams Object Oriented Analysis
and Design
• Behavioural Diagrams
• Interaction Diagrams
NOTES
We are going to cover nine UML diagrams here. These all diagrams along
with their categories hierarchically as shown in the following UML diagram map:
Iterative Development
24 and UML
The table given below explains purpose of each diagram in brief – Object Oriented Analysis
and Design
NOTES
Iterative Development
and UML 25
Object Oriented Analysis
and Design
NOTES
Advantages of UML
UML is a versatile visual language that is used to model a software system.
Though it was accepted widely by software industry still some were having
doubts for using it and were feeling it is not necessary to use this as designing
tool. Like every designing technique it has got its own advantages and
disadvantages. The section discusses the advantages and disadvantages of UML
Iterative Development
26 and UML as a designing tool.
Advantages of UML – Object Oriented Analysis
and Design
• Most-Used designing tool
UML is a highly recognized and understood platform for software design.
NOTES
It is a standard notation among software developers. It can be safely
assumed that most software professionals will be at least acquainted with,
if not well-versed in, UML diagrams, thus making it the go-to alternative
to explain software design models.
• Flexible
What makes UML well-suited to and much-needed for software
development is its flexibility. Designer can customize his modeling
elements and interactions in a UML diagram specifically to suit the
domain or technologies you are using.
Disadvantages of UML
Despite its myriad uses and benefits, UML is not preferred by all. In fact, a
considerable section of software developers, don’t use UML and heap heavy
criticism on the same. Let’s look at the arguments against using UML.
• Formal Notation is Not Necessary
Any UML diagram doesnot specify any hard and fast rule to be followed
while modeling the software. This characteristic adds flexibility to the
modeling. But the same has become disadvantage of UML. Instead of
communicating the diagrams formally, the same impact and effect can
be felt with informal, box-and-line diagrams created in PowerPoint,
Visio, or a whiteboard. As coding is a formal language by itself, a lot of
developers don’t prefer the complexity and the formality at the
architectural level, which discourages the use of UML and has become
one of its disadvantages.
Behavioural Modeling
Always the inception phase ends with the collection of requirements and
finalizing the functional requirements, though not final with scope of changes.
Iterative Development Now the designer of system starts thinking of design of the system. In case of
28 and UML
Object Oriented System the design has to consider two major aspects of the Object Oriented Analysis
system. One is the structural or static model and the other is behavioural or and Design
dynamic model.
Here we are starting with the discussion on behavioural modeling of the NOTES
system. How effectively system can handle different situations when it is
running/operating is explained with the help of behavioural modeling.
Behavioural modeling helps in developing code for the system, as the coding
part is responsible for deciding reactions of the system. And therefore most of
the behavioural diagrams deals with the functionalities of the system. Effective
behavioural design helps in designing effective situation handling for the system.
There are number of UML diagrams which helps to design behaviour of the
system but the system design starts with Use Case Diagram and Activity
Diagram.
Iterative Development
30 and UML
Object Oriented Analysis
and Design
NOTES
II Finding Actors
Next step after defining use cases is to find actors who initiates the use
cases. The following questions can help you identify the actors of the system:
• Who uses the system?
• Who installs the system?
• Who starts up the system?
• Who maintains the system?
• Who shuts down the system?
• What other systems use this system?
• Who gets information from this system?
• Who provides information to the system?
• Does anything happen automatically at a present time?
Iterative Development
and UML 31
Object Oriented Analysis III Defining Relations among Use Cases
and Design
When it comes to drawing use case diagrams one area many struggles with
is showing various relationships in use case diagrams. There can be 5 relationship
NOTES types in a use case diagram.
• Association between actor and use case - This one is straightforward and
present in every use case diagram. Few things to note.
• An actor must be associated with at least one use case.
• An actor can be associated with multiple use cases.
• Multiple actors can be associated with a single use case.
NOTES
Iterative Development
34 and UML
Object Oriented Analysis
and Design
NOTES
Iterative Development
and UML 35
Object Oriented Analysis
and Design
NOTES
Document- Template_fig4_3946201
It consists of all use case in the use case diagram given in the system
overview document. This document for each use case explains majorly following
points for each use case –
• Participating Actors – it gives the list of actors which are involved in the
use case execution. It consists of initiator, beneficiary, as well as actor
who are involved in the process. For example in the use case ‘Billing’,
clerk is the initiator who activates the use case, customer is beneficiary
who can buy the products at the end of use case, while barcode reader
and printer are actors who are involved in the completion of the use case.
• Flow of events – lists the sequence of events which will be carried out
right from the starting of the use case till the completion of use case. This
helps to explain the entire scenario to the stakeholders as well also helpful
in preparing other dependent diagrams like activity and sequence
diagram.
Iterative Development
36 and UML
• Precondition – for execution of every use case some preliminary Object Oriented Analysis
condition is to be satisfied before starting with use case, for example for and Design
the use case ‘login to the system’ a precondition is accepting the user
name and password. These conditions are specified as precondition for NOTES
the execution of use case.
• Postcondition – after completion of execution of the use case some
condition to satisfy which is given as postcondition. For example, after
execution of login user’s credentials needs to be checked, is the
postcondition for use case.
Once the documents are prepared and signed by the client and the authority
from developing team the actual development process starts.
Activity Diagram
Activity diagram is another important diagram in UML to describe the
dynamic aspects of the system. Activity diagram is basically a flowchart to
represent the flow from one activity to another activity. The activity can be
described as an operation of the system. The control flow is drawn from one
operation to another. This flow can be sequential, branched, or concurrent.
Activity diagrams deal with all type of flow control by using different elements
such as fork, join, etc.
The basic purposes of activity diagrams is to capture the dynamic behaviour
of the system. Other four diagrams are used to show the message flow from one
object to another but activity diagram is used to show message flow from one
activity to another.
Activity is a particular operation of the system. Activity diagrams are not
only used for visualizing the dynamic nature of a system, but they are also used
to construct the executable system by using forward and reverse engineering
techniques. The only missing thing in the activity diagram is the message part.
It does not show any message flow from one activity to another. Activity
diagram is sometimes considered as the flowchart. Although the diagrams look
like a flowchart, they are not. It shows different flows such as parallel, branched,
concurrent, and single.
The purpose of an activity diagram can be described as −
• Draw the activity flow of a system.
• Describe the sequence from one activity to another.
• Describe the parallel, branched and concurrent flow of the system.
Activity diagrams are mainly used as a flowchart that consists of activities
performed by the system. Activity diagrams are not exactly flowcharts as they
have some additional capabilities. These additional capabilities include
branching, parallel flow, swimlane, etc.
Before drawing an activity diagram, we must have a clear understanding Iterative Development
about the elements used in activity diagram. The main element of an activity and UML 37
Object Oriented Analysis diagram is the activity itself. An activity is a function performed by the system.
and Design After identifying the activities, we need to understand how they are associated
with constraints and conditions.
NOTES Before drawing an activity diagram, we should identify the following
elements −
• Activities
• Association
• Conditions
• Constraints
Once the above-mentioned parameters are identified, we need to make a
mental layout of the entire flow. This mental layout is then transformed into an
activity diagram.
Following is an example of an activity diagram for order management
system. In the diagram, four activities are identified which are associated with
conditions. One important point should be clearly understood that an activity
diagram cannot be exactly matched with the code. The activity diagram is made
to understand the flow of activities and is mainly used by the business users
Following diagram is drawn with the four main activities −
• Send order by the customer
• Receipt of the order
• Confirm the order
• Dispatch the order
After receiving the order request, condition checks are performed to check
if it is normal or special order. After the type of order is identified, dispatch
activity is performed and that is marked as the termination of the process.
NOTES
Iterative Development
and UML 39
Object Oriented Analysis
and Design
NOTES
References
• https://en.wikipedia.org/wiki/Rational_Unified_Process
https://www.webopedia.com/TERM/R/RUP.html https://creately.com
/blog/diagrams/advantages-and-disadvantages-of-uml/
• https://www.visual-paradigm.com/guide/uml-unified-modeling-
language/what- is-use-case- diagram/
• https://creately.com/blog/diagrams/use-case-diagram-relationships/
• https://www.visual-paradigm.com/guide/uml-unified-modeling-
language/what-is-activity- diagram/
• https://www.usability.gov/how-to-and-tools/methods/use-cases.html
*****
Iterative Development
and UML 41
Object Oriented Analysis
and Design
UNIT NO - 3
BASIC AND ADVANCED
NOTES
STRUCTURAL MODELING
Objectives of Chapter
To understand –
• What is structural modeling
• Finding and defining classes
• Relating classes
• What is state of an object and how to draw STD
• What is role of Object Diagram
• How to define packages and how to draw package diagram
Introduction
In this chapter, we are going to discuss various UML diagrams which are
to be dawn as an elaboration of the system. This chapter talks about preliminary
diagrams like class diagram, object diagram, package diagram, and state
transition diagram. These all are the basic diagrams of any object-oriented
diagram as they all deal with the basic programming construct of any object-
oriented system.
From these all diagrams, the class diagram is a crucial diagram which
defines the base structure for the system. Therefore class structure needs to be
designed very carefully and by considering all possibilities which help to make
the system more durable, easily upgradable, and efficient. The Object- Oriented
systems designed using the RUP process always insist on designing the
component- based system. In any Object-Oriented system class and collection
of classes (packages) form components. hence this chapter helps you to develop
your skills for designing the Object-Oriented system.
Class Diagram
The term class diagram is defined as ‘a diagrammatic representation of
classes and their relations for a specific system’. It is a structural diagram. The
class diagram forms structure of the system based on which the entire system
stands and works. So obviously it has to be strong enough. At the same time, the
structure should be designed in such a way that in future the system should be
Basic and Advanced easily upgradeable. Here the designer should concentrate not only on current
42 Structural Modeling requirements but should also give a moment to think about future developments.
This makes the system more flexible and acceptable. Object Oriented Analysis
and Design
To start with the class diagram following sequence is to be followed –
1. Firstly try to find the objects which are playing a major role in the
NOTES
system with respect to data storing and data processing.
2. With reference to these objects, roughly classes can be defined.
3. The last phase in this process is to define relations between classes,
which completes the design of the class diagram.
The following sub-sections discuss the process in detail.
Object Modeling
When we think of software, always it comes with some programming
language. But it is not only a collection of programs but it consists of many small
programming constructs which as a designer one needs to visualize. In any
object-oriented system, the smallest programming construct is a ‘class’. The
technical definition of a ‘class’ is given as ‘encapsulation of data and methods
processing data together as an abstract definition’. So when a designer starts
designing a class he has to think of data and methods processing data together.
Visualization and defining of classes in the system is a challenging task and is to
be done very carefully. With the help of ‘Object Modeling’, defining classes
becomes an easy task. The Object- Oriented Modeling (OOM) technique
visualizes things in an application by using model objects. In
In object-oriented software engineering, the software developer identifies
and organizes the application in terms of object-oriented concepts, prior to their
final representation in any specific programming language or software tools.
Defining Operations
Basic and Advanced
46 Structural Modeling After finalizing specification of attributes next step is to finalize operation
carried out by the class, actually by an object defined on the class. For defining Object Oriented Analysis
operations in addition to CRC cards use case diagram is also referred. Like and Design
attributes these operations will also have datatype (return datatype), visibility
and one additional information that is arguments passed. NOTES
For example the class ‘Order’ will have right now only three operations like
create, edit and cancel defined with proper arguments. Their arguments and
visibility will be finalized after certain iterations.
I Generalization Relation
The relation of Inheritance is represented as Generalization relation in UML.
It represents an "is-a" relationship. The concept of inheritance allows user to
reuse the attributes and methods from previously defined class. The previously
defined class is known as super class or base class, while the newly defined class
is known as sub class or derived class. Sub class derives private and public
characteristics from its super class. Diagrammatically generalization relation is
represented by connecting two classes with an hollow arrow. The arrow always
points to the super class. Following diagram represents pictorial representation
for generalization relation.
Fig 3.2 : Generalization relation between class ‘Vehicle’ and class ‘Car’
Here as the class ‘Car’ shares characteristics of class ‘Vehicle’ and hence
both are related with generalization relation. The generalization relation exist
between classes.
II Association Relation
When to satisfy the demand of an use case or functionality if two classes
need to share minimum data then the association relation is used. It is the most
preferred relation in class diagram as it promotes minimum data sharing.
It is implemented through the concept of message passing. When two
classes are associated with each other to carry out the relation a method is added Basic and Advanced
Structural Modeling 49
Object Oriented Analysis to the associated class. This method sends message to associated class to share
and Design the required data. Hence the association relation exist between two objects.
Diagrammatically the association relation is represented with a thick line
NOTES connecting two classes. Following diagram explains representation of association
relation.
Generated for
NOTES
Here the keyword ‘abstract’ is written within curly brackets which at the
right end of the class name. The keyword ‘abstract’ helps to describe class as an
‘abstract class’.
• Interface
The other concept is of ‘interface’ which was introduced by newly
launched OOP languages. The concept of ‘interface’ helps to achieve
multiple inheritance. In multiple inheritance a sub-class is derived from
more than one super-classes. Multiple inheritance may face a problem
of creating multiple copies of attributes and hence the OOP languages
like java, php etc. comes with the concept of interface. Interface also
allows abstraction, but does not allow instantiation. And hence allows
multiple inheritance.
The other advantage of interface it keeps user free to implement.
Definition of interface consists of only signatures of methods, while
all defined methods are implemented by user. Hence depending on
demand of situation the user can define its own role.
When a system requires –
• Multiple inheritance
• There is a need to provide some common functionalities
• The user is to be kept free for implementation
In addition to any of these three conditions the necessary condition is - as
this is not requirement of system, but requirement of designer and so he does not
the class to be instantiated. Then here the better option than abstract class is an
‘interface’.
Diagrammatically the interface in class diagram using short hand notation
is represented as–
Like with abstract class, with an ‘interface’ the keyword used is ‘interface’,
which helps to differentiate it from normal class. The symbol used with keyword
is called stereotypes which is used in UML diagrams to mention some added
characteristics.
Basic and Advanced
Structural Modeling 53
Object Oriented Analysis Types and Roles of Classes
and Design
As discussed earlier while discussing ‘finding classes’ there are three types
of classes that can be defined –
NOTES
• Entity classes
• Boundry classes
• Controller classes
The boundry classes are defined while designing user interface for the
system. But we need to remember that these classes are associated with the
system classes.
The controller classes role is to control the activities taking place in the
system. These controller classes are added while developing class diagram.
One more type of class that is ‘Association Class’ which is added between
two associated classes. These classes are added when two classes need to share
data bt those donot want to directly share data with each other.
For example,
Object Diagram
An object is defined as a runtime entity defined for a class. An object holds
data for attributes defined in a class and methods in the class adds behaviour to
object. So at design level the only difference between class and object is object
will have values for attributes in class.
After completing class diagram a designer goes for object diagram, which
is based on class diagram. Same relations as in class exist between objects on
class. Actually object diagram is also known as instance diagram and represents
runtime existence of relations between objects at an instance of time.
Now the question is, if both class and object diagram are same, then why
and when one should go for object diagram? What is the purpose of object
diagram? The same is explained by object diagram as by class diagram. But as
object represents the relation at particular instance of time it becomes more
concrete in nature.
The association relation between two objects is the relation between two
objects and shares some data between two objects. This data sharing takes place
only if the object receives request from the other. Sending and receiving requests
from object takes place at particular instance of time and in particular situation.
Basic and Advanced Here situation defines a scenario. Passing and receiving of request is response
54 Structural Modeling of system to the situation, also defined as behaviour of system. This cannot be
observed in class diagram as it is static in nature and cannot represent such Object Oriented Analysis
runtime situations. So as a conclusion object diagram is drawn to understand and Design
runtime relation between objects. To summarize object diagram helps in -
• Forward and reverse engineering. NOTES
For example
Consider you have $100,000 in a bank account. The behavior of the
withdraw function would be: balance := balance - withdrawAmount; provided
that the balance after the withdrawal is not less than $0; this is true regardless of
how many times you have withdrawn money from the bank. In such situations,
the withdrawals do not affect the abstraction of the attribute values, and hence
the gross behavior of the object remains unchanged.
However, if the account balance would become negative after a withdrawal,
the behavior of the withdraw function would be quite different. This is because
the state of the bank account is changed from positive to negative; in technical
jargon, a transition from the positive state to the negative state is fired.
Basic and Advanced The abstraction of the attribute value is a property of the system, rather than
56 Structural Modeling a globally applicable rule. For example, if the bank changes the business rule to
allow the bank balance to be overdrawn by 2000 dollars, the state of the bank Object Oriented Analysis
account will be redefined with condition that the balance after withdrawal must and Design
not be less than $2000 in deficit.
Note That NOTES
• A state machine diagram describes all events (and states and transitions
for a single object)
• A sequence diagram describes the events for a single interaction across
all objectsinvolved Basic Concepts of State Machine Diagram
Events
An event signature is described as Event-name (comma-separated-
parameter-list). Events appear in the internal transition compartment of a state
or on a transition between states. An event may be one of four types:
1. Signal event - corresponding to the arrival of an asynchronous message
or signal
2. Call event - corresponding to the arrival of a procedural call to an
operation
3. Time event - a time event occurs after a specified time has elapsed
4. Change event - a change event occurs whenever a specified condition
is met Characteristics of Events are given as –
• Represents incidents that cause objects to transition from one
state to another.
• Internal or External Events trigger some activity that changes the
state of the system and of some of its parts
• Events pass information, which is elaborated by Objects
operations. Objects realize Events
• Design involves examining events in a state machine diagram
and considering how those events will be supported by system
objects
Transition
Basic and Advanced Transition lines depict the movement from one state to another. Each
58 Structural Modeling transition line is labeled with the event that causes the transition. Viewing a
system as a set of states and transitions between states is very useful for Object Oriented Analysis
describing complex behaviors. Understanding state transitions is part of system and Design
analysis and design and a Transition is the movement from one state to another
state. Transitions between states occur as follows: NOTES
1. An element is in a source state
2. An event occurs
3. An action is performed
4. The element enters a target state
Multiple transitions occur either when different events result in a state
terminating or when there are guard conditions on the transitions. A transition
without an event and action is known as automatic transitions.
Actions
Action is an executable atomic computation, which includes operation calls,
the creation or destruction of another object, or the sending of a signal to an
object. An action is associated with transitions and during which an action is not
interruptible - e.g., entry, exit
Activity
Activity is associated with states, which is a non-atomic or ongoing
computation. Activity may run to completion or continue indefinitely. An Activity
will be terminated by an event that causes a transition from the state in which
the activity is defined.
Characteristics of Action and Activities are stated as –
• States can trigger actions
• States can have a second compartment that contains actions or activities
performed while an entity is in a given state
• An action is an atomic execution and therefore completes without
interruption
• Five triggers for actions: On Entry, Do, On Event, On Exit, and Include
• An activity captures complex behavior that may run for a long duration
- An activity may be interrupted by events, in which case it does not
complete occur when an object arrives in a state.
A Simple State Machine Diagram using all above discussed notations
can be given as -
Substates
A simple state is one which has no substructure. A state which has substates
(nested states) is called a composite state. Substates may be nested to any level.
A nested state machine may have at most one initial state and one final state.
Substates are used to simplify complex flat state machines by showing that some
states are only possible within a particular context (the enclosing state).
Substate Example - Heater
Concurrent State
As mentioned above, states in state machine diagrams can be nested.
Related states can be grouped together into a single composite state. Nesting
states inside others is necessary when an activity involves concurrent sub-
activities. The following state machine diagram models an auction with two
concurrent substates: processing the bid and authorizing the payment limit.
Concurrent State Machine Diagram Example - Auction Process
In this example, the state machine first entering the Auction requires a fork
at the start into two separate start threads. Each substate has an exit state to mark
the end of the thread. Unless there is an abnormal exit (Canceled or Rejected),
Basic and Advanced the exit from the composite state occurs when both substates have exited.
60 Structural Modeling
Object Oriented Analysis
and Design
NOTES
Package Diagram
Package diagram, a kind of structural diagram, shows the arrangement and
organization of model elements in middle to large scale project. Package diagram
can show both structure and dependencies between sub-systems or modules,
showing different views of a system, for example, as multi-layered (aka multi-
tiered) application - multi-layered application model.
Package diagrams are used to structure high level system elements.
Packages are used for organizing large system which contains diagrams,
documents and other key deliverables.
• Package Diagram can be used to simplify complex class diagrams, it can
group classes into packages.
• A package is a collection of logically related UML elements.
• Packages are depicted as file folders and can be used on any of the UML
diagrams.
Package diagram is used to simplify complex class diagrams, where classes
are grouped into packages. A package is a collection of logically related UML
elements.
The diagram below is a business model in which the classes are grouped
into packages:
• Packages appear as rectangles with small tabs at the top.
• The package name is on the tab or inside the rectangle.
• The dotted arrows are dependencies.
• One package depends on another if changes in the other could possibly
force changes in the first.
NOTES
NOTES
Fig 3.6 : ‘access’ dependency between two packages
Source : https://www.visual-paradigm.com/guide/uml-unified-
modeling-language/what-is- package- diagram/
For designing package diagram for nay system the steps can be defined as
• Identify classes from class diagram with similar functionalities or
participating in related use cases.
• Group the classes and form a package.
• Define all required packages.
• Find dependencies and type of dependencies between packages.
• Show all classes with their dependencies which forms the package
diagram for the entire system.
Here designing process for package diagram can be explained with the
example. The package diagram is to be designed for "Track Order" scenario for
an online shopping store. Track Order module is responsible for providing
tracking information for the products ordered by customers. Customer types in
the tracking serial number, Track Order modules refers the system and updates
the current shipping status to the customer. The next explanation explains steps
for designing package diagram for ‘Order subsystem’.
• Identify the packages of the system - Based on the project Description
first identify the packages in the system and then related them together
according to the relationship:
• There is a track order module, it has to talk with other module to know
about the order details, let us call it "Order Details".
• Next after fetching Order Details it has to know about shipping details,
let us call that as "Shipping".
NOTES
NOTES
*****
UNIT NO - IV
INTERACTION MODELLING
NOTES
Introduction
The use case diagram and activity diagram are two behavioral diagrams
which were covered in chapter two. Each use case in Use case diagram represents
reactions or functionality of the system while activity diagram explains each use
case step by step. These are the processes carried out as a part of each
functionality.
The class diagrams and other diagrams based on the class diagram, like state
transition diagram and package diagram which comes under the structural
category. The classes forms basic structure of the software system. The class
diagram, along with classes, also shows relations among objects to explain how
data is shared among them through interacting with each other. The interaction
between objects takes place only if required or demand of any functionality.
Now a designer and a developer need to understand participation of different
objects in different functionalities. For the purpose the designer can refer to two
diagrams class or object diagram and activity diagram to find the objects
participating in the functionality. The participating objects shares data with each
other as per the requirement of the functionality by interacting with each other.
The diagrammatic representation of interaction of objects is known as interaction
diagram. The interaction diagram also explains the sequence of interaction. In
UML three interaction diagrams can be used – namely sequence diagram,
collaboration diagram and interaction overview diagram. Any one of these three
can be used for representing the interaction for different functionalities.
Interaction Diagrams
It is a third category of UML diagrams under which there are three
diagrams. These interaction diagrams previously were considered under
behavioural category. So originally these diagrams were behavioural diagrams.
Interaction The behavioural diagrams explains behaviour of the system. Though these
68 Modelling diagrams were considered as behavioural diagrams, they does not directly deals
with coding reactions of the system like other behavioural diagrams does. The Object Oriented Analysis
basic idea behind interaction diagrams is to explain interaction between objects, and Design
and therefore in recent versions of UML a new category of diagrams was added
as ‘Interaction Diagrams’. NOTES
Design of any system starts with use case diagram and activity diagram.
These two diagrams explains behaviour or reactions of system while handling
different situations. The next diagrams are class diagram and object diagram,
which explains structure of the system. The next challenge for a designer is to
explain role of objects in completion of the activity, as objects are the only entities
in any object oriented system to complete any activity. Interaction diagrams are
based on two diagrams- class diagram and activity diagram. These two diagrams
need to be referred while going for any type of interaction diagram.
Collaboration Diagram
Collaboration diagrams also known as Communication Diagram in UML
2.x. As stated above it comes under the category of interaction diagrams. The
word collaboration itself explains the diagram as ‘the action of working with
other objects to complete the activity’. It represents diagrammatically the Interaction
sequence of communication taking place among number of objects from the Modelling 69
Object Oriented Analysis system while completing a particular use case. Following are points which help
and Design to understand collaboration diagram –
• A Collaboration is a collection of named objects and actors with links
NOTES connecting them. They collaborate in performing some task.
• A Collaboration defines a set of participants and relationships that are
meaningful for a given set of purposes
• A Collaboration between objects working together provides emergent
desirable functionalities in Object-Oriented systems
• Each object (responsibility) partially supports emergent functionalities
• Objects are able to produce (usable) high-level functionalities by working
together
• Objects collaborate by communicating (passing messages) with one
another in order to work together
So, here are some use cases that we want to create a collaboration
diagram for:
• Model collaborations between objects or roles that deliver the
functionalities of use cases and operations
• Model mechanisms within the architectural design of the system
• Capture interactions that show the messages passing between objects and
roles within the collaboration
• Model alternative scenarios within use cases or operations that involve
the collaboration of different objects and interactions
• Support the identification of objects (hence classes) that participate in
use cases
• Each message in a collaboration diagram has a sequence number.
• The top-level message is numbered 1. Messages sent during the same
call have the same decimal prefix but suffixes of 1, 2, etc. according to
when they occur.
Following table 4.1 explains different symbols used in collaboration
diagram.
Interaction
70 Modelling
Object Oriented Analysis
and Design
NOTES
Interaction
Modelling 71
Object Oriented Analysis
and Design
NOTES
Sequence Diagram
A sequence diagram is the most commonly used UML interaction diagram.
A sequence diagram simply depicts interaction between objects in a sequential
order i.e. the order in which these interactions take place. Sequence diagrams
describe how and in what order the objects in a system function. These diagrams
are widely used by businessmen and software developers to document and
understand requirements for new and existing systems.
It is the popular interaction diagram as it considers objects, its lifetime,
activation, message passing and much more aspects of interaction. Moreover
these are easy to understand as the arrangement of symbols is done so that at a
first glance any business person can understand how the interaction takes place.
Interaction The symbols used in sequence diagram are explained below while explaining
72 Modelling
notations for the diagram. In addition to these notations sequence diagram Object Oriented Analysis
provides a group of symbols which can handle different situations which can be and Design
faced during interaction while completing the activity.
Following are uses of sequence diagrams, which explains how sequence NOTES
diagram can help in construction of the system –
• Used to model and visualise the logic behind a sophisticated function,
use case or procedure.
• They are also used to show details of UML use case diagrams.
• Used to understand the detailed functionality of current or future systems.
• Visualise how messages and tasks move between objects or components
in a system. Sequence Diagrams captures:
• the interaction that takes place in a collaboration that either realizes a use
case or an operation (instance diagrams or generic diagrams)
• high-level interactions between user of the system and the system,
between the system and other systems, or between subsystems
(sometimes known as system sequence diagrams)
• Model high-level interaction between active objects in a system
• Model the interaction between object instances within a collaboration
that realizes a use case
• Model the interaction between objects within a collaboration that realizes
an operation
• Either model generic interactions (showing all possible paths through the
interaction) or specific instances of a interaction (showing just one path
through the interaction)
Sequence Diagrams show elements as they interact over time and they are
organized according to object (horizontally) and time and lifeline (vertically),
hence the sequence diagram is drawn considering two axis, X-axis to represent
objects while the time and lifeline of objects on Y-axis. Firstly we will see
notations used in sequence diagram which are explained in table 4.2.
Interaction
Modelling 73
Object Oriented Analysis
and Design
NOTES
Interaction
74 Modelling
Object Oriented Analysis
and Design
NOTES
Interaction
Modelling 75
Object Oriented Analysis • The diagram starts on upper x-axis. To start with diagram firstly list all
and Design involved objects on x-axis sequentially from left to right as they
participate in the activity.
NOTES • The vertical y-axis represents time proceedings (or progressing) down
the page. Here though we are saying time is all about ordering, not
duration. The lifeline is shown vertically on y-axis. The lifeline for each
object represents that the object is ready or created previously but not
being used.
• The very first object on x-axis is activated first, which is represented by
vertical rectangle. The height of vertical rectangle represents activation
period.
• The activated object sends message to the next object in the list. The
message passing is represented with horizontal line which is headed with
the functionality name from class used for sending messages.
• After receiving message from previous object, the object is activated. If
in case the object wants to send acknowledgement to the sending object,
it passes message to the previous object in opposite direction. It is the
first message send by receiving object.
• After activation it sends message to the next object in the list and the next
object is activated.
In complex activities where more decisions are to be taken and accordingly
activity is executed, or in some situation a particular activity is executed
iteratively. In such activities the sequence diagram can have different fragments.
The fragment operator was introduced in UML 2.0 which shown in diagram 4.2.
NOTES
References
• https://www.geeksforgeeks.org/unified-modeling-language-uml-
sequence-diagrams/
*****
Interaction
Modelling 77
Object Oriented Analysis
and Design
UNIT NO - V
ARCHITECTURAL MODELLING
NOTES
Introduction
The word ‘architecture’ is widely used in construction business, which
defines ‘the art or practice of designing and building structures and especially
habitable ones’. Now a days after development of new types of software it is also
being used in ‘computer field’ also. In the field of ‘Information Technology’ its
meaning is ‘the manner in which the components of a computer or computer
system are organized and integrated’. When we are talking about the architecture
of any Information System, it refers both – Hardware as well as software. While
designing any software system, the designer need to pay attention towards
hardware components and software components separately.
The chapter discusses two different types of diagrams which deals with
Software architecture and hardware architecture. The first is the ‘component
diagram’, which represents different components of the software and
relationships or connections between these components. While the other diagram
is the ‘deployment diagram’, which explains different hardware components
being used by the software while accomplishing the tasks assigned to software
and their relationships.
Architectural Modelling
Software architecture refers to the fundamental structures of a software
system, which comprises software elements, relations among them, and
properties of both, elements and relations. By the time of developing various
types of software architecture has been introduced which satisfies different
requirements of the client. These types of software architecture have been
discussed in the 5.3.3 subsection.
Architectural
78 Modelling
With other software design, the designer also needs to give a thought for Object Oriented Analysis
Software architecture. Along with the software artifacts, a designer plans about and Design
arrangement and connectivity of these software artifacts and accordingly the
relations between components is defined. This has to be done in design phase NOTES
only, as it keeps him free for fundamental structural choices. In later stages if the
changes are to be implemented then it adds to the cost of the project. According
to the need of the system the design of architecture may change. For example,
for the system which are more data centric then a dedicated data server need to
be used and at the same time designer should be able to visualize the growth rate
of data. In case the data growth rate is high, to manage this big data according
architecture should be considered while in design phase. Similarly some systems
may be distributed systems or may be real time systems, accordingly architecture
for those should be designed.
Advantages of documenting software architecture can be given as –
• Facilitates communication between stakeholders,
• Captures early decisions about the high-level design,
• Allows reuse of design components between projects.
Any real-world system is used by different users. The users can be
developers, testers, business people, analysts, and many more. Hence, before
designing a system, the architecture is made with different perspectives in mind.
The most important part is to visualize the system from the perspective of
different viewers. The better we understand the better we can build the system.
Component Diagram
Before understanding Component diagram we need to understand what do
we understand with the ‘software component’. A ‘software component’ is a
modular, portable, replaceable, and reusable set of well-defined functionality that
encapsulates its implementation and exporting it as a higher- level interface. It is
a collection of software artifacts like a software package, a web service, a web
resource, or a module that encapsulates a set of related functions (or data). For
example,
• A package in ‘hospital management system’ which consists of all classes
dealing with GUI (Graphical User Interface) can be called as ‘a GUI
component’ in Hospital Management System.
• A group of packages like ‘ICU patients’, ‘Ward’, ‘Bill’ which deals with
‘ICU Patients’ can be defined as ‘ICU Component’ in Hospital
Management System.
• A web service added for online payment forms a component
A ‘component diagram’ represents components in the system and their
relationships with each other. Technically a ‘component diagram’ can be defined
as ‘an architectural diagram which focuses on the decomposition of the design Architectural
into individual functional or logical components’. Along with components the Modelling 79
Object Oriented Analysis diagram also represents well-defined communication interfaces containing
and Design methods, events, and properties. It provides a higher level of abstraction and
divides the problem into sub- problems, each associated with component
NOTES partitions.
The primary objective of component-based architecture is to ensure
component reusability. A component encapsulates functionality and behaviours
of a software element into a reusable and self- deployable binary unit. There are
many standard component frameworks such as COM/DCOM, JavaBean, EJB,
CORBA, .NET, web services, and grid services. These technologies are widely
used in local desktop GUI application design such as graphic JavaBean
components, MS ActiveX components, and COM components which can be
reused by simply drag and drop operation.
Component-oriented software design has many advantages over the
traditional object-oriented approaches such as −
• Reduced time in market and the development cost by reusing existing
components.
• Increased reliability with the reuse of the existing components.
• Components are designed to operate in different environments and
contexts.
• A component can be extended from existing components to provide new
behaviour.
• A component depicts the interfaces, which allow the caller to use its
functionality, and do not expose details of the internal processes or any
internal variables or state.
• Components are designed to have minimal dependencies on other
components.
Following subsections discusses need and process for developing
component diagram for the system.
Architectural
80 Modelling
The purpose of the component diagram can be summarized as − Object Oriented Analysis
and Design
• Visualize the components of a system.
• Construct executables by using forward and reverse engineering.
NOTES
• Describe the organization and relationships of the components.
The purpose of this diagram is different. Component diagrams are used
during the implementation phase of an application. However, it is prepared well
in advance to visualize the implementation details. These diagrams show the
physical components of a system. To clarify it, we can say that component
diagrams describe the organization of the components in a system. Organization
can be further described as the location of the components in a system. These
components are organized in a special way to meet the system requirements. As
we have already discussed, those components are libraries, files, executables,
etc. Before implementing the application, these components are to be organized.
This component organization is also designed separately as a part of project
execution. Component diagrams are very important from implementation
perspective. Thus, the implementation team of an application should have a
proper knowledge of the component details
Component diagrams can be used to −
• Model the components of a system.
• Model the database schema.
• Model the executables of an application.
• Model the system's source code.
Advantages of component diagram can be stated as-
• Ease of deployment − As new compatible versions become available, it
is easier to replace existing versions with no impact on the other
components or the system as a whole.
• Reduced cost − The use of third-party components allows you to spread
the cost of development and maintenance.
• Ease of development − Components implement well-known interfaces
to provide defined functionality, allowing development without
impacting other parts of the system.
• Reusable − The use of reusable components means that they can be used
to spread the development and maintenance cost across several
applications or systems.
• Modification of technical complexity − A component modifies the
complexity through the use of a component container and its services.
• Reliability − The overall system reliability increases since the reliability
of each individual component enhances the reliability of the whole
system via reuse. Architectural
Modelling 81
Object Oriented Analysis • System maintenance and evolution − Easy to change and update the
and Design implementation without affecting the rest of the system.
• Independent − Independency and flexible connectivity of components.
NOTES Independent development of components by different group in parallel.
Productivity for the software development and future software
development.
Realization of Components
Recognizes all design classes that correspond to the problem domain as
defined in the analysis model and architectural model.
• Recognizes all design classes that correspond to the infrastructure
domain.
• Describes all design classes that are not acquired as reusable components,
and specifies message details.
• Identifies appropriate interfaces for each component and elaborates
attributes and defines data types and data structures required to
implement them.
• Describes processing flow within each operation in detail by means of
pseudo code or UML activity diagrams.
• Describes persistent data sources (databases and files) and identifies the
classes required to manage them.
• Develop and elaborates behavioral representations for a class or
component. This can be done by elaborating the UML state diagrams
created for the analysis model and by examining all use cases that are
relevant to the design class.
• Elaborates deployment diagrams to provide additional implementation
detail.
• Demonstrates the location of key packages or classes of components in
a system by using class instances and designating specific hardware and
operating system environment.
• The final decision can be made by using established design principles
and guidelines. Experienced designers consider all (or most) of the
alternative design solutions before settling on the final design model.
Component diagrams are used to describe the physical artifacts of a system.
This artifact includes files, executables, libraries, etc. Initially, the system is
designed using different UML diagrams and then when the artifacts are ready,
component diagrams are used to get an idea of the implementation.
This diagram is very important as without it the application cannot be
implemented efficiently. A well-prepared component diagram is also important
Architectural for other aspects such as application performance, maintenance, etc.
82 Modelling
Before working a component diagram, the following artifacts are to be Object Oriented Analysis
identified clearly − and Design
Relating Components
Component diagrams are different in terms of nature and behaviour.
Component diagrams are used to model the physical aspects of a system. Now
the question is, what are these physical aspects? Physical aspects are the elements
such as executable, libraries, files, documents, etc. which reside in a node.
Component diagrams are used to visualize the organization and
relationships among components in a system. These diagrams are also used to
make executable systems.
Creates a naming conventions for components that are specified as part of
the architectural model and then refines or elaborates as part of the component-
level model.
• Attains architectural component names from the problem domain and
ensures that they have meaning to all stakeholders who view the
architectural model. Architectural
Modelling 83
Object Oriented Analysis • Extracts the business process entities that can exist independently without
and Design any associated dependency on other entities.
• Recognizes and discover these independent entities as new components.
NOTES
• Uses infrastructure component names that reflect their implementation-
specific meaning.
• Models any dependencies from left to right and inheritance from top
(base class) to bottom (derived classes).
• Model any component dependencies as interfaces rather than representing
them as a direct component-to-component dependency.
Deployment Diagram
One of the advantages of UML diagrams is while designing it does not
consider only software but also hardware through deployment diagram. After
software components, now the designer need to think and visualize about the
physical arrangement of physical components used for the system. So for
visualizing the topology of the physical components of the system ‘deployment
diagrams’ are used. Using these physical components the software components
are deploed. Deployment diagrams are used to describe the static deployment
view of a system. Deployment diagrams consist of nodes and their relationships.
Using deployment diagram
Architecture of System
The architecture of any software system can be defined as selection and
arrangement of hardware, network topology and deployment of different software
components on these hardware components, is in all known as architecture of
system.
Architectural
Modelling 85
Object Oriented Analysis
and Design
NOTES
2. Data-flow architecture
• This architecture is applied when the input data is converted into
a series of manipulative components into output data.
• A pipe and filter pattern is a set of components called as filters.
• Filters are connected through pipes and transfer data from one
component to the next component.
• The flow of data degenerates into a single line of transform then
it is known as batch sequential.
4. Object-oriented architectures
• This architecture is the latest version of call-and-return architecture.
• It consist of the bundling of data and methods.
5. Layered architectures
• The different layers are defined in the architecture. It consists of
outer and inner layer.
• The components of outer layer manage the user interface operations.
• Components execute the operating system interfacing at the inner
layer.
• The inner layers are application layer, utility layer and the core layer.
• In many cases, It is possible that more than one pattern is suitable
and the alternate architectural style can be designed and
Architectural
evaluated.
86 Modelling
Object Oriented Analysis
and Design
NOTES
*****
Architectural
88 Modelling
Object Oriented Analysis
and Design
UNIT NO - VI
OBJECT ORIENTED
NOTES
PROGRAMMING STYLES
Introduction
The major characteristic of any Object Oriented Language is reusability,
extensibility and robustness. Any developer of the object oriented software
system also wishes to have same characteristics to be hold by his system.
The designer who is willing to have these characteristics in his system, the
care has to be taken from the designing phase of the system. If the designer
properly implements concepts of OOP while designing the system and if
structural diagrams are designed carefully then the system can hold the properties
of reusability, extensibility and robustness. Design of classes in the system helps
to achieve the above discussed characteristics.
The chapter discusses how a designer can design a system so that it will be
reusable, extensible and robust.
I. Reusability
The term reusability can be explained as using the previously defined
software artifacts or processes for developing new artifacts. The concepts of
Object Oriented Paradigms, like inheritance, polymorphism and message passing,
allows user to develop reusable software components which can be used for
developing more artifacts. Reusability saves efforts of the designer as well as
programmer of writing same program code again, so with this the existing
investment can be reused. Framework, Software components, chunks of code
can be designed so that it can be reused.
Software framework is represented by its code which consists of a set of
classes, abstract classes and interfaces, a set of behavior and a set of hooks where
subclasses can insert their specialized behavior. The framework is to be designed
in such a way so that code, design, domain analysis can be reusable. Once the
framework has become reusable it reduces code writing efforts and also gives
opportunity for inexperienced designers and developers to develop good software
as the well-developed framework represents the extract of knowledge of
experimented designers and programmers. Reuse of framework components
improves developer productivity, as well as software performance, reliability,
and interoperability. The stable interfaces define generic components that can be
extended to create new applications.
Like framework components, which contributes to the framework a lot,
needs to be designed reusable. In the previous chapter we have discussed about
the components and the component diagram. Components are the software
artifacts which may consists of any framework, packages designed by designer
of the system, classes, chunks of codes (functions), etc. while a component
diagram shows the dependency between components of the system. A designer
can make his system reusable by concentrating on the design of these various
components.
Techniques used for reusability are –
• Object composition and
• Inheritance
These techniques help for reusing functionality in object-oriented systems.
Class inheritance allows a subclass implementation to be defined in terms of the
Object Oriented parent class implementation. This type of reuse is often called white-box reuse.
90 Programming Styles
Object composition is a different method of reusing functionality. Objects are Object Oriented Analysis
composed to achieve more complex functionality. This approach requires that and Design
the objects have well-defined interfaces since the internals of the objects are
unknown. Because objects are treated only as black boxes, this type of reuse is NOTES
often called black-box reuse. The components can be reusable if those are
generalized in definition.
Following are tricks which help to make the components more reusable-
i. Components should be designed to work on different context so that
they can be easily reused instead of defining new.
ii. Generalize design as much as possible by using Frameworks, Patterns,
and UML Collaborations. Frameworks or reusable patterns helps to
keep design more flexible and hence can be reused in different
scenarios.
iii. Design the system to contain hooks.
iv. Keep the design as simple as possible.
II. Extensibility –
The feature of Extensibility makes system easily upgradable. It is a system
design principle where the implementation takes future growth into
consideration. When a designer thinks about extensibility he needs to consider
various aspects of the system, which will help to extend the system in future.
Extensions can be through the addition of new functionality or through
modification of existing functionality.
In any Object Oriented Software System the least element is ‘a class’, which
plays a major role in extending the system. While designing a class the designer
should think and try to implement maximum concepts so that the class can hold
the feature of extensibility without violating or introducing major changes in
original data. The care, while designing the class, has to be taken so that the
extensibility of system does not compromise the data security.
The central theme is to provide for change typically enhancements while
minimizing impact to existing system functions.
Like classes in the system, the framework of the system can also be
designed to be extensible. A framework enhances extensibility by providing
explicit hook methods for planned variability. These hook methods allows
developer to extend the functionalities.
The extensibility mechanisms are classified as
• White-Box extensibility - White-box extensibility refers to the ways in
which a software system can be extended by modifying or adding to the
source code. This is the least restrictive and most flexible form of
extensibility.
Object Oriented
Programming Styles 91
Object Oriented Analysis • Glass-Box extensibility - Glass-box extensibility refers to the ways in
and Design which a software system may be copied, when the source code is
available, but may not be modified. Programmers that want to extend the
NOTES system can view the code, but they have to separate their extensions from
the original system in a way that does not affect the original system.
• Black-Box extensibility - Black-box extensibility refers to the ways in
which a software system may be extended when no internal details about
a system’s architecture and implementation are available. Black-box
extensible systems are deployed and extended only by using their
interface specification. This approach allows system manufacturers to
fully encapsulate their systems and hide all implementation details.
Though till the discussion on extensibility and reusability was carried out
separately, there are some similarities in both the concepts. Both of them
emphasis on low coupling, modularity and high cohesion. Software reusability
is boosted by extensibility and refers to software elements ability to construct
for many different software systems, which is motivated by the observation of
software systems often sharing common elements. Reusability together with
extensibility allows a technology to be transferred to another project with less
development and maintenance time, as well as enhanced reliability and
consistency
Robustness
‘Robustness’ is again one of the characteristics of programming, which is
supported by most of the Object Oriented Programming Languages. The term
‘robustness’, with reference to programming languages can be explained as ‘the
ability of a computer system to cope with errors during execution as well as to
cope with erroneous input given to the program. For example the concept of
‘exception handling’, as learnt in java, helps to write robust programs.
A designer or a developer always tries to design or write programs which
will be error tolerant. Not only OOAD, but in other areas of computer science
also aims towards writing robust programs such as robust programming, robust
machine learning, and Robust Security Network. Various commercial software
products perform robustness testing of software analysis. This testing assures
stakeholders robustness of the software product.
For building a robust software system, the system is tested with all possible
input and all possible input combinations. Testing with all possible inputs and
their combinations helps to check the system ay every point of possible failure
due to unexpected input. But in reality it is difficult because of the vast quantity
of inputs and input combinations. Since all inputs and input combinations would
require too much time to test, developers cannot run through all cases
exhaustively. And therefore easiest way for developers is to generalize such cases.
The above situation can be explained with the help of a simple example. A
Object Oriented program expects an integer as an input. While some selected inputs might consist
92 Programming Styles
of a negative number, zero, and a positive number. When using these numbers Object Oriented Analysis
to test software in this way, the developer generalizes the set of all reals into three and Design
numbers. This is a more efficient and manageable method, but more prone to
failure. Generalizing test cases is an example of just one technique to deal with NOTES
failure—specifically, failure due to invalid user input. Systems generally may
also fail due to other reasons as well, such as disconnecting from a network.
Regardless, complex systems should still handle any errors encountered
gracefully. There are many examples of such successful systems. Some of the
most robust systems are evolvable and can be easily adapted to new situations.
To overcome the situation we can have different programming constructs
to handle a particular situation so that if a particular functionality is not working
or fails to give expected results we can go for the other to handle the same
situation.
Object Oriented
94 Programming Styles
b. Activity diagram – Activity Diagram for Use Case ‘Lend Item’ Object Oriented Analysis
and Design
NOTES
Object Oriented
Programming Styles 95
Object Oriented Analysis c. Class diagram
and Design
NOTES
Object Oriented
96 Programming Styles
Object Oriented Analysis
and Design
NOTES
f. Collaboration diagram
Object Oriented
Programming Styles 97
Object Oriented Analysis g. Component diagram
and Design
NOTES
h. Deployment diagram
Object Oriented
98 Programming Styles
b. Activity Diagram – Activity Diagram for use case ‘Visit for Test’ Object Oriented Analysis
and Design
NOTES
Object Oriented
Programming Styles 99
Object Oriented Analysis c. Class Diagram
and Design
NOTES
Object Oriented
100 Programming Styles
e. Collaboration Diagram Object Oriented Analysis
and Design
NOTES
f. Sequence Diagram
Object Oriented
Programming Styles 101
Object Oriented Analysis Online Shopping
and Design
(Source : https://www.uml-diagrams.org/examples/online-shopping-
example.html)
NOTES
a. Use case diagram
b. Activity diagram
Object Oriented
102 Programming Styles
c. Component diagram Object Oriented Analysis
and Design
NOTES
Nukari.com
a. Use case
(Source : https://stackoverflow.com/questions/21534446/online-job-
portal- system-use-case-diagrams)
Object Oriented
Programming Styles 103
Object Oriented Analysis b. Class diagram
and Design
(Source : https://www.geekletters.com/online-job-portal-project-uml-
diagrams/)
NOTES
c. Activity diagram
Object Oriented
104 Programming Styles
Matrimonial Website Object Oriented Analysis
and Design
(Source : https://meeraacademy.com/)
a. Use case diagram
NOTES
Object Oriented
Programming Styles 105
Object Oriented Analysis b. Activity Diagram – for user MEMBER
and Design
NOTES
Object Oriented
106 Programming Styles
c. Activity Diagram – for User ADMIN Object Oriented Analysis
and Design
NOTES
Object Oriented
Programming Styles 107
Object Oriented Analysis d. Class diagram
and Design
(Source : https://www.freeprojectz.com/uml/marriage-beuro-
management-class-diagram)
NOTES
*****
Object Oriented
108 Programming Styles