Chapter 02 Complexity
Chapter 02 Complexity
COMPLEXITY
• A very old, highly intuitive, and still common argument
for the existence of god is the Argument from Design.
• The trust of the argument is that the ordered complexity
exhibited by the universe, and by living things, is
evidence that there must be an intelligent designer,
since the existence of such complexity cannot be
otherwise explained.
• So, the word “design” as used in this argument refers to
the order and incredible complexity not just in biological
systems. But also, in the very intricate (complicated or
difficulty) law of nature that operate through the universe.
• So, design and complexity is not same. It means every
things are complex, but it is designed.
1
• Refers to the emergence of collection properties in
systems with many parts in interaction among
them.
• The study of complex systems is about
understanding indirect effects. Problems that are
difficult to solve are often hard to understand
because the causes and effects are not obviously
related.
About Software Complexity
• To produce reliable software, its complexity must
be controlled by suitably decomposing the
software systems into smaller subsystems.
• Both internal and external complexity of a module.2
1. Complexity
• A Physician, a Civil Engineer and a Computer
Scientist were arguing about what was the oldest
profession in the world.
– Physician remarked – “Well in the bible, it says that god
created eve from a rib taken out of Adam”.
– This is clearly required surgery.
– So, every physician can rightly claim that mine is the oldest
profession in the world.
– The Civil Engineer interrupted and said” God created the
order of the heavens & the earth from out of the Chaos”.
(brings in organized form)
– Doctor said “Mine is the oldest profession in the world”.
– So, Computer Scientist leaned back in her chair, and
smiled, and then said, ”Ah, but who do you think created
the chaos”.
3
• So, everybody can say complexity is an
essential property of all software system for
better understand and better management.
4
The Historical Complex Map
to Read
5
Image for Complexity
6
Complex Systems
• For our purpose complex systems (Booch):
– have many states, i.e. large "phase space",
– are hard to comprehend in total
– hard to predict
• Examples:
– ant colony, an ant
– computer
– weather
– a car
Complex Systems
• Attributes of complex systems
– hierarchical
– components
– primitive components
– few kinds of subsystems in many different
combinations
– evolved from a simpler system
Complex Systems: Hierarchical
• Composed of interrelated subsystems
– subsystems consist of subsystems too
– until elementary component
Complex Systems: Components
• Links (dependencies) within a component
are stronger than between components
– inner workings of components separated from
interaction between components
– service/repair/replace components
Complex Systems: Primitive
Components
• There are primitive components
– but defintion of primitive may vary
– Nuts, bolts, individual parts?
– replaceable components?
Instrument panel
or srews, bulbs and parts?
Complex Systems: Few kinds
of subsystems in many
combinations
• There are common patterns
– Nuts, bolts, screws interchangeable
– cables, bulbs, plugs
– toothweels, belts, chains
– hoses, clamps
Complex Systems: Evolved
from a simpler system
• Complex system designed from scratch
rarely works
• Add new funtionality/improvements in small
steps
Complex Systems: Two
orthogonal views
• The Object Structure
– "part of" hierarchy, functions
– concentrate on actual components
– concrete
• The Class Structure
– "is a" hierarchy
– concentrate on kinds of components
– abstract
Complexity Crisis
• What’s the most important problem in
Computer Science?
• Languages, tools, programming?
• Well, according to growing number of
researchers and computer users, it’s
software complexity.
• According to Vice-President of IBM
Research Alfred Spector says about this
problem for 40 years.
• “This is probably the number one
problem …… 15
• People don’t understand very well but
developers are essentially working in the
same ways, with the same tools to create
the applications that must be vastly more
powerful.
• There are some possible correlation
between complexity measure:
• Execution -> usefulness
• Program Quality -> debugging,
Correctness, Reliability etc.
• Mental effort to understand functionality -
> Reuse, Maintenance, and Flexibility.
16
Goal and Complexity:
SIMPLE BRICKS USED TO BUILD WALL
18
Inherent Complexity of S/W:
Why Software is Inherently (inbuilt) Complex?
19
• So, we observe that this inherent complexity
derives from four elements:
1. The complexity of the problem
domain(area/field)
2. The difficulty of managing the
development process.
3. The flexibility possible through software
4. The problems of characterizing the
behavior of discrete (separate) system.
20
1. The Complexity of the Problem Domain:
• The problem we try to solve in software
frequently or repeatedly involve elements
that are very complex exists between the
users of a system & its developers
• So, users generally find it very hard to give
precise expression to their needs in a form
that developers can understand.
• A large S/W system is a capital investment,
we can not afford to scrap an existing
system every time its requirements change.
21
• A further complication is that the
requirements of a software system often
change during its development, largely
because the very existence of a software
development project alters the rules of the
problem.
22
2. The Difficulty of Managing the Development
Process:
• The fundamental task of the software
development team is to engineer the illusion of
simplicity – to shield users from this vast and often
arbitrary external complexity.
• Certainly, size is no great virtue in a software
system.
• We strive to write less code by inventing clever
and powerful mechanisms that give us this illusion
of simplicity.
• If we decompose our S/W implementation in
meaningful ways, we stop end up with hundreds
and sometimes thousands of separate models. 23
• The amount of work demands that we use a
team of developers, and ideally, we use as
small a team as possible.
• More developers means more complex
communication and hence more difficult
coordination, particularly if the team is
geographically dispersed, as is often the
case in very large project.
• With a team of developers, the key
management challenge is always to
maintain a unity and integrity of design.
24
3. The Flexibility Possible Through
Software Systems:
• A home building company generally does
not operate its own tree farm from which to
harvest trees for lumbers;
• It is highly unusual for a constructions firm
to build an on-site steel mill to forge custom
girders for a new building.
• Same as in the software industry such
practice is common. Because S/W offers
the ultimate flexibility, so it is possible for a
developer to express almost any kind of
abstractions.
25
4. The Problems of Characterizing the Behavior
of Discrete Systems:
• If we toss a ball into the air, we can reliably predict
its path because we know that under normal
conditions, certain laws of physics apply.
• Software simulation of this ball’s motion, exactly
that kind of behavior can easily occur.
• Within a large application: may be 1000 of
variables, current values, current address and
calling stack of each process within the constitute
the present state of the application.
• Because we execute our S/W on digital
computers, we have a system with discrete states.
• Execute the motion of the tossed ball which are
continuous functions. 26
The Structure of Complex System:
Examples of Complex Systems
– The Structure of a Personal Computer
– The Structure of Plants and Animals
– The Structure of Matter
– The Structure of Social Institutions
The Structure of a Personal Computer:
• A personal computer is a device of moderate
complexity.
• Most of them are composed of the same major
elements:
• a central processing unit. a monitor, a keyboard, and
some sort of secondary storage device, usually either a
floppy disk or a hard disk drive. 27
• We may take any one of these parts and further
decompose it.
• For examples: a CPU typically encompasses primary
memory, an arithmetic/logic unit, and a bus to which
peripherals devices are attached.
• Each of these parts may in turn be further decomposed:
an ALU may be divide into registers and random control
logic, which themselves are constructed from even more
primitive elements, such as NAND gates, inverters, and
so on.
• Here we can see the hierarchic nature of a complex
system.
28
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.
• So, plants are complex multi-cellular organisms, and
from the cooperative activity of various plant organ
systems arise such complex behaviors as
photosynthesis and transpiration.
• So, Plants consists of three major structures (roots,
steams, and leaves), and each of these has its own
structures.
• For examples: roots -> branch roots, root hairs, root
apex, & root cap. 29
• So, all parts at the same level of abstraction interact
in well-defined ways.
• For example, at the highest level of abstraction, roots
are responsible for absorbing water and minerals
from the soil.
• So, roots interact with stems, which transport these
raw materials up to the levels.
• The leaves in turn use the water and minerals
provided by the steam to produce food through the
photosynthesis.
• So, there are always clear boundaries for
functionality of plants. There are clear interaction
between all parts simultaneously.
• A number of mechanisms above the cellular level are
also shared by plant & animal life. 30
The Structure of Social Institutions:
• As a final example of complex systems, we
turn to the structure of social institutions.
• Means, group of people join to accomplish
tasks that cannot be done by individuals.
• The relationship among the various parts of a
large organization are just like those found
among the components of a computer, or a
plant, or even a galaxy.
• Specifically, the degree of interaction among
employees within an individual office is greater
than the employees of different offices.
31
The Five Attributes of a Complex
System:
• According to Simon and Ando, there are five
attributes common to all complex systems.
1. Frequently, complexity takes the form of
hierarchy, whereby a complex system is
composed of interrelated subsystems that
have in turn their own subsystem, and so on,
until some lowest level of elementary
components is reached.
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. 32
3. Intra-component linkages are generally stronger
than inter-component 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 simple system that worked ….. A complex
system designed from scratch never works and
cannot be patched up to make it work. You must
start over, beginning with a working simple system.
33
Bringing Order to Chaos:
The Role of Decomposition:
• According to Dijkstra “The technique of mastering
complexity has been known since ancient times:
divide and rule.
• When designing a complex software system, it is
essential to decompose it into smaller and smaller
parts, each of which we may then refine
independently.
• For the decomposition of complex software system,
we should follow the following decompositions:
1. Algorithmic Decomposition: Most of us have
been formally trained in the system of top-down
structured design, and so we approach
decomposition as a simple matter of algorithmic
decomposition, wherein each module in the system
denotes a major step in some overall process. 34
Algorithmic Decomposition
Update file
Get master area Get formatted update Put new master area
Get Match
Put Update
Update Get Reformat
Create totoCard
Card
Master
Master Check
Is Valid Add Check
Record
Record Sum
Sum
37
On Designing Complex Systems:
Engineering as a Science and an Art:
• The conception of a design for a new structure can
involve as much a leap of the imagination and as
much a synthesis (mixture) of experience and
knowledge as any artist is required to bring to his
canvas or paper.
• But the role of the engineer as artist is particularly
challenging when the task is to design an entirely
new system.
• This is the most common circumstance in software
engineering.
• Especially in the case of reactive systems and
systems for command and control, we are
frequently asked to write software for an entirely
38
unique set of requirements.
The Meaning of Design:
• In every engineering discipline, design include or
cover the disciplined approach which we use to
invent a solution for some problem, thus providing a
path from requirements to implementation.
• In the context of software engineering, Mostow
suggests that the purpose of design is to construct
a system that:
– “Satisfies a given functional specification
– Conforms to limitations of the target medium.
– Meets implicit or explicit requirements on performance
and resource usage.
– Satisfies implicit or explicit design criteria on the form of
artifact.
– Satisfies restrictions on the design process itself, such as
its length or cost, or the tools available for doing the
design.
39
The Elements of Software Design Method:
• The software engineering community has evolved
dozens of different design methods, which we can
loosely classify into three categories.
• Despite their differences, all of these methods have
element in common.
• Specifically, each method includes the following:
– Notation: The language for expressing each
model.
– Process: The activities leading to the orderly
construction of the system’s models.
– Tools: model building which enforce rules
about the models themselves; the errors and
inconsistencies can be
exposed. 40
The Models of Object-Oriented Development:
• “Is there a best design method? There is no
absolute answer to this question.
• There is one way asking the question : What us the
best way to decompose a complex system?
• So, Object-Oriented analysis and design is the
method that leads us to an object-oriented
decomposition.
• By applying OOD, we create software that is
resilient to change and written with economy of
expression.
• We achieve a greater level of confidence in the
correctness of our software through an intelligent
separation of its state space. 41
• Ultimately, we reduce the risk that are inherent in
developing complex software systems.
• Because model building is so important to the
construction of complex systems.
• So, OO development offers a rich set of models
which are:
– Physical Model – include Module Architecture,
Process Architecture.
– Logical Model – include Class Structure, Object
Structure.
So, The model of object-oriented analysis and
design reflect the importance of explicitly
capturing both the class and object hierarchies of
the system under design. 42
Case:
• A department manages many employee
• Employee works on department and
• A employee manages a department and
employee has their own history that is
known as employee history.
• Employee works on the projects.
1.Develop logical model from the given
case.
2.Define physical model 43
ER-Diagram (Logical Model)
Works in
M 1
employee department
Manages
M N
has
N Projects
1
Employee Works on
history
44
Physical Model
employee -> emp_ID, emp_name, emp_phone
45