Object Oriented Analysis and Design - The Object Model
Object Oriented Analysis and Design - The Object Model
Structured design methods evolved to guide developers who were trying to build complex
systems using algorithms as their fundamental building blocks. Similarly, object-oriented design
methods have evolved to help developers exploit the expressive power of object-based and
object-oriented programming languages, using the class and object as basic building blocks.
However, there are limits to the amount of complexity we can handle using only algorithmic
decomposition; thus we must turn to object-oriented decomposition. Furthermore, if we try to
use languages such as C++ and Java as if they were only traditional, algorithmically oriented
languages, we not only miss the power available to us, but we usually end up worse off than if
we had used an older language such as C or Pascal.
Object-Oriented Programming –
(1) Object-oriented programming uses objects, not algorithms, as its fundamental logical
building blocks
(2) each object is an instance of some class
(3) classes may be related to one another via inheritance relationships (the “is a” hierarchy).
A program may appear to be object-oriented, but if any of these elements is missing, it is not an
object-oriented program. Specifically, programming without inheritance is distinctly not object-
oriented; that would merely be programming with abstract data types.If a language does not
provide direct support for inheritance, then it is not object-oriented. Cardelli and Wegner Pages
distinguish such languages by calling them object-based rather than object-oriented. Under this
definition, Smalltalk, Object Pascal, C++, Eiffel, CLOS, C#, and Java are all object-oriented, and Home
▼
▼ 2010 (1)
The support for object-oriented decomposition is what makes object-oriented design quite
different from structured design: The former uses class and object abstractions to logically ▼
▼ December (1)
structure systems, and the latter uses algorithmic abstractions. Object Oriented Analysis and
Design
Object-Oriented Analysis –
“Object-oriented analysis is a method of analysis that examines requirements from the
perspective of the classes and objects found in the vocabulary of the problem domain.”
https://masters-ooad.blogspot.com/p/object-model.html 1/6
7/16/24, 12:44 PM Object Oriented Analysis and Design: The Object Model
How are OOA, OOD, and OOP related? Basically, the products of object-oriented analysis
serve as the models from which we may start an object-oriented design;the products of object-
oriented design can then be used as blueprints for completely implementing a system using
object-oriented programming methods.
There is no single programming style that is best for all kinds of applications. For example, rule-
oriented programming would be best suited for the design of a knowledge base, and procedure-
oriented programming would be best for the design of computation-intense operations. From
our experience, the object-oriented style is best suited to the broadest set of applications;
indeed, this programming paradigm often serves as the architectural framework in which we
employ other paradigms.
Each of these styles of programming is based on its own conceptual framework. Each requires
a different mindset, a different way of thinking about the problem. For all things object-oriented,
the conceptual framework is the object model.
All abstractions have static as well as dynamic properties. For example, a file object takes up a
certain amount of space on a particular memory device; it has a name, and it has contents.
These are all static properties. The value of each of these properties is dynamic, relative to the
lifetime of the object: A file object may grow or shrink in size, its name may change, its contents
may change.In procedure-oriented style of programming, the activity that changes the dynamic
value of objects is the central part of all programs; things happen when subprograms are called
and statements are executed. In a rule-oriented style of programming, things happen when new
events cause rules to fire, which in turn may trigger other rules, and so on. In an object-oriented
style of programming, things happen whenever we operate on an object (i.e., when we send a
message to an object). Thus, invoking an operation on an object elicits some reaction from the
object.
Example
A client of this abstraction may invoke an operation to establish a critical range of temperatures.
It is then the responsibility of the sensor to report whenever the temperature at its location drops
below or rises above the given set point. When the function is invoked, the sensor provides its
location and the current temperature, so that the client has sufficient information to respond to
the condition.
https://masters-ooad.blogspot.com/p/object-model.html 2/6
7/16/24, 12:44 PM Object Oriented Analysis and Design: The Object Model
“For abstraction to work, implementations must be encapsulated” [53]. In practice, this means
that each class must have two parts: an interface and an implementation. The interface of a
class captures only its outside view, encompassing our abstraction of the behavior common to
all instances of the class. The implementation of a class comprises the representation of the
abstraction as well as the mechanisms that achieve the desired behavior. The interface of a
class is the one place where we assert all of the assumptions that a client may make about any
instances of the class; the implementation encapsulates details about which no client may make
assumptions.
“Encapsulation is the process of compartmentalizing the elements of an abstraction that
constitute its structure and behavior; encapsulation serves to separate the contractual interface
of an abstraction and its implementation.”
Examples of Encapsulation
The client would not see any change at all as the client sees only the Heater interface. This is
the key point of encapsulation. In fact, the client should not care what the implementation is, as
long as it receives the service it needs from the Heater.
“The two most important hierarchies in a complex system are its class structure (the “is a”
hierarchy) and its object structure (the “part of” hierarchy).”
Different programming languages trade off support for encapsulation and inheritance in different
ways. C++ and Java offer great flexibility. Specifically, the interface of a class may have three
parts: private parts, which declare members that are accessible only to the class itself;
protected parts, which declare members that are accessible only to the class and its
subclasses; and public parts, which are accessible to all clients.
https://masters-ooad.blogspot.com/p/object-model.html 3/6
7/16/24, 12:44 PM Object Oriented Analysis and Design: The Object Model
example, we can define a Rose class (see Figure 2–10) that inherits from both Plant and
FlowerMixin. Instances of the subclass Rose thus include the structure and behavior from the
class Plant together with the structure and behavior from the class FlowerMixin.
such as C++, permit the programmer to decide. In C++, virtual base classes are used to denote
a sharing of repeated structures, whereas nonvirtual base classes result in duplicate copies
appearing in the subclass.
There are two general solutions to these problems. First, we could use a type-safe container
class that manipulates only objects of a specific class. This approach addresses the first
problem, wherein objects of different types are incorrectly mingled. Second, we could use some
form of runtime type identification; this addresses the second problem of knowing what kind of
object you happen to be examining at the moment.
There are a number of important benefits to be derived from using strongly typed languages:
- Without type checking, a program in most languages can ‘crash’ in mysterious ways at
runtime.
- In most systems, the edit-compile-debug cycle is so tedious that early error detection is
indispensable.
- Type declarations help to document programs.
- Most compilers can generate more efficient object code if types are declared.
https://masters-ooad.blogspot.com/p/object-model.html 4/6
7/16/24, 12:44 PM Object Oriented Analysis and Design: The Object Model
and expressions are not known until runtime. A language may be both strongly and statically
typed (Ada), strongly typed yet supportive of dynamic typing (C++, Java)
A heavy-weight process is one that is typically independently managed by the target operating
system and so encompasses its own address space. A lightweight process usually lives within a
single operating system process along with other light-weight processes, which share the same
address space. Communication among heavyweight processes is generally expensive,
involving some form of interpro-cess communication; communication among lightweight
processes is less expensive and often involves shared data.
Building a large piece of software is hard enough; designing one that encompasses multiple
threads of control is much harder because one must worry about such issues as deadlock,
livelock, starvation, mutual exclusion, and race conditions.
Examples of Concurrency
In general, there are three approaches to concurrency in object-oriented design.
First, concurrency is an intrinsic feature of certain programming languages, which provide
mechanisms for concurrency and synchronization.
Second, we may use a class library that implements some form of lightweight processes.
Naturally, the implementation of this kind is highly platform-dependent, although the interface to
the library may be relatively portable
Third, we may use interrupts to give us the illusion of concurrency. Of course, this requires that
we have knowledge of certain low-level hardware details. For example, in our implementation of
the class ActiveTemperatureSensor, we might have a hardware timer that periodically interrupts
the application, during which time all such sensors read the current temperature and then
invoke their callback function as necessary.
Introducing the concept of persistence to the object model gives rise to object-oriented
databases. In practice, such databases build on proven technology, such as sequential,
indexed, hierarchi-cal, network, or relational database models, but then offer to the programmer
the abstraction of an object-oriented interface, through which database queries and other
operations are completed in terms of objects whose lifetimes transcend the lifetime of an
individual program. This unification vastly simplifies the development of certain kinds of
applications. In particular, it allows us to apply the same design methods to the database and
nondatabase segments of an application.
Some object-oriented programming languages provide direct support for persistence. Java
provides Enterprise Java Beans (EJBs) and Java Data Objects.
Open Issues
To effectively apply the elements of the object model, we must next address several open
issues.
https://masters-ooad.blogspot.com/p/object-model.html 5/6
7/16/24, 12:44 PM Object Oriented Analysis and Design: The Object Model
- What exactly are classes and objects?
- How does one properly identify the classes and objects that are relevant to a particular
application?
- What is a suitable notation for expressing the design of an object-oriented system?
- What process can lead us to a well-structured object-oriented system?
- What are the management implications of using object-oriented design?
Summary
The maturation of software engineering has led to the development of object-oriented analysis,
design, and programming methods, all of which address the issues of programming-in-the-
large.
- There are several different programming paradigms: procedure-oriented, object-oriented,
logic-oriented, rule-oriented, and constraint-oriented.
- An abstraction denotes the essential characteristics of an object that distinguish it from all
other kinds of objects and thus provide crisply defined conceptual boundaries, relative to the
perspective of the viewer.
- Encapsulation is the process of compartmentalizing the elements of an abstraction that
constitute its structure and behavior; encapsulation serves to separate the contractual interface
of an abstraction and its implementation.
- Modularity is the property of a system that has been decomposed into a set of cohesive and
loosely coupled modules.
- Hierarchy is a ranking or ordering of abstractions.
- Typing is the enforcement of the class of an object, such that objects of different types may not
be interchanged or, at the most, may be interchanged only in very restricted ways
- Concurrency is the property that distinguishes an active object from one that is not active.
- Persistence is the property of an object through which its existence transcends time and/or
space.
Home
https://masters-ooad.blogspot.com/p/object-model.html 6/6