Chapter_7_(new)
Chapter_7_(new)
HIERARCHICAL ARCHITECTURE
Objectives
Introduce the concepts of hierarchical software
architecture
Describe the main-subroutine, master-slave, and
layered architectures
Discuss the application domains of hierarchical
software architecture
Discuss the benefits and limitations of
hierarchical software architecture
Demonstrate the hierarchical software
architecture in OS scripts and Java
Agenda
• Hierarchical Architecture
– Overview
– Characteristics
• Main-Subroutine Architecture
• Master-Slave Architecture
• Layered Architecture
• Virtual Machine
Overview
• Viewing the whole system as a hierarchy
structure.
• The system is decomposed into logical
modules (sub-systems) at different levels
in the hierarchy.
• A lower level module provides services to
its adjacent upper level modules
Main-Subroutine Architecture
• The purpose is to reuse the subroutines
– individual subroutines developed
independently.
• Data location
– In the classical procedural paradigm
• typically data are shared by related subroutines at
the same level.
– With object orientation,
• the data is encapsulated in each individual object
so that the information is protected.
Main-Subroutine Characteristic
Main-Subroutine Characteristic
• Using this style, a software system is
decomposed into subroutines hierarchically
• The hierarchy will be refined according to the
desired functionality of the system.
• Refinements are conducted vertically until
– The decomposed subroutine is simple enough to
have its sole independent responsibility
– Whose functionality may be reused and shared by
multiple callers.
Main-Subroutine Characteristic
• Data is passed as parameters to
subroutines from callers.
• There are 2 different ways to pass on
parameter data:
– Passed by reference where the subroutine
may change the value of data referenced by
the parameter.
– Passed by value where the subroutine only
uses the passed data but cannot change it.
Main-Subroutine Characteristic
• A Data Flow Diagram (DFD) is often used to
model the software requirement
• During the mapping from DFD to the Main-Subroutine architecture e
need to find
– Transform flows
• incoming flow feeds data in an external format which is transformed
into another format, and then the outgoing flow carries the data out.
– Transaction flows.
• evaluates incoming data and decides to follow one of many action
paths.
• Then separate the incoming path and all action paths, and classify
each action path as transform or transaction flows.
Main-Subroutine Characteristic
• A transform flow is mapped by a
controlling module for incoming, transform
and outgoing information processing.
• A transaction center is located at the fork
origin of action paths.
A B C
6
Action path
purchase
3
record validate return
7
Customer 1 2 Action path
Customer 8
4
Info
Main-Subroutine Characteristic
• Benefits:
– Easy to decompose
• the system based on the definition of the tasks in a
top-down refinement manner.
– This architecture can still be used in a sub-
system of OO Design.
• Limitations:
– Globally shared data in classical main-
subroutines introduces vulnerabilities.
– Tight coupling may cause more ripple effects
of changes
Master-Slave Architecture
• Is a variant of the main-subroutine architecture
style supports
– fault tolerance
– system reliability.
• The master selects a particular service result
among slaves by certain selection strategy.
• The slaves may perform
– the same functional task by
• different algorithms
• different methods
– totally different functionality.
Master-Slave Architecture
Master
Limitations:
– Slow execution of the interpreter due to the interpreter
nature.
– Additional overhead due to the new layer.