Object Oriented Analysis and Design (RM)
Object Oriented Analysis and Design (RM)
by Michael J. Quillin
Suppose you're at the dinner table, you would like some salt, and the salt shaker is
inconveniently located at the other end of the table. You might say to your friend,
"Please pass me the salt," and she would do so.
On the other hand, instead of saying just "Please pass me the salt," you could try,
"Please remove your right hand from your wine glass, move it to the left until it
contacts the salt shaker, grasp it, lift it from the table, move it in a natural arc in my
direction, stop when it contacts my hand, wait until my hand has closed around it, and
then release it." This would probably word as well, though it might also result in a
quiet phone call from your friend to the local mental asylum.
This example illustrates the difference between procedural and object-oriented
computing. The object-oriented way is to say "Pass the salt," and leave it up to the
object to carry out the request any way it chooses. The procedural way is to specify
each and every step of getting that shaker of salt into your hands. There are two key
concepts in object-oriented computing: encapsulation and inheritance. The single most
important principle of object oriented computing is that "objects are responsible for
their own actions". If used properly, OOD improves the maintenance, reusability, and
modifiability of the software.
Encapsulation
An object is a "black box" which receives and sends messages. A black box contains
code and data. "Traditionally, code and data have been kept apart." In Object Oriented
Programming, code and data are merged into a single indivisible thing -- an object. "A
primary rule of object-oriented programming is this: as the user of an object, you
should never need to peek inside the box (or object)". All communication is to be
done via messages. The object to which a message is sent is called the receiver of the
message. Messages define the interface to the object. Everything an object can do is
represented by its message interface. Therefore, an object can be used without
knowing exactly what is inside of it, and it becomes unnecessary to directly modify
the object. "Providing access to an object only through its messages, while keeping
the details private is called encapsulation". Encapsulation is important because parts
of software must sometimes be changed or re-used.
Classes
More than one object can be created for a class. Elaborating on the above example,
objects named Fido and Rover might also be created in class Dog. In a class,
messages are defined that objects in the class understand. Again, using the above
example, the Dog objects might understand messages such as Bark, Fetch, and Roll-
over.
The action that a message carries out is called a method. It is the code that gets
executed when the message is sent to a particular object.
Arguments are supplied as part of a message. "For example, the "fetch" message
might contain an argument that says what to fetch or the "roll-over" message could
contain one argument to say how fast, and a second argument to say how many
times".
Inheritance
If there is already a class which can respond to many different messages, it is possible
to make a new, similar class which adds just a couple more messages without having
to re-write the entire class by creating a subclass. This new class inherits all the
existing messages, and therefore, all the behavior of the original class. The original
class is called the superclass of the new class.
Inheritance also promotes reuse. It is not necessary to start from scratch when writing
a new program if the existing classes have similar behaviors to those needed in the
new program. "For example, after creating the class Dog, you might make a subclass
called Wolf, which defines some wolf-specific messages, such as hunt. Or it might
make more sense to define a common class called Canis, of which both Dog and Wolf
are subclasses".
There are almost two dozen major object-oriented programming languages in use
today, but there are only a few leading commercial languages. These languages are:
C++, SmallTalk, and JAVA.
Object-oriented decomposition is the concept upon which OOA and OOD are based.
There are three main tools used in object-oriented analysis and design techniques (8):
o Class diagrams/templates.
o Object diagrams.
o Object state diagrams.
Class diagrams are used to model key abstractions in the problem domain and their
relationships with each other. Object diagrams are used to model the interactions
between objects, whereas object state diagrams model the dynamic behavior within a
single object. An object state diagram shows all the possible states of an object and
the allowed transition between the states.
Tools are only the means by which developers communicate requirements or the
design of the system. How they actually apply these tools for OOA and OOD is also
important. Unlike the traditional waterfall approach, the overall approach to object-
oriented analysis and design is highly integrative. "Stepwise refinement works when
all requirements must be determined before design can start, however, and object-
oriented developer may be required to do some preliminary analysis, designing the
class and object structure, building a preliminary prototype, testing it with the user,
and going back to analysis or design without being constrained". Object-oriented
systems are designed to be changed.
4. Identifying services.
The first step involves identifying candidate objects and classes, which may be
people, places, things, organizations, concepts, or events. Next, Object relationships
are documented on object diagrams. The attributes and services of each class are then
identified and documented in class templates.
The first step involves analyzing life cycle of each object and formalizing the life
cycle in an object state diagram. Next, class relationships are defined in a class
diagram. Each service that is provided by a class is defined including any logic that is
necessary. Finally, the class and object diagrams are completed along with all class
templates.
Top What is OO Computing Tools and Approaches Used in
OOA Conclusion Bibliography
Before the introduction of Object Oriented Analysis and Design, most Information
Systems professionals were taught that the classical waterfall development life cycle
was the proper way to approach software engineering and that "top level
decomposition of processes was a practical way of handling large software
development projects". These traditional methods built the foundation of modern
software practices, and yet this foundation is being shaken by object oriented analysis
and design.
Structured systems development began in the 1960s with the concept of systems
development life cycle. In the 1970s, process-oriented structured methodologies were
developed to promote a more effective analysis and design technique. "The so-called
structured revolution was based on computer program structures, with separate
program steps (processes) and data".
In the 1980s, planning and modeling of data began to play a more important role in
development, resulting in data-oriented methodologies such as information
engineering. "Although the data-oriented methodologies made better use of the
powerful database models that were evolving, when it came to design, data
methodologies still relied on process decomposition and simply mapped processes to
data".
OOA differs the most from Structured analysis. "Structured analysis maintains a
process-oriented view of systems, providing a decomposition based on processes,
whereas OOA decomposes the problem domain base on classification entities".
Developers who are currently using structured analysis techniques usually discover
that their experience in modeling requirements using data flow diagrams is irrelevant
or worthwhile only in the context of modeling existing procedures. Those developers
schooled in information engineering will find the road to object-oriented analysis
much easier to follow. However, developers still need to alter their views from
modeling disembodied processes to encapsulated services.
IV. Conclusion
Using Object Oriented Analysis and Design methods to develop real-time systems has
the potential to produce safer, more reliable and maintainable code. Instead of using
functional decomposition of the system, the OOA approach focuses on identifying
objects and their activities. Using the object -oriented approach, system analysts
model information systems by identifying a set of objects, along with their attributes
and operations that manipulate the object data. Researchers in the object-oriented
community assert that the OOA approach has many advantages in meeting the
requirements of OOP.