Unit III System Design
Unit III System Design
DESIGN
CHAPTER OBJECTIVE:
You should able to design the
• Application using UML diagrams.
• Architecture of the overall system.
• Subsystems of application which is modularized.
In analysis as in the real world and in hardware all objects are concurrent. In
implementation not all software objects are concurrent because one processor may
support many objects. An important goal of system design is to identify which object
must be active concurrently and which objects have activity that is mutually exclusive
(not active at the same time). The latter objects can be folded into a single thread of
control or task (runs on a single processor).
Identifying Concurrency
• Dynamic Modeling is the guide to concurrency - Two objects are said to be inherently
concurrent if they can receive events at the same time without interacting. If the
events are unsynchronized, the objects cannot be folded into a single thread of
control. (engine and wing control on an airplane must operate concurrently)
• Two subsystems that are inherently concurrent need not necessarily be implemented
as separate hardware units. The purpose of interrupts, Operating System and tasking
mechanism is to simulate logical concurrency in a uniprocessor - so if there are no
timing constraints on the response then a multitasking Operating System can handle
the computation.
• All objects are conceptually concurrent, but many objects are interdependent. By
examining the state diagram of individual objects and the exchange of events between
them, many objects can be folded into a single thread of control. A thread of control
is a path through a set of state diagrams on which only a single object at a time is
active - thread remains in a state diagram until an object sends an event to another
object and waits for another event.
• On each thread of control only a single object is active at a time. Threads of control
are implemented as tasks in computer systems.
• The system designer must estimate the required CPU power by computing the
steady state load as the product of the number of transactions per second and the
time required to process a transaction. Experimentation is often useful to assist in
estimating.
Hardware/Software Tradeoffs
Hardware can be viewed as a rigid but highly optimized form of software. The
system designer must decide which subsystems will be implemented in hardware and
which in software.
• Performance overhead
• Insufficient functionality for advanced applications - most databases are
structured for business applications.
• Awkward interface with programming languages.
• The system designer must identify the global resources and determine
mechanisms for controlling access to them - processors, tape drives, etc
• If the resource is a physical object, it can control itself by establishing a protocol
for obtaining access within a concurrent system. If the resource is logical entity
(object ID for example) there is a danger of conflicting access. Independent tasks
could simultaneously use the same object ID. Each global resource must be
owned by a guardian object that controls access to it.
3. Failure: It is the unplanned termination of a system. Failure can arise from user errors,
from the exhaustion of system resources, or from an external breakdown.
1) Break the overall transformation into stages, each stage performing one part of
the transformation. The system diagram is a data flow diagram. This can usually be taken
from the functional model.
2) Define intermediate object classes for the data flows between each pair of
successive stages.
1. Draw a DFD for the system. The input and output actors correspond to data
structures whose value change continuously. Data stores within the pipeline show
parameters that affect the input-to-output mapping.
1. Isolate the objects that form the interface from the objects that define the
semantics of the application.
5. Fully specify the application functions that are invoked by the interface. Make
sure that the information to implement them is present.
4. Dynamic Simulation: A dynamic simulation models or tracks objects in the real
world. The steps in designing a dynamic simulation are:
1. Identify actors, real-world objects from the object model. The actors have
attributes that are periodically updated. The actors have attributes that are periodically
updated.
There is a set of features that you want your system to acheive. You have a set of
available resources. Think of the distance between them as a gap. Your job is to build a
bridge across the gap. There are several sources of high-level needs: Use cases,
application commands, and system operations, and services. Resources includes the
operating system infrastructure, class libraries, and previous applications.
Available Resources
Furthermore, if the gap is large you will need to organize the intermediate
elements into multiple levels. The intermediate elements may be operations, classes, or
other UML, constructs. Inventing good intemediate elements is the essence of successful
design. Often the intermediate elements sre not obvious. There can be many ways to
decompose a high-level operation. If the intermediate elements have already been built,
you can just use them,but the principle of bridging the gap is the same. You still have to
find the elements in a framework or a class library, select them, and fit them together.
Realizing Use Cases:
Usecases define the required behaviour, but they do not define its realization. That
is purpose of design- to choose among the options and prepare for implementation. Each
choice has advantages and disadvantages. It is not sufficient merely to deliver the
behaviour, although that is a primary goal. You must also consider the consequences of
each chooice on performance, reliability, ease of future enhancement, and many other
"ilities". Design is the process of realizing functionality while balancing conflicting
needs.
• Withdraw
• Deposit
• Transfer
Designing Algorithm:
Now formulate an algorithm for each operation. The analysis specification tells
what the operation does for its clients, but the algorithm shows how it is done. Perform
the following steps to design algorithm;
Many operations are straight forward because they simply traverse the class
model to retrive or change attributes or links. The OCL provides a convinient notation for
expressing such traversals. Pseudocode helps to thing about the algorithm while defering
programming details.
• Computational Complexity
• Flexibility
When a class is meaningfull in the real world, the operation on it are usually clear.
During design, we introduce internal classes that do not correspond to real world classes.
The following questions must be asked ourselfs,
• Receiver of action.
• Focal Class
1.Functionality Layers:
2. Mechanism Layers:
Refactoring:
The intial design of the set of operations will contain inconsistencies,
redundancies, and inefficiencies. This is natural, because it is impossible to get a large
design correct in one pass. Martin fowler defines refactoring as changes to the internal
strcuture of software to improve its design without altering its external functionality. It
means that we step back, look accross many different classes and operations and
reorganize them to support further development better.
Refactoring may seem like a waste of time, but it is a essential part of any good
engineering process.
Design Optimization:
A good way to design system is to first get the logic correct and then optimize it.
The design model builds on the analysis model. The analysis model captures the logic of
the system while the design model adds development details. We can optimize the
inefficient but semantically correct analysis model to improve performance, but an
optimized system is more obscure and less likely to be reusable. Design optimizable
involves the following tasks:
Redundant associations are undesirable during analysis because they do not add
informations. Design has different motivations and focusses on the viability of a model
for implementation. The association from analysis may not form the most efficient
network., When you consider access patterns and relative frequencies. Start by examining
each operation and see what associations it must traverse to obtain its information. Next,
for each operation, note the following,
• Frequency of Access
• Fan-out
• Selectivity
After adjusting the structure of the classs model to optimize frequent traversals,
the next thing to optimize is the algorithm itself. One kay to algorithm optimization is to
eliminate dead paths as early as possible.
Sometimes it is helpful to define the new classes to cache derived attributes and
avoid recomputation. You must update the cache if any of the object on which it depends
are changed. There are three ways to handle updates.
• Explicit Updates
• Periodic recomputation
• Active values
REIFICATION OF BEHAVIOR:
Behavior written in code is rigid. You can execute it, but cannot manipulate it at
run time. Reification is the promotion of something that is not an object into an object.
Behavior usually meets this description. It isn't usually something that you would
normally manipulate. If you reify behavior, you can store it, pass it to other operations,
and transform it. Reification addds complexity but can dramatically exapnd the
flexibility of a system.
You reify bahavior by encoding it into an object and decoding it when it is run.
The resulting run-time cost may or may not be significant. If the encoding invokes high-
level procedures, the cost is only a few indirections. If the entire behavior is encoded ina
different language, however, it must be interpreted, which can be an order of magnitude
slower than direct execution of code.
ADJUSTMENT OF INHERITANCE:
As class design progresses, you can often adjust the definitions of classes and
operations to increase inheritance by performing the following steps;
Sometimes several classes define the same operation and can easily inherit it from
a common ancestor, but more often operations in different classes are similar but not
identical. By adjusting the definitions of the operations, you may be able to cover them
with a single inherited operation.
Before using inheritance, the operations must match. All operations must have the
same signature- that is, the same number and types of arguments and results. In addition,
the operations must have the same semantics. You can use the following kinds of
adjustments to increase the chance of inheritance.
• Inconsistent names.
• Irrelevant operations.
2. Abstracting Out Common Behavior:
You will not recognize all opportunities for inheritance during analysis, so it is
worthwhile to reexamine the class model looking for commonality. In addition, you willl
be adding new classes and operations during design. If two classes seem to repeat several
operations and attributes, it is possible that the two classes are really specializatins of the
same thing, when viewed at a higher level of abstraction. When there is common
behavior, you can create a common superclass for the shared features, leaving only the
specialized features in the subclasses. This transformation of the class model is called
Abstracting out a common superclass or common behavior.
The programmer is then tempted to inherit from the existing class to achieve part
of the implementation of the new class. This can lead to problems if other inherited
operations provide unwanted behavior. We discourage this inheritance of implementation
because it can lead to incorrect behavior.
1. Information Hiding:
During analysis we did not consider information visibility- rather our focus was
on understanding the application. The goals of design are different. During design we
adjust the analysis model so that it is practical to implement and maintain. One way to
improve the visibility of a design is by carefully seperating external specification from
internal implementation. This is called information hiding. Then you can change the
implementation of a class without requiring that clients of the class modify code.
2. Coherence of Entities:
During analysis you partitioned the class model into packages. This initial
organization may not be suitable or optimal for implementation. You should define
packages so that their interfaces are minimal and well defined. Te interface between two
packages consists of the associations that relate classes in one package to classes in the
other and operations that access classes across package boundaries.
SUMMARY
• System design is the high-level strategy for solving the problem and building a
solution.
• First step of system design is to divide the system in a small number of
subsystems.
• Each subsystem encompasses aspects of the system that share some common
property such as similar functionality, same physical location, execution on
same kind of hardware.
• System Topology defines the flow of information among subsystems. Each
concurrent subsystems must be allocated to a hardware unit,either a general
purpose processor or a specialized functional unit.
• We must be able to handle boundary conditions such as initialization,
termination and failure.
• Cost, maintainability, portability, understandability, speed, may be traded off
during various parts of system design.
• There are several prototypical architectural frameworks that are common in
existing systems.
• System design is the high-level strategy for solving the problem and building a
solution.
• First step of system design is to divide the system in a small number of
subsystems.
• Each subsystem encompasses aspects of the system that share some common
property such as similar functionality, same physical location, execution on
same kind of hardware.
• System Topology defines the flow of information among subsystems.
• Each concurrent subsystems must be allocated to a hardware unit,either a
general purpose processor or a specialized functional unit.
• We must be able to handle boundary conditions such as initialization,
termination and failure.
• Cost, maintainability, portability, understandability, speed, may be traded off
during various parts of system design.
• There are several prototypical architectural frameworks that are common in
existing systems.
• During analysis we did not consider information visibility- rather our focus on
understood the application.
KEY TERMS:
• System topology
• Explicit updates
• Periodic recomputation
• Active values
• System design
• Initialization
• Termination
• Failure.
• Subsystem