Lecture Notes: III B. Tech I Semester (JNTUA-R15)
Lecture Notes: III B. Tech I Semester (JNTUA-R15)
ON
INTRODUCTION
The Structure of Plants and Animals In botany, scientists seek to understand the
similarities and differences among plants through a study of their morphology, that is,
their form and structure. Plants are complex multicellular organisms, and from the
cooperative activity of various plant organ systems arise such complex behaviors as
photosynthesis and transpiration. Plants consist of three major structures (roots, stems,
and leaves), and each of these has its own structure. For example, roots encompass branch
roots, root hairs, the root apex, and the root cap. Similarly, a cross-section of a leaf reveals
its epidermis, mesophyll, and vascular tissue. Each of these structures is further composed
of a collection of cells, and inside each cell we find yet another level of complexity,
encompassing such elements as chloroplasts, a nucleus, and so on. As with the structure of
a computer, the parts of a plant form a hierarchy, and each level of this hierarchy
embodies its own complexity.
The Structure of Matter The study of fields as diverse as astronomy and nuclear physics
provides us with many other examples of incredibly complex systems. Spanning these two
disciplines, we find yet another structural hierarchy. Astronomers study galaxies that are
arranged in clusters, and stars, planets, and various debris are the constituents of galaxies.
Likewise, nuclear physicists are concerned with a structural hierarchy, but one on an
entirely different scale. Atoms are made up of electrons, protons, and neutrons; electrons
appear to be elementary particles, but protons, neutrons, and other particles are formed
from more basic components called quarks.
2. The choice of what components in a system are primitive is relatively arbitrary and is
largely up to the discretion of the observer of the system.
3. “Intracomponent linkages are generally stronger than intercommoning linkages. This
fact has the effect of separating the high-frequency dynamics of the components -
involving the internal structure of the components - from the low-frequency dynamics -
involving interaction among components
4. "Hierarchic systems are usually composed of only a few different kinds of subsystems
in
various combinations and arrangements
5. “A complex system that works is invariably found to have evolved from a simple
system that worked.... A complex system designed from scratch never works and cannot
be patched up to make it work. You have to start over, beginning with a working simple
system "
The Canonical Form of a Complex System The discovery of common abstractions and
mechanisms greatly facilitates our understanding of complex systems. For example, with
just a few minutes of orientation, an experienced pilot can step into a multiengine jet
aircraft he or she has never flown before and safely fly the vehicle. Having recognized the
properties common to all such aircraft, such as the functioning of the rudder, ailerons, and
throttle, the pilot primarily needs to learn what properties are unique to that particular
aircraft. If the pilot already knows how to fly a given aircraft, it is far easier to know how
to fly a similar one. This example suggests; that we have been using the term hierarchy in
a rather loose fashion. Most interesting systems do not embody a single hierarchy; instead,
we find that many different hierarchies are usually present within the same complex
system. For example, an aircraft may be studied by decomposing it into its propulsion
system, flight-control system, and so on. This decomposition represents a structural, or
"part of" hierarchy. Alternately, we can cut across the system in an entirely orthogonal
way. For example, a turbofan engine is a specific kind of jet engine, and a Pratt and
Whitney TF30 is a specific kind of turbofan engine. Stated another way, a jet engine
represents a generalization of the properties common to every kind of jet engine; a
turbofan engine is simply a specialized kind of jet engine, with
properties that distinguish it, for example, from ramjet engines.
Figure 1-1
The Canonical Form of a Complex System
Combining the concept of the class and object structure together with the five attributes of
a
complex system, we find that virtually all complex systems take en the same (canonical)
form, as we show in Figure 1-1. Here we see the two orthogonal hierarchies of the system:
its class structure and its object structure. Each hierarchy is layered, with the more
abstract classes and objects built upon more primitive ones. What class or object is chosen
as primitive is relative to the problem at hand, Especially among the parts of the object
structure, there are close collaborations among objects at the same level of abstraction,
Looking inside any given level reveals yet another level of complexity. Notice also that
the class structure and the object structure are not completely independent; rather, each
object in the object structure represents a specific instance of some class. As the figure
suggests, there are usually many more objects than classes of objects within a complex
system. Thus, by showing the "part of" as well as the "is a" hierarchy, we explicitly
expose the redundancy of the system under consideration, lf we did not reveal a system's
class structure, we would have to duplicate our knowledge about the properties of each
individual part. With the inclusion of the class structure, we capture these common
properties in one place.
The Limitations of the Human Capacity for Dealing with Complexity If we know
what the design of complex software systems should be like, then why do we still have
serious problems in successfully developing them? As we discuss in the next chapter, this
concept of the organized complexity of software (whose guiding principles we call the
object model) is relatively new. However, there is yet another factor that dominates: the
fundamental limitations of the human capacity for dealing with complexity. As we first
begin to analyze a complex software system, we find many parts that must interact in a
multitude of intricate ways, with little perceptible commonality among either the parts or
their interactions: this is an example of disorganized complexity. As we work to bring
organization to this complexity through the process of design, we must think about many
things at once.
Figure 1-2
Algorithmic Decomposition
Object-Oriented Decomposition We suggest that there is an alternate decomposition
possible for the same problem. In Figure 1-3, we have decomposed the system according
to
the key abstractions in the problem domain. Rather than decomposing the problem into
steps
such as Get formatted update and Add check sum , we have identified objects such as
Master File and Check Sum, which derive directly from the vocabulary of the problem
domain. Although both designs solve the same problem, they do so in quite different
ways. In this second decomposition, we view the world as a set of autonomous agents that
collaborate to perform some higher level behavior. Get formatted update thus does not
exist as an independent algorithm; rather, it is an operation associated with the object File
of Updates. Calling this operation creates another object, Update to Card. In this manner,
each object in our solution embodies its own unique behavior, and each one models some
object in the real world. From this perspective, an object is simply a tangible entity which
exhibits some welldefined behavior. Objects do things, and we ask them to perform what
they do by sending them messages. Because our decomposition is based upon objects and
not algorithms, we call this an object-oriented decomposition
Figure 1-3
Object-Oriented Decomposition
Figure 1-4
The Models of Object-Oriented Development
Object-Oriented Programming
Object-oriented programming is a method of implementation in which programs are
organized as cooperative collections of objects, each of which represents an instance of
some class, and whose classes are all members of a hierarchy of classes united via
inheritance relationships.
Object-Oriented Design
The emphasis in programming methods is primarily on the proper and effective use of
particular language mechanisms. By contrast, design methods emphasize the proper and
effective structuring of a complex system. What then is object-oriented design? We
suggest that Object-oriented design is a method of design encompassing the process of
object-oriented decomposition and a notation for depicting both logical and physical as
well as static and dynamic models of the system under design.
Object-Oriented Analysis
Abstraction
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
Encapsulation hides the details of the implementation of an object.
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
Modularity is the property of a system that has been decomposed into a set of cohesive
and loosely coupled modules.
Modularity packages abstractions into discrete units.
Hierarchy
The Meaning of Hierarchy Abstraction is a good thing, but in all except the most trivial
applications, we may find many more different abstractions than we can comprehend at
one time. Encapsulation helps manage this complexity by hiding the inside view of our
abstractions. Modularity helps also, by giving us a way to cluster logically related
abstractions. Still, this is not enough. A set of abstractions often forms a hierarchy, and by
identifying these hierarchies in our ,design, we greatly simplify our understanding of the
problem. Hierarchy is a ranking or ordering of abstractions.
Typing
Meaning of Typing The concept of a type derives primarily from the theories of abstract
data
types. As Deutsch suggests, "A type is a precise characterization of structural or
behavioural properties which a collection of entities all share" [68]. For our purposes, we
will use the terms type and class interchangeably9 . Although the concepts of a type and a
class are similar, we include typing as a separate element of the object model because the
concept of a type places a very different emphasis upon the meaning of abstraction.
Typing is the enforcement Of the class of an object, such, that objects of different types
may not be interchanged, or at the most, they may be interchanged only in very restricted
ways.
Concurrency
The Meaning of Concurrency For certain kinds of problems, an automated system may
have to handle many different events simultaneously. Other problems may involve so
much computation that they exceed the capacity of any single processor. In each of these
cases, it is natural to consider using a distributed set of computers for the target
implementation or to use processors capable of multitasking. A single process - also
known as a thread of control is the root from which independent dynamic action occurs
within a system. Every program has at least one thread of control, but a system involving
concurrency may have many such threads: some that are transitory, and others that last the
entire lifetime of the system's execution. Systems executing across multiple CPUs allow
for truly concurrent threads of control, whereas systems running on a single CPU can only
achieve the illusion of concurrent threads of control, usually by means of some time-
slicing algorithm.
Concurrency is tbe properly that distinguisbes an active object from one tbat is not active.
Persistence
An object in software takes up some amount of space and exists for a particular amount of
time. Atkinson et al. suggest that there is a continuum of object existence, ranging from
transitory objects that arise within the evaluation of an expression, to objects in a database
that outlive the execution of a single program. This spectrum of object persistence
encompasses the following:
• “Transient results in expression evaluation
• Local variables in procedure activations
• Own variables [as in ALGOL 60], global variables, and heap items whose extent is
different from their scope
• Data that exists between executions of a program
• Data that exists between various versions of a program
• Data that outlives the program
Persistence is theproperty of an object tbrougb which its existence transcends time (i.e.
tbe object continues to exist after its creator ceases to exist) and/or space (i. e. the objects
location moves from the address space in wbich it was created).
Open Issues
To effectively apply the elements of the object model, we must next address several open
issues:
• 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 weil-structured object-oriented system?
• What are the management implications of using object-oriented design?