Professional Documents
Culture Documents
Chapter 14-System Design
Chapter 14-System Design
Chapter 14-System Design
SYSTEM DESIGN
SYSTEM DESIGN
• High level strategy – the system architecture is designed
for solving the problem and building a solution.
• Here decisions are made about the organization of the
system into subsystem, allocation of subsystems to
hardware and software and major policy decisions that
form the basis for class design.
Overview of system design
• Analysis- what needs to be done & Design- How it is done.
• First stage-overall structure and style decided by the
developers.
• System architecture determine the organization of system into
subsystems.
• Following decisions are to be made.
– Estimate system performance
– Make a reuse plan
– Organize the system into subsystems
– Identify concurrency inherit in the problem
– Allocate subsystems to hardware
– Manage data stores
– Handle global resources
– Choose a software control strategy
– Handle boundary conditions
– Set trade off priorities
– Select an architectural style
ESTIMATING PERFORMANCE
• Engineers call this as “Back of envelope” calculation. The
purpose is not to achieve high accuracy, but merely to determine
if the system is feasible
– ie. Making a rough performance estimate.(just to see if
feasible)-calculation must be fast and involve common sense-
assumptions must be simplifying-just approximate, estimate
and guess if necessary.
• Atm ex:
– Atm n/w for a bank with 40 branches.
assuming 1 transaction/sec This does not need a very fast
computer. This is not the case of online sellers.
– Data storage- number of customers*estimated data for each
• not huge but for satellite based ground imaging system
bandwidth required and data storage huge.
MAKE A REUSE PLAN
• Reuse doesn’t happen automatically.
There are two different aspects: using existing
things and creating reusable new things.
(difficult)
• Reusable things include
– Models
– Library
– frameworks and
– patterns.
• Reuse of models is often the most practical form
of reuse. The logic in the model can apply to
Library
• Collection of classes –to be organized carefully – must have
accurate and thorough descriptions to help users determine
their relevance.
• The qualities of good class libraries
• Coherence -Few well focuses themes
• Completeness-Complete behaviour of selected themes
• Consistency-Polymorphic operations have consistent names
and operations.
• Efficiency-Alternate implementations of algorithms that works
on time and space(depending on requirement)
• Extensibility-User should be able to create subclasses
• Genericity-Should use parameter class definitions
• Problem may be encountered when integrating
class libraries from multiple sources.
– Classes may adopt policies that are individually
sensible but fundamentally incomplete with those of
other class libraries. If such inconsistencies are seen,
the source code must be reworked.
• limits our ability to reuse code from class libraries.
• Argument validation
• An application may validate arguments
individually(responsive user interfaces) or as a
collection(command interfaces).
• Error handling
• Use different error handling techniques. Some methods
may return error codes or some may handle them
directly.
• Control paradigms
– Applications may adopt event-driven or procedure-driven.
With ED, the UI calls application methods. With PD, the
application call UI methods. Combining both in one
application is difficult.
• Group operations
– Are often inefficient and incomplete. A single object
deletion is complex –locks to be taken care etc. Deleting a
group is complex.
• Garbage collection
– Different strategy used for managing memory
allocation(returning a pointer to a string, copy of a string,
returning a pointer with read-only access), avoiding
memory leaks(mark, sweep, reference counting etc)
• Name collisions
– Class names, public attributes and methods –global
namespace. Prefix added to avoid collisions
FRAMEWORKS
• A framework is a skeletal structure of a program elaborated to
build a complete application.
• Elaboration consists of specialized abstract classes with
behaviour specific to an individual application.
• A class library may accompany frameworks to reuse
subclasses.
• Framework also contains a paradigm for flow of ctrl and
shared invariants.
• Frameworks tend to be specific to a category of applications.
• Framework class libraries typically application specific and
not for general use
PATTERNS
• A pattern is a proven solution to a general problem.
• Patterns target different phases of s/w lifecycle (analysis,
architecture, design & implementation).
• Can achieve reuse by using existing pattern rather than
reinventing from scratch.
• A pattern comes with guidelines on when to use it, as well as
trade-offs on its use.
• Adv. More likely to be correct as they are tested. Normally
designed in known languages
• Patterns are extension of modeling language and prototypical
model fragments that distills the some of the knowledge of
experts.
Patterns
• A pattern is different from framework that is broader in scope
and covers entire subsystem. pattern contains small number of
classes and relationships.
• ATM Ex: The notion of a transaction offers some possibility of
reuse-transactions are a frequent occurrence in computer
systems, and there is a commercial software to support them.
Breaking a system into subsystems
• First step in system design is to divide system into pieces.
• Each major piece is a subsystem based on similar functionality
such as physical location, execution on same h/w.
• For Ex: a spaceship computer might include subsystems for life
support, navigation, engine control, and running scientific
experiments.
• A subsystem is not an object nor a function but a group of
classes, associations, operations, events and interrelated
constraints.
• A subsystem is usually identified by the services it provides.
• Service- group of related functions that share common purpose
such as processing I/O, performing arithmetic.
Breaking a system into subsystems
• Each subsystem has a well defined interface to the rest of the
system which specifies the form of all interactions and the info
flows across subsystem boundary but nothing about implement.
• Interactions must be made only within the subsystem as much
as possible rather than across subsystem boundary .
Dependency is reduced.
• Each subsystem may in turn be decomposed into deeper
subsystems.
• Relation b/w subsystems may be client-server(client needs to
know server’s interface as clients initiate all interactions) or
peer-peer(all must know about others interfaces). Client server
is easier to build and hence preferred.
• Decomposition can be organized into sequence of horizontal
Layers
• A layered system is an ordered set of virtual worlds(a set of tiers)
each built in terms of the ones below it and providing the
implementation basis for the ones above it..
• The objects in each layer can be independent(correspondance
allowed b/w objects)
• Subsystem knows about the layers below it, not the ones above.
Layer 2 is made of its own classes and operations and also of objects
of layer 1.
• Client –server relationship exists b/w upper layer and lower layers.
• Layered architecture comes in two forms:
• Closed architecture -(each layer is built only in terms of the
immediate lower layer-reduces dependencies b/w layers ) .
• This reduces the dependencies between layers and allows changes to
be made easily because it affects only the next layer.
• Open architecture –A layer can use features of any lower layer
to any depth. This reduces the need to redefine operations at each
level, which can result in a more efficient and compact code.
• Changes to a subsystem affects many systems above. Therefore,
this is less robust then a closed architecture.
• Problem Statement specifies only the top and bottom layers.
– Top-desired system
– bottom-available resources(h/w,os,…)
• If the disparity between the two is more, introduce intermediate
layers.
• By rewriting layers, we can port a system constructed in layers
between hardware /software platforms.
• It is a good practice to introduce one layer of abstraction
between the application and any sevices provided by the
operating system or hardware.
Partitions
• Partitions vertically divide a system into several independent
or weakly coupled subsystems, each provide one kind of
service.
• For Ex: a computer operating system includes a file system,
virtual memory management, and device control.
• Ex. Each subsystem may have some knowledge of each
other but this knowledge is not deep.
• Diff from layers:
1. Layers vary in their level of abstraction. Partitions divide a
system into pieces –similar level of abstraction.
2. Layers ultimately depend on each other. Partitions are peers
that are independent or mutually dependent.(peer-to-peer
relationship).
Combining layers and partition
• Decompose a system into subsystems by combining layers and
partitions. Layers can be partitioned and partitions can be
layered.
• Figure below shows a block diagram of a typical application.
Most large systems require a mixture of layers and partitions .
• Information flow of top level subsystems are to be shown. Ex.
Many computations have the form a pipeline; a compiler is an
example.
• Other systems are arranged in a star, in which a master
subsystem controls all Interactions with other subsystems.
ATM Ex: Fig below shows the architecture of the ATM system.
There are three subsystems; the ATM stations, the consortium
computer, and the bank computers.
The topology is a simple star; the consortium computer
communicates with all the ATM stations and with all the bank
computers.
The architecture uses the station code and the bank code to
distinguish the phone lines to the consortium computer.
Choosing a software control strategy
• It is better to choose the same kind of control system for the
whole system. There are 2 kinds of control flow:
• External control (concerns externally visible events among
objects) and
• Internal control (flow of control within a process)
• Three kinds of external control:
• Procedure-driven sequential
• Event-driven sequential
• Concurrent
• Internal control exists only in the implementation and therefore
is neither concurrent nor sequential.
Unlike external events, internal transfers of control, such as
procedure calls or intertask calls.
Three kinds of control flow are common: procedure calls, quasi-
concurrent calls and concurrent intertask calls.
Procedure-driven Control