Block 1
Block 1
Block 1
ORIENTED MODELING
Structure Page Nos.
1.0 Introduction 7
1.1 Objectives 7
1.2 Object Oriented Modeling 8
1.3 Basic Philosophy of Object Orientation 10
1.4 Characteristics Object Oriented Modeling 11
1.4.1 Class and Objects
1.4.2 Links and Association
1.4.3 Generalization and Inheritance
1.5 An Object Model 16
1.6 Benefits of OO Modeling 17
1.7 Introduction to OOA& Design Tools 17
1.8 Summary 19
1.9 Solutions/Answers 19
1.0 INTRODUCTION
Object oriented design methods emerged in the 1980s, and object oriented analysis
methods emerged during the 1990s. In the early stage, object orientation was largely
associated with the development of graphical user interfaces (GUIs), and a few other
applications became widely known. In the 1980s, Grady Booch published a paper on
how to design for Ada, and gave it the title, Object Oriented Design. In 1991, Booch
was able to extend his ideas to a genuinely object oriented design method in his book
with the same title, revised in 1993 (Booch, 1994) [sic].
The Object Modeling Technique (OMT) covers aspects of object oriented analysis and
design. OOT provides a very productive and practical way of Software development.
As object oriented Technology (OOT) is not language dependent, there is no need for
considering a final implementation language, during Object Oriented Modeling
(OOM). OOT combine structural, control and functional aspects of the system. We
will discuss the structural, control and functional aspects of the systems in great detail
in block 3 of this course.
In this unit, we will discuss the basic notions of object orientation. This unit will cover
discussion on objects, classes, links, association, generalization, and inheritance. We
will discuss the basics of an object model with the help of an example. Towards the
end of this unit we will cover the benefits of OOM. In this unit, you will also be
introduced to some OOAD tools.
1.1 OBJECTIVES
7
Object Oriented
Modeling and UML 1.2 OBJECT ORIENTED MODELING
Object oriented modeling is entirely a new way of thinking about problems. This
methodology is all about visualizing the things by using models organized around real
world concepts. Object oriented models help in understanding problems,
communicating with experts from a distance, modeling enterprises, and designing
programs and database. We all can agree that developing a model for a software
system, prior to its development or transformation, is as essential as having a blueprint
for large building essential for its construction. Object oriented models are represented
by diagrams. A good model always helps communication among project teams, and to
assure architectural soundness.
It is important to note that with the increasing complexity of systems, importance of
modeling techniques increases. Because of its characteristics Object Oriented
Modeling is a suitable modeling technique for handling a complex system. OOM
basically is building a model of an application, which includes implementation details
of the system, during design of the system.
Brooks observes that the As you know, any system development refers to the initial portion of the software life
hard part of software cycle: analysis, design, and implementation. During object oriented modeling
development is the identification and organization of application with respect to its domain is done, rather
manipulation of its essence than their final representation in any specific programming language. We can say that
due to the inherent OOM is not language specific. Once modeling is done for an application, it can be
complexity of the problem, implemented in any suitable programming language available.
rather than the accidents of
its mapping into a particular OOM approach is a encouraging approach in which software developers have to think
language, which are due to in terms of the application domain through most of the software engineering life
temporary imperfections in cycle. In this process, the developer is forced to identify the inherent concepts of the
our tools that are rapidly application. First, developer organize, and understood the system properly and then
being corrected (Brooks-87). finally the details of data structure and functions are addressed effectively.
In OOM the modeling passes through the following processes:
System Analysis
System Design
Object Design, and
Final Implementation.
System Analysis: In this stage a statement of the problem is formulated and a model
is build by the analyst in encouraging real-world situation. This phase show the
important properties associated with the situation. Actually, the analysis model is a
concise, precise abstraction and agreement on how the desired system must be
developed. You can say that, here the objective is to provide a model that can be
understood and criticized by any application experts in the area whether the expert is a
programmer or not.
System Design: At this stage, the complete system architecture is designed. This is
the stage where the whole system is divided into subsystems, based on both the
system analysis model and the proposed architecture of the system.
Object Design: At this stage, a design model is developed based on the analysis
model which is already developed in the earlier phase of development. The object
design decides the data structures and algorithms needed to implement each of the
classes in the system with the help of implementation details given in the analysis
model.
Final Implementation: At this stage, the final implementation of classes and
relationships developed during object design takes place a particular programming
language, database, or hardware implementation (if needed). Actual implementation
8
should be done using software engineering practice. This helps to develop a flexible Introduction to Object
Oriented Modeling
and extensible system.
Whole object oriented modeling is covered by using three kinds of models for a
system description. These models are:
object model,
dynamic model, and
functional model.
Object models are used for describing the objects in the system and their relationship
among each other in the system. The dynamic model describes interaction among
objects and information flow in the system. The data transformations in the system are
described by a functional model. All three models are applicable during all stages
of development. These models bear the responsibility of acquiring implementation
details of the system development. It is important to note that you cannot describe a
system completely until unless all three modes are described properly. In block 3 of
this course, we will discuss these three models in detail.
Before we discuss the characteristics of object oriented modeling, let us see how
object oriented development is different from structured development of the system.
In the structured approach, the main emphasis is on specifying and decomposing
system functionality. Structured approach is seen as the most direct way of
implementing a desired goal. A structured approach has certain basic problems, such
as, if the requirements of system change then a system based on decomposing
functionality may require massive restructuring, and, the system gradually become
unmanageable. In contrast to the structured approach, the basic focus of object-
oriented approach is to identify objects from the application domain, and then to
associate procedures (methods) around these identified objects.
You can say that object oriented development is an indirect way of system
development because in this approach a holistic view of application domain is
considered, and objects are identified in the related problem domain. A historic
view of application helps in realizing the situations and characteristics of the system.
Taking a holistic view of the problem domain rather than considering functional
requirements of a single problem give an edge to object oriented development.
Once the objects are created with the needed characteristics, they communicate with
each other by message passing during problem solving.
9
Object Oriented
Modeling and UML 1.3 BASIC PHILOSOPHY OF OBJECT
ORIENTATION
There are several characteristics of object-oriented technology. Some of these
characteristics have been discussed in course MCS-024. We have also implemented
some of them in Java programming language, although these characteristics are not
unique to object-oriented systems in the sense that they vary from object based
systems to object oriented systems. However, most of the properties are particularly
well supported in object oriented systems.
Now, let us discuss about the basic characteristics around which object oriented
systems are developed.
Abstraction
Abstraction is one of the very important concepts of object oriented systems
Abstraction focues on the essential, inherent aspects of an object of the system. It does
not represent the accidental properties of the system. In system development,
abstraction helps to focus on what an object is supposed to do, before deciding how it
should be implemented. The use of abstraction protects the freedom to make decisions
for as long as possible, by avoiding intermediate commitments in problem solving.
Most of the modern languages provide data abstraction. With the abstraction, ability
to use inheritance and ability to apply polymorphism provides additional freedom and
capability for system development. When you are using abstraction during analysis,
you have to deal with application-domain concepts. You do not have to design and
make implementation decisions at that point.
Encapsulation
Encapsulation, or information hiding, is the feature of separating the external aspects
of an object, from the internal implementation details of that object. It helps in hiding
the actual implementation of characteristics of objects. You can say that encapsulation
is hiding part of implementation that do internal things, and these hidden parts are not
concerned to outside world. Encapsulation enables you to combine data structure and
behaviour in a single entity. Encapsulation helps in system enhancement. If there is a
need to change the implementation of object without affecting its external nature,
encapsulation is of great help.
Polymorphism
Class hierarchy is the deciding factor in the case of more than one implementation of
characteristics. An object oriented program to calculate the area of different Figures
would simply call the Find_ Area operation on each figure whether it is a circle,
triangle, or something else. The decision of which procedure to use is made implicitly
by each object, based on its class polymorphism makes maintenance easier because
the calling code need not be modified when a new class is added.
Sharing of Structure and Behaviour
One of the reasons for the popularity of object-oriented techniques is that they
encourage sharing at different levels. Inheritance of both data structure and behaviour
allows common structure (base class) to be used in designing many subclasses based
on basic characteristics of base class, and develop new classes with less effort.
Inheritance is one of the main advantages of any object oriented language, because it
gives scope to share basic code.
In a broader way we can say that object oriented development not only allows
information sharing and reuse within an application, but also, it gives a base for
project enhancement in future. As and when there is a need for adding new
characteristics in the system, they can be added as an extension of existing basic
10
features. This can be done by using inheritance, and that too, without major Introduction to Object
Oriented Modeling
modification in the existing code. But be aware that just by using object orientation
you do not get a license to ensure reusability and enhancement. For ensuring
reusability and enhancement you have to have a more general design of the system.
This type of design can be developed only if the system is properly studied and
features of proposed system are explored.
11
Object Oriented In unit 3 of this block, we will cover the standard UML notation for OOM in detail.
Modeling and UML
Here, we will mention about standard notation of class. The notation for a class is a
box with three sections. The top section contains the name of the class in boldface
type, the middle section contains the attributes that belong to the class, and the bottom
section contains the classs operations as you can see in Figure 1.
Class
Attribute
Operations
Class Class
Class
Operations attributes
If you look around you will find many examples of real world objects such as your
books, your desk, your television, etc.
Everything that the software object knows (state) and can do (behaviour) is expressed
by the variables and the methods within that object. In other words, all the objects
share states and behaviour. Let us say that a software object that models your real-
world bicycle would have variables that indicated the bicycles current state: its speed
is 20 mph, and its current gear is the 3rd gear, etc.
12
Communication by Message Passing Introduction to Object
Oriented Modeling
You will agree that a single object alone is generally not very useful. Objects usually
appear as a components of a larger program or a system. Through the interaction of
these objects, functionality of systems are achieved. Software objects interact and
communicate with each other by message passing to each other. When object X wants
object Y to perform one of methods of object Y, object X sends a message to object
Y. Message passing provide two significant benefits:
An objects characteristics are expressed through its methods, so message
passing supports all possible interactions between objects.
It closes the gap between objects. Objects do not need to be in the same process,
or even on the same machine, to send and receive messages back and forth to
each other.
1.4.2 Links and Association
Links and associations are the basic means used for establishing relationships among
objects and classes of the system. In the next subsection we will discuss links and
associations which are used for representing relationship.
General Concepts
A link is a physical or conceptual connection between objects for example, a student,
Ravi study in IGNOU. Mathematically, you can define a link as a tuple that is an
ordered list of objects. Further, a link is also defined as an instance of an association.
In other words you can say that an association is a group of links with a common
structure and common meanings, for example, a student study in a university. All the
links in an association connects objects from the same classes. A link is used to show
a relationship between two (or more) objects.
Association and classes are similar in the sense that classes describe objects, and
association describe links. Figure 4a shows us how we can show the association
between Student and University
association name
Class Class
Figure 4a: Association
Note that every association has roles. For example, in Figure 4b you can see that two
classes, Student and University, have their defined roles. Here you can also see that
binary association has two roles, one from each class.
Role
Student University
Study Teach
Associations may be binary, ternary, or have higher order. In exercise, the vast
majority of association are binary or ternary associations. But a ternary association is
formed compulsion; they cannot be converted into binary association. If a ternary
association is decomposed in some other association, some information will be lost. In
Figure 5 you can see a ternary association.
13
Object Oriented
Modeling and UML Student Teacher
Class
Multiplicity
Multiplicity in an association specifies how many objects participate in a relationship.
Multiplicity decides the number of related objects. Multiplicity is generally explained
as one or many, but in general it is a subset of the non-negative integers.
Table 1: Multiplicity Indicators.
Indicator Meaning
0..1 Zero or one
1 One only
0..* Zero or more
1..* One or more
n Only n (where n > 1)
0..n Zero to n (where n > 1)
1..n One to n (where n > 1)
In associations, generally movement is in both the directions of the relationships but if
you want to be specific in any particular direction, you have to mark it by an arrow as
given in Figure 6.
Multiplicity
Student 1 0* Program
Movement
Aggregation
Aggregation is a special form of association, which models the part-whole or a-
part-of relationship as an aggregate (the whole) and parts. The most considerable
property of aggregation is transitivity, that is, if X is part of Y and Y is part of Z, then
X is part of Z. Aggregation is seen as a relationship in which an assembly class is
related to component class. In this component objects are not having separate
existence, they depend on composite objects as you can see in Figure 7 Exam
Schedule is not having separate existence.
Whole Part
aggregation
14
Introduction to Object
& Check Your Progress 2 Oriented Modeling
1) What is abstraction?
.
..
3) What is multiplicity in associations? Give example to explain multiplicity?
Account
SavingAccount CurrentAccount
15
Object Oriented subclass is seen from a superclass the subclass is seen as a specialized version of
Modeling and UML superclass and in, reverse, a superclass looks like general form of subclass.
During inheritance, a subclass may override a superclass feature by defining that
feature with the same name. The overriding features (the subclass feature with the
same names of superclass features) refines and replaces the overridden feature (the
superclass feature).
Now let us look at the diagram given in Figure 9. In this diagram, Circle, Triangle,
and Square classes are inherited from Shape class. This is a case of single inheritance
because here, one class inherits from only one class.
Shape
Draw ()
Erase ()
Multiple inheritance is shown in Figure 10. Here, one class is inherited from more
than one class.
This diagram covers different levels of students in the hierarchy. Similarly, for other
classes, such as Administration and Faculty, hierarchy level can be drawn to give a
broader view of whole system.
16
University Introduction to Object
Oriented Modeling
Student
PGStudent
PG Student Diploma Student UG Student
PG Diploma UG Diploma
BCA B. Sc BA B.Com
18
Introduction to Object
3) Explain the benefit of OOM. Oriented Modeling
.
.
..
1.8 SUMMARY
In this unit we have discussed the basic notions of object orientation, and the need
for object oriented modeling. It is the basic characteristic of object orientation
which makes it possible to develop systems in such a way that the system is open
for reusability. In this unit, concepts of abstraction, encapsulation, polymorphism
and sharing of structure and behaviour are discussed.
Further, in this unit, we have discussed notions of class and object. We saw that
how inheritance, generalization/specialization, and associations are represented.
In this unit, a hierarchy of classes representing different levels of students in a
University system is representated, reuse and quality are mentioned as benefits of
OOM, and in the last section, some tools, which support UML designs are
mentioned.
1.9 SOLUTIONS/ANSWERS
Check Your Progress 1
1) Object oriented modeling is a approach through which modeling of the
systems are done by visualizing the system based on the real world concepts.
Object oriented modeling is language independent and generally used for
complex system development.
2) Steps involve in OOM are:
System Analysis
System Design
Object Design and
Final implementation.
3) Structured approach of problem solving is based on the concept of
decomposition of system in to subsystem. In this approach of system
development readjustment of some new changes in the system is very
difficult. On the other hand in object oriented approach holistic view of
application domain is considered and related object are identified. Further
classification of objects are done. Object oriented approach give space for
further enhancement of the system without too much increase in systems
complexity.
Check Your Progress 2
1) Abstraction in object orientation is a concept which provide opportunity to
express essential properties of the object without providing much details of
implementation of these properties.
2) Association is used for establishing relationships between classes. Association
describe links between (among) classes. For example, if a professor works in
a university then it can be represented as
19
Object Oriented
Modeling and UML Association name
Works for
Professor University
Multiplicity
Player 1 1 Team
Faculty Administration
Experstudent-Affair
20
Object Oriented Analysis
UNIT 2 OBJECT ORIENTED ANALYSIS
Structure Page Nos.
2.0 Introduction 21
2.1 Objectives 21
2.2 Object Oriented Analysis 22
2.3 Problem Statement: An Example 25
2.4 Differences between Structured Analysis and Object Oriented Analysis 26
2.5 Analysis Techniques 27
2.5.1 Object Modeling
2.5.2 Dynamic Modeling
2.5.3 Functional Modeling
2.6 Adding Operations 34
2.7 Analysis Iteration 36
2.7.1 Refining the Ratio Analysis
2.7.2 Restating the Requirements
2.8 Summary 36
2.9 Solutions/Answers 37
2.0 INTRODUCTION
Object oriented analysis (OOA) is concerned with developing software engineering
requirements and specifications that expressed as a systems object model composed
of a population of interacting objects. The concept of abstraction in object oriented
analysis (OOA) is important. Abstraction may be defined as: the characteristics of an
object which make it unique and reflect an important concept. Analysis is a broad
term, best qualified, as in requirements analysis (an investigation of the requirements)
or object oriented analysis (an investigation of the objects of the problem domain).
OOA views the world as objects with data structures and behaviors and events that
trigger operations, for object behavior changes. The idea is to see system as a
population of interacting objects, each of which is an atomic bundle of data and
functionality, (the foundation of object technology) and provides an attractive
alternative for the development of complex systems.
The problem statement is important for any analysis. It is a general description of the
users difficulties, and desires. The purpose of problem statement is to identify the
general domain in which you will be working.
In this Unit you will study various analysis techniques: object modeling, dynamic
modeling and functional modeling. You will also learn how add operations in system
and how to do refining of the analysis model.
2.1 OBJECTIVES
After going through this unit, you should be able to:
define the concepts of the objects in the system;
express required system behaviour in terms of business objects in the system,
and actions that the user can perform on them;
understand how to define and analyze the problem statement;
explain the purpose of object modeling;
explain dynamic modeling;
describe the event flow between objects and how to draw state diagrams of real
world problems;
explain and understand the importance of functional model;
explain how operations can be added in various analysis techniques, and
explain the importance of iterating or refining the analysis model.
21
Object Oriented
Modeling and UML 2.2 OBJECT ORIENTED ANALYSIS
In this section we will discuss basics of object oriented analysis with the help of object
oriented features.
Analysis
Analysis is not a solution of the problem. Let us see what actually object oriented
(OO) analysis. Analysis emphasizes an investigation of the problem and
requirements, for example, if a new online trading system is desired by a trader, there
may be questions such as, how will it be used? What are its functions?
If you start a project the first question about that project will be how do we get
started? Where do we begin?
The starting point for object oriented analysis is to identify candidate objects and their
relationships.
The first stage can be a simple brain-storming of the possible objects. Then one
method is to go through all the nouns in any documentation about the world you are
analysing, and considering these as candidate objects of the system. Also, you can use
the alternative technologies for developing software engineering requirements and
specifications that include functional decomposition, essential systems analysis, and
structured analysis.
The Process of Development
The approach to development can be an iterative one. It involves repeated refinement
of the object model. The process needs to be controlled by an appropriate project
management process, involving reviews and check pointing at the levels of:
Analysis
Design
Implementation
Post Implementation Review
Object Orientation and Analysis
An Object is something that exists within the problem domain that can be identified
by data and/or behaviour. An example of an object is a car. The data of a car could be
the wheel, brake, seat, etc. The behaviour of the car would be to drive on roads, its
speed, etc.
Object oriented analysis is the concept which actually forces you to think in terms of
the application domain when its behaviour and data known to you.
In OOA the primary focus on identifying objects from the application domain, then
fitting procedures around them.
For example, in the case of the flight information system, the objects would include
Plane, Flight, and Pilot, etc.
The object model has many aspects, which are associated with OO concepts.
Now we will discuss the following principle of OO.
Abstraction, Encapsulation, Identity, Modularity, Hierarchy,
Typing, Concurrency, and Persistence
Abstraction
You understand the term object. Now, let us see how problems are seen as objects,
and find their associated data and behaviour. You will notice that an object is a real
life entity, or abstraction.
22
Object Oriented Analysis
In our daily life we deal with complexity by abstracting details away.
Let us see this with an example of:
Driving a car does not require knowledge of internal combustion engine. It is
sufficient to think of a car as simple transport.
In simple term, abstraction means to focus on the essential, inherent aspects of an
entity, ignoring its accidental properties. Abstraction is a normal process that we do
everyday. When you view the world, you can not possibly take in every minute detail,
so you concentrate on the aspects that are important.
An abstraction is a simplified description of a system that captures the essential
elements of that system (from the perspective of the needs of the modeler), while
suppressing all other elements.
Encapsulation
This separates the interface of an abstraction from its implementation. Taking the
above example of a car, we can now categorize as:
Abstraction Car
Interface Steering, pedals, controls
Implementation Generally, you dont know
Encapsulation also means data hiding, which consists of separating the external
aspects of an object, which are accessible to other objects.
Now let us take a example of the Stack.
A Stack abstraction provides methods like push (), pop (), isEmpty(), isFull(). The
Stack can be implemented as a singly linked list, or a doubly linked list, or an array, or
a binary search tree. This feature is called encapsulation. It hides the details of the
implementation of an object.
The Benefits of Encapsulation
To hide the details of a class, you can declare that data or implementation in its private
part so that any other class clients will not be able to know about. It will have the
ability to change the representation of an abstraction (data structures, algorithms)
without disturbing any of its clients. The major benefit of encapsulation is that you.
By Encapsulation
You can delay the resolution of the details until after the design.
Keep your code modular.
Object Identity
Object identity is a property of an object that distinguishes the objects from all other
objects in the applications. With object identity, objects can contain, or refer to other
objects. You can create an object identity in three ways:
1) You can refer as memory address in programming languages.
In a complete object oriented system each object is given an identity that will be
permanently associated with the object irrespective of the objects structural or state
transitions. The identity of an object is also independent of the location, or address of
the object. Object identity provides the most natural modeling primitive to allow the
same object to be a sub-object of multiple parent objects.
23
Object Oriented Modularity
Modeling and UML
Modularity is closely tied to encapsulation; you may think of modularity as a way of
mapping encapsulated abstractions into real, physical modules. It is a property of a
system that has been decomposed into cohesive and loosely coupled modules.
Cohesion and coupling gives two goals for defining modules. You should make a
module cohesive (shared data structures, similar classes) with an interface that allows
for minimal inter-module coupling.
It is important to remember that the decisions concerning modularity are more
physical issues, whereas the encapsulation of abstractions is logical issues of design.
Hierarchy
This is ranking or ordering of abstraction.
Hierarchy is decided by using the principle of divide and conquer. You can describe
complex objects in terms of simpler objects. This is the property of object oriented
analysis (OOA) which enables you to reuse the code.
You can place an existing class directly inside a new class. The new class can be made
up of any number and type of other objects, in any combination that is needed to
achieve the desired functionality. This concept is called composition (or more
generally, aggregation). Composition is often referred to as a has-a relationship or
part-of relationship, for example, in automobile has an engine or engine is part
of the automobile.
Typing
This enforces object class such that objects of different classes may not be
interchanged. In other words, class can be visualized as a type. Remember that there
are two kinds of typing. This typing does not mean the way you usually type the
letters.
Strong Typing: When any operation upon an object (which is defined) can be
checked at compile time, i.e., type is confirmed forcefully.
Weak Typing: Here, operations on any object can be performed, and you can send
any message to any class. Type confirmation is not essential, but in these type of
language more errors at execution time may occur.
Concurrency
The fundamental concept in computer programming is the idea of handling more than
one task at a time. Many programming problems require that the program be able to:
1) Stop what its doing
2) Currently deal with some other problem, and
3) Return to the main process. There is a large class of problems in which you
have to partition the problem into separately running pieces so that the whole
program can be more responsive. Within a program, these separately running
pieces are called threads, and the general concept is called multithreading.
Currently, if you have more than one thread running that is expecting to access the
same resource then there is a problem. To avoid this problem, a thread locks a
resource, completes its task, and then releases the lock so that someone else can use
the resource. It can lock the memory of any object so that only one thread can use it at
a time. It is important to handle concurrent running programs/threads properly.
Persistance
When you create an object, it exists for as long as you need it, but under no
circumstances do object exist when the program terminates. While this makes sense at
first, there are situations in which it would be incredibly useful if an object could exist
24
Object Oriented Analysis
and hold its information even while the program is not running. When, next time you
start the program, the object would be there and it would have the same information it
had the previous time the program was running. Of course, you can get a similar effect
by writing the information to a file or to a database, but in the spirit of making
everything an object it would be quite convenient to be able to declare an object
persistent and have all the details taken care of for you.
It is important for an analyst to separate the true requirements from design and
implementation decisions.
Problem statement should not be incomplete, ambiguous, and inconsistent. Try to
state the requirements precisely, and to the point. Do not make it cumbersome.
Some requirements seem reasonable but do not work. These kind of requirements
should be identified. The purpose of the subsequent analysis is to fully understand the
problem and its implications, and to bring out the true intent of the Client.
....
................................................................................................................................
2) Give an example of enforcement in Typing.
....
3) What are the benefits of OOA technology?
...
25
Object Oriented 4) Briefly explain what is to be done while defining the problem statement.
Modeling and UML
....
You are already familiar with structured analysis. Now, this is the appropriate time to
have a comparison of OOA and Structured analysis.
The object oriented (OO) analysis design itself does not provide support for
identifying which objects will generate an optimal system design. Specifically, there is
no single diagram that shows all of the interfaces between objects. You will study
object oriented analysis design (OOAD) diagrams in Unit 3 of this course. As you
know, coupling is a major factor in system complexity, not having this information
makes architecture component selection a hit or miss proposition.
Advantages and Disadvantages of Structured Analysis
With experience, you will come to know that most customers understand structured
methods better than object oriented (OO) methods. Since one of the main reasons of
modeling a system is for communication with customers and users, there is an
advantage in providing structured models for information exchange with user groups
or customers.
26
Object Oriented Analysis
In fact, specifications are typically in the form of a simple English language statement
of Work and Requirement Specification. Therefore, the system to be built, must be
understood in terms of requirements (functions the system must perform), that is why
this naturally leads to a structured analysis, at least at the top level. Specifically
structured methods (functional decomposition) provide a natural vehicle for
discussing, modeling, and deriving the requirements of the system.
The disadvantage with structured methods is that they do not readily support the use
of reusable modules. The top down process works well for new development, but does
not provide the mechanisms for designing in the use of existing components. The
top down process of functional decomposition does not lead to a set of requirements
which map well to existing components.
When the requirements do not map cleanly, you have two choices: either you do not
use the existing components, or force fit the requirements to the existing components
and somehow deal with the requirements which are only partially covered by the
existing components, which does not lead to a good successful system. Now, we will
discuss how actually object oriented analysis (OOA) system is performed.
Association relationship
Relationship name
One- to-many
many-to-many
One-to-one
Aggregation
Subtype
Connected to
Generally, a state diagrams allows you to further explore the operations and attributes
that need to be defined for an object. They consist of sets of states which an object is
in, and events which take the object from one state to another.
State: An object may have one or more statesstable points in its life, expressed by the
objects attributes and relationships.
Statename A state
A transition
An initial State
A final state
Acquire Sell
In Library
Return Borrow
On Loan
Return
States may be seen as composite states: a collection of states treated as one state at a
higher level on analysis. In the example above, the state In Library is actually
composed of a sequence of sub-states which the library staff, if not borrowers would
need to know about.
Acquire
In Acquisitions
Classify
Withdraw
Withdrawn On Shelves
Reissue
Return Borrow
On Loan
Renew
Basically any system which you can reasonably model on a computer jumps from
state to state.
The level of state decomposition must be decided by judgement. A too fine grained
model is inappropriate; for example, modeling all the possible ages of an employee as
individual states. Also, a gross decomposition is useless; for example, modeling an
employee as employed or not.
You can ask whether all objects of world have behaviour which can be modeled.
Of course, not all objects have behavior worth modeling. Consider our example from
the field of object oriented nursery rhymes, the sad story of Humpty Dumpty. Clearly,
you would not like to model such trivial examples.
Basically you need to construct a state transition diagram for every object with
significant behaviour. You need not construct one for anything with trivial behaviour.
The reason for doing this is to identify further operations and attributes, to check the
logical consistency of the object and to more clearly specify its behaviour.
31
Object Oriented All the best notations can be used to describe the process they facilitate.
Modeling and UML
Now we have the basic ideas of object models and dynamic models, our approach to
analysis and design (so far) can be summarised as:
Describe Objects
Note: You should also match the events between state diagrams to verify consistency.
Till so far, you have been introduced to object modeling, and dynamic modeling.
Now, we will see what Function modeling is:
2.5.3 Functional Modeling
You know that Data flow modeling is a common technique used for the analysis of a
problem in software engineering. It is exceptionally useful for analyzing and
describing systems where there is a large amount of calculation involved.
Data flow models consist of a number of processes which exchange information. A
process transforms information it receives, and passes the transformed information on
to other processes or to objects in the system. Data flow models can be used to
uncover new operations and new attributes for the object model. Sometimes, new
objects can be discovered too.
Basically you can state that the functional model shows how values are computed. It
describes the decisions or object structure without the regard for sequencing.
It gives you dependency between the various data and the functions that relate them,
giving the flow of data.
Each process needs to be implemented as an operation in one or more of the objects.
Each data item arising from an object must have a corresponding attribute, or set of
attributes in the source object. The data flow diagram (DFD) corresponds to activities
or actions in the state diagrams of the classes.
That is why it is suggested to construct the functional model after the object and
dynamic models.
Now, let us discuss about the creation of the DFD and the functional model.
The approach to data flow diagramming should be as follows:
Create a data flow diagram for each of the major outputs of the system
Work back from the outputs to the inputs to construct the diagram
Add new objects where necessary to the object model as you discover the need
for them in the data flow modeling add new operations and attributes to the
object model as you discover the need for them in the data flow modeling.
One thing you have to remember is that the data flow diagram is not used as a basis
for devising the structure of the system.
Steps in constructing a Functional Model
Identify input and output values
Build data flow diagrams showing functional dependencies
Describe functions
Identify constraints
Specify optimisation criteria.
32
Object Oriented Analysis
Identifying Input and Output Values
First, identify what data is going to be used as input to the system, and what will be
the output from the system. Input and output values are parameters of events between
the system and the outside world. You must note that Input events that only affect the
flow of control, such as cancel, terminate, or continue. They do not supply input
values. For example, supplier code, name, product description, rate per unit, etc. are
the inputs to a sales system.
Build data Flow diagrams showing functional dependencies
Data flow diagrams are useful for showing the functional dependencies. In data flow
diagrams processes are drawn as bubbles, each bubble containing with the name of the
process inside. Arrowhead lines are used to connect processes to each other, and to
objects in the system. The lines are label with the information that is being passed.
Objects are drawn as rectangular boxes, just as in the object model, but usually with
just the name of these objects and not the attributes and operations.
Figure 7: Some objects in figure 7: a simple DFD is given for sales system
Sales
Total Deliveries
Product Price Product
Calculate order
line basic cost
Product VAT Rate
Calculate order
Customer
line discount
Line Total
Customer
Product Discount
Discounted Line
Quantity Total
Discount Rate Calculate
Total
invoice
Calculate
Quantity
Discount Discount and invoice Final
Total
34
Object Oriented Analysis
Accessing from one object to another through the object model can be referred to as
pseudo-attribute like Account.Bank, where account and bank are two separate
objects of their respective classes.
Operations from events
During analysis, events which are sent to the target objects. An operation on the object
are presented as labels on transitions and should not be explicitly listed in the object
model.
Events can be expressed as explicit methods.
You can also implement events by including event handler as part of the system
substrate.
Operations from State Action and Activities
You must see that State actions and activities are actually functions, which can be
defined as the operations on the object model.
Operations from Functions
As you know, function are actually operations on object. These
functions should be simple and summarized on the object model. Organise the
functions into operations on objects. For example, the select operations are really path
traversals in the object model. The operations like withdrawal-money, verify-
password are the operations on class Account of Bank Management system.
You can write as:
account: withdraw (code, amount)->status
account: deposit (code, amount)->status.
35
Object Oriented
Modeling and UML 2.7 ANALYSIS ITERATION
To understand any problem properly you have to repeat the task which implies that
analysis requires repetition. First, just get the overview of the problem, make a rough
draft, and then, iterate the analysis according to your understanding. Finally, you
should verify the final analysis with the client or application domain experts. During
the iteration processes refining analysis and restating of requirement takes place.
2.7.1 Refining the Ratio Analysis
Basically, refinement leads to purity. So to get a cleaner, more understandable and
coherent design, you need to iterate the analysis process.
2.8 SUMMARY
In this Unit you have learned that the goal of analysis is to understand the problem
and the application domain, so that you come out with a well cohesive design. There
is no end or border line between the analysis and the design phase in software
engineering. There are three objectives of the analysis model:
Object oriented analysis (OOA) describes what the customer requires, it establishes as
basis for the creation of a software design, and it defines a set of requirements that can
be validated.
You also remember that the requirement analysis should be designed in such a way
that it should tell you what to be done, not how it is implemented.
The object model is the principal output of an analysis and design process.
Dynamic modeling is elaborated further by adding the concept of time: new attributes
are computed as a function of attribute changes over time. In this unit, after defining
the scenario of typical and exceptional sessions, identify events followed by the
building of state diagrams for each active object showing the patterns of events it
36
Object Oriented Analysis
receives and sends, together with actions that it performs. You should also match the
events between state diagrams to verify consistency.
You have learned that a functional model shows how values are computed; it
describes the decisions, or object structure without regard for sequencing.
It gives you dependency between the various data and the functions that relate them,
giving the flow of data. Here you construct the data flow diagram which interacts with
internal objects and serves as, data stores between iterations. You also specify the
required constraints, and the optimisation criteria.
You have seen that refining and restating will give you more clarity of the analytical
model of the system.
37
Object Oriented Different user classes may require different mental models of the objects in the
Modeling and UML
system. This includes:
What type of objects there are (user objects).
What information the user can know about an object of a particular type (user
object attributes).
How the objects may be related to other objects (relationships).
Object types with subtypes which have additional specialised actions or
attributes, i.e., User object, Container objects, User object action, User object
subtype.
A model of the business objects which end users believe interact with in a GUI
system.
Pick Up
Put Down
Ring in
On Hook On Hook Pick up Off Hook Hung up on Off Hook
Inactive Ringing Connected Inactive
Time Out
Pick Up
Off Hook
Ringing Ringing
Tone Out
38
Using UML
UNIT 3 USING UML
Structure Page Nos.
3.0 Introduction 39
3.1 Objectives 40
3.2 UML: Introduction 40
3.3 Object Modeling Notations: Basic Concepts 41
3.4 Structural Diagram 47
3.4.1 Class Diagram
3.4.2 Object Diagram
3.4.3 Component Diagram
3.4.4 Deployment Diagram
3.5 Behavioral Diagrams 50
3.5.1 Use Case Diagram
3.5.2 Interaction Diagram
3.5.3 Activity Diagram
3.5.4 Statechart Diagram
3.6 Modeling with Objects 55
3.7 Summary 56
3.8 Solutions/Answers 56
3.0 INTRODUCTION
One of the major issues in software development today is quality. Software needs to
be properly documented and implemented. The notion of software architecture was
introduced for dealing with software quality. For successful project implementation
the three essential components are: process, tools and notations. The notation serves
three roles:
as the language for communication,
provide semantics to capture strategic and tactical decisions,
to offer a form that is concrete enough to reason and manipulate
Notation
Process Tools
39
Object Oriented
Modeling and UML 3.1 OBJECTIVES
After going through this unit, you should be able to:
trace the development of UML;
identify and describe the notations for object modeling using UML;
describe various structural and behavioral diagrams;
list the characteristics of various static and dynamic diagrams, and
understand the significance of different components of UML diagrams.
In this Unit we will discuss object modeling notations, structured diagrams and
behavioral diagrams of systems.
Mayer
Harel
Brock
Odell
Mellor
Gamma
Embley
Fusion
Figure 2: The Input for UML development
Static Model
Class Structure
Logical Model Object Structure
Process Structure
The Logical view of a system serves to describe the existence and meaning of the key
abstractions and the mechanism that form the problem space, or that define the system
architecture.
The Physical model describes the concrete software and hardware components of the
systems context or implementation.
UML could be used in visualizing, specifying, constructing and documenting object
oriented systems. The major building blocks of UML are structural, behavioral,
grouping, and annotational notations. Let us discuss these blocks, one by one.
a. Structural Notations: These notations include static elements of a model. They
are considered as nouns of the UML model which could be conceptual or
physical. Their elements comprises class, interface, collaboration, use case,
active class, component, and node. It also includes actors, signals, utilities,
processes, threads, applications, documents, files, library, pages, etc.
b. Behavioral Notations: These notations include dynamic elements of a model.
Their elements comprises interaction, and state machine. It also includes
classes, collaborations, and objects.
c. Grouping Notations: These notations are the boxes into which a model can be
decomposed. Their elements comprises of packages, frameworks, and
subsystems.
d. Annotational Notations: These notations may be applied to describe,
illuminate, and remark about any element in the model. They are considered as
explanatory of the UML. Their elements comprised of notes which could be
used for constraints, comments and requirements.
UML is widely used as it is expressive enough, easy to use, unambiguous and is
supported by suitable tools.
Class Name
Attribute: Type = initial Value
Operation (arg list): return type
<<interface>>
Message Comparable
Figure 6: Component
Component
Component
Use Case
<<user>>
Use Case
Actor
Use Case
Use Case
Actor
: Class
Unnamed object
Multiplicity
43
Object Oriented and attributes as shown in Figure11. Packages are used widely in a Java based
Modeling and UML
development environment. You may refer to the Unit 3 of Block 2 of the MCS-024
course for more details about packages.
Package
Name
Package Name
+Attribute 1
+Attribute 2
-Attribute 3
Use case
Actor <<uses>>
Use case
<<extends>>
Relationships exists in many forms. The notation for different form of relationship is
shown as:
Inheritance
Dependency
Aggregation
Containment
Association
Directed
Association
Realization
Component
Component
Dependency
Component
Package Name
+Attribute 1
-Attribute 2
<<import>>
Package Name
+Attribute 1
-Attribute 2
An association is a structural relationship that specifies that the objects of one thing
are connected with the objects of another. In UML, it is shown as a solid line
connecting same or different class. The notation for association between nodes is
shown as:
Node Course
Hospital
Hospital
Hospital
45
Object Oriented The four enhancements that apply to association are name, role, multiplicity, and
Modeling and UML
aggregation. Each class participating in an association has a specific role which is
specified at the rear end of the association.
Multiplicity specifies how many objects may be connected across an instance of an
association which is written as a range of values (like 1..*). The notation for roles and
multiplicity between classes is shown as:
role
1 *
Message Queue Message
A state encompasses all the properties of the object along with the values of each of
these properties.
An instance is a concrete manifestation of an abstraction to which a set of operations
can be applied and which has a state that stores the effect of the operation.
A transition is a relationship between two states indicating that an object in the first
state will perform certain action and enter the second state when a specific event
occurs and specific conditions are satisfied.
46
Using UML
2) OMT is
a) Object Methodology Gateway b) Objective Methodology Gateway
c) Object Management Gateway d) Object Management Group
...
3) Object Oriented Software Engineering is given by
a) Booch b) Rumbaugh
c) Jacobson d) None of these
....
4) Booch was strong in
a) Analysis b) Design
c) Implementation d) Software engineering
5) Which of the following is not a valid UML notations?
a) Behavioral b) Grouping
c) Transactional d) Annotational
For object modeling some standard notations are used. Now let us discuss these basic
notations. A well-defined logical notation is important in the software development
process. It helps the software architect to clearly establish the software architecture
and implement module integration. In order to define the commonly used diagrams in
UML, it is essential to understand the basic concepts of the object modeling.
Attribute Attribute
Attribute: type Association name Attribute: type
Attribute = Value Attribute = Value
Stat Operation () Rolename 1 Rolename 2 Stat Operation ()
Operation (x: T) Operation (p: T)
Operation (y): T Operation (q): T
47
Object Oriented If in any college, there are limited classrooms that have to be allocated to different
Modeling and UML
classes and instructors are fixed for all classes, then the class diagram for the
allocation of classrooms and instructors is shown as:
CurrentUser
addreservation ()
Login () removeReservation ()
add student () makeweeklyschedule()
1 1 makeinstructorSchedule()
add instructor ()
makeRoomScheduler()
addRoom()
remove student () 1
removeinstructor () 1 1
1
removeRoom () Instructor *
* Name class Reservation
1 date
1
Student
1
Name Room
* 1
Class
Batch Location
Association Name
Attribute = value Attribute = value
Rolename1 Rolename2
48
Using UML
Specification Body
Component
Component
ATM.exe
ATM.scores
ATM.scores
Processor Device
Name Name
Name Processor
49
Object Oriented The deployment diagram for student administration is shown as:
Modeling and UML
Student
database
Class
schedule
Class
database
Student
directory
Web services
Class
Management
Now you are familiar with structured diagram. To represent dynamic aspect of the
structured system, behavioral diagrams are used. In the next section, we will study
various behavioral diagrams.
<<extend>>
Extend Cases
50
Using UML
3.5.2 Interaction Diagram
An interaction diagram shows an interaction, consisting of a set of objects and their
relationships, including the messages that may be dispatched among them. These
diagrams should be used to model the dynamic aspect of the system. It includes
sequence diagrams and collaboration diagrams. Here we will discuss two interaction
diagrams, sequence diagrams and collaboration diagrams.
3.5.2.1 Sequence Diagrams
A sequence diagrams are interaction diagrams that emphasize the time ordering of
messages. In UML it is shown as a table that shows objects arranged along the X axis
and messages, ordered in increasing time, along the Y axis. It has a global life line and
the focus of control. An object life line is the vertical dashed line that represents
existence of an object over a period of time. The focus of control is tall and thin
rectangle that shows the period during which an object is performing an action. The
notation for depiction of sequence among objects with certain conditions is shown as:
Role: baseClass
<<Message (x)
<<Distroy>>
Return (Y)
The sequence diagram for sending the document along the network is shown as:
Network Listener Request Processor File loader CGI Script Network Writer
Request ()
load Files ()
[Error]
send Error ()
[HTML]
send Document ()
[CGI] process ()
[Error]
send Error ()
sendDocument ()
51
Object Oriented 3.5.2.2 Collaboration Diagrams
Modeling and UML
Collaboration diagrams are interaction diagrams that emphasize the structural
organisation of an object that send and receive messages. There is always a path in
collaboration diagrams to indicate how one object is linked to another, and sequence
numbers to indicate the time ordering of a message. The notation for depiction of a
collaboration diagram is shown as:
1: y=message (x)
Role: BaseClass
1.1: BaseClass ()
1.3 <<Distroy>>
: BaseClass
The collaboration diagram for the execution using J2ME and EJB from the remote
database is shown as:
1: Request
6: Response
5: Response 2: Request
EJB (Modal)
4: Response 3: Request
Database
information
Figure 30: Collaboration diagram for execution using J2ME, Servlet and EJB
52
Using UML
Establish E-mail
Communication
See Subsidiary R
State
Activity Diagram
do.
UMLactivity
Activity
Diagram-Email
Encryption
Private
else control
Wait 1 hour
after sending
send
Encrypted Send
Encrypted
E-mail E-mail
E-mail
End Flow
Proper reply
Communication
Established
State State
do activity do activity
State State
do activity do activity
53
Object Oriented
Modeling and UML & Check Your Progress 2
54
Using UML
3.6 MODELING WITH OBJECTS
A model is an abstract representation of a specification, design or system from a
particular view. A modeling language is a way of expressing the various models
produces during the development process. It is a collection of model elements. It is
normally diagrammatic. It has
Logical View
Implementation
Programmers Software
management
Analysts/Designers End-users
Structure
Use-Case View
Process View
Deployment View
System Integrators
System Engineering System
Performance Scalability
Topology Delivery
Throughput
Installation Communication
Using UML, it is possible to generate code in any programming language from UML
model (called forward engineering) and reconstruct a model from an implementation
into UML (called reverse engineering) as show in the Figure 34 given below.
Specifies
UML Model Object Structure
Abstract view of
Abstract view of
3.7 SUMMARY
This Unit provides an introduction to the basic concept of object modeling notations.
The major diagrams used with UML have been discussed. An idea has been provided
about different views and the corresponding diagrams. This Unit only contains the
introduction of various diagrams, and the student is not expected to be an expert in
designing every diagram.
56
Using UML
Check Your Progress 3
1)
0.1 0.1 Entry Manipulate
Search Phone
Book
Add New
Entry 0.1
0.1
1 0.1
Add New Edit Entry Contact Delete Entry
Entry Person
0.1
Cell Phone
User 0.1
Delete Entry
0.1
Edit Phone Please Call Send
Book Option Message
GUI
GUI GUI I
GU GUI I
GU
Start Program
Display login
Name Password
Is valid-in
Database (name)
alt true
alt
Display Administrator
[(user Type)
admin] user
Display user Interface