Software Architecture Session9

34
SOFTWARE ARCHITECTURE Chapter 10: Reconstructing Software Architectures

description

Software Architecture

Transcript of Software Architecture Session9

Page 1: Software Architecture Session9

SOFTWARE ARCHITECTURE

Chapter 10:Reconstructing Software

Architectures

Page 2: Software Architecture Session9

Reconstructing Software Architectures• What if you have software that has no architecture

documentation?o Never recordedo Recorded but losto Evolution didn’t include updating the documentation

• Finding the architecture hidden in an existing systemo Detailed analysis with tool supporto Hard, messy, and not always possible

Page 3: Software Architecture Session9

Reconstruction Process

• Interpretive, interactive, and iterative, involving many activities; it is not automatic!

• Needs skills of a reverse engineering expert and the system’s expert o Reconstruct from implementation elementso Complier construction techniques & tools: grep, sed,

awk, perl, python, and lex/yacc, etc.

Page 4: Software Architecture Session9

Architecture Reconstructions

• Architecture Reconstructions has been used for projects like :-o MRI scannerso Public telephone switcheso Helicopter guidance systemso Classified NASA systemso Physics simulation systemso Embedded control software for mining machineryo Satellite ground systemso A variety of automotive software

Page 5: Software Architecture Session9

Workbench Approach

• Workbench approach is a design philosophy for a tool set to support architecture reconstruction.

• No single tool or tool set is adequate• Tools tend to be language specific

o EX: MRI scanner can have software in 15 languages• Data extraction tools are imperfect

o Incomplete results o Use tools to augment and check on each other

Page 6: Software Architecture Session9

Reconstruction Activities

• Iteratively, do:o Information extraction - from various sources.o Database construction - into standard form.o View fusion – combine information in the

database to produce a coherent view of the architecture .

o Reconstruction – main work of building abstractions and representations.

Page 7: Software Architecture Session9

Information Flow among Activities

Page 8: Software Architecture Session9

Information Extraction• Analyzing existing design and implementation artifacts

to construct a model• Blend of the ideal with the practical

o Ideal – what you want to discovero Practical – what available tools can give you

• Static - looking at system artifacts• Dynamic – looking at runtime behavior• Multi-process and multi-processor systems with

middleware such as J2EE, Jini, or .NET, frequently build topology dynamically, depending on availability of system resources. The topology of such systems does not live in its source artifacts and hence cannot be reverse engineered using static tools.

Page 9: Software Architecture Session9

Database construction & Guidelines• The extracted information is converted

into a standard format for storage in a database during database construction.

Page 10: Software Architecture Session9

View Fusion

• It involves defining and manipulating extracted information to reconcile, augment and establish connections between the elements.

Page 11: Software Architecture Session9

Reconstruction

• Visualization and interaction• Pattern definition and recognition

Page 12: Software Architecture Session9

Questions to the participants

• Have you done any similar work?• What type of application?• Why was the effort important?• What were your results?

Page 13: Software Architecture Session9

PATTERN ORIENTED SOFTWARE

ARCHITECTURE - VOLUME1Chapter 1 - An Introduction

Page 14: Software Architecture Session9

What is a Pattern?

• A pattern addresses a recurring design problem that arises in specific design situations, and presents a solution to it.

Page 15: Software Architecture Session9

What Makes a Pattern?

• It is a three-part schema that underlies every pattern:o Context : a situation giving rise to a problem.o Problem : the recurring problem arising in that context.o Solution : a proven resolution of the problem.

• The schema as a whole denotes a type of rule that establishes a relationship between a given context, a certain problem arising in that context, and an appropriate solution to the problem. All three parts of this schema are closely coupled.

• However, to understand the schema in detail, we have to clarify what we mean by context, problem, and solution.

1/18/2011

Page 16: Software Architecture Session9

Design – Principles

• Consider designing an “entrance to a building”o Physical entity could be a door, a change in

elevation, or through a courtyard.o Principle: Transition of the environment – i.e.

crossing the boundary - should be a sensory experience.

• Consider creating an opening scene for a movieo An event or an activity that includes principal actors

(hero, heroine, villain) o Principle: Establish the “embodiment” – i.e. physical

realization - of a theme.

Page 17: Software Architecture Session9

Design - Implements/Processes

• Building Entranceo Drawing of the front viewo Clay model of courtyard

• Movie Openingo A car chaseo A confrontation between adversaries

Page 18: Software Architecture Session9

Design - Templates

• Building Entranceo Library: “High elevation” entranceso Airport: Wide entrance with multiple doorso Church: “oak doors with stained glass decorations”

• Movie Openingo Villain has a weapons factory – hero destroys it:

“James Bond” templateo Young kid gets separated from mother/brother: -

Bollywood.

Page 19: Software Architecture Session9

Software Design –Principles and Implements / Processes

• Principles:o Basic: Separation of Concerns o Implied: Modularity and Re-use.

• Implements / Processes:o Top-down designo Language constructs for data abstractiono User Interface Toolkit

Page 20: Software Architecture Session9

Templates

• What are templates?o They provide (generic) solutions – often for

more than one instance of a problem.o These solutions can be (contextually) reused

with minor adaptations.• Templates are contextual but generic

solutions that are re-usable with minor adaptations.

1/18/2011

Page 21: Software Architecture Session9

Software Design – Templates

Example 1: Iterate over array elements in C or Java for ( j=0; j<N; j++) … A[j] …

Example 2: Use indirection to enable sharing. int *m, *n; … // Assignments to m, n swap(m, n); // Code in swap may modify m,n

Page 22: Software Architecture Session9

Software Design – Templates [2]

• Example 3: Store interfaces or type declarations in header files (of a C program)

/*file Set.h */typedef unsigned int Set;

/*file SetOps.h */Set setUnion(Set s1, Set s2);

/*file SetOps.h */Set setUnion(Set s1, Set s2){return s1 | s2;}

Page 23: Software Architecture Session9

Software Design – Templates [3]

• Example 4: Browser - Document Object Modelo Requirements:

Elements may contain other elements e.g. Table may contain a Form or another Table; a Form contain a Table. etc.

Parser should present a uniform interface for all elements to other modules (say rendering engine)

Page 24: Software Architecture Session9

Software Design – Templates [4]

• Example 4 (contd..) - Design:

Element

Layout Container

Text Formatter

is-a

Semantic Element

is-a

is-a

Anchorcomposed of

1..n

Table

is-a

Form

is-a

Page 25: Software Architecture Session9

Software Design – Templates [5]

• Example 5: Sets or Collections – Operationso Requirements:

Operations may have to access each element of a set / collection

Different implementations (with different pros and cons) are available for collections.

o Design: Provide a way to enumerate elements of a set. Operations use enumerator for accessing elems.

Page 26: Software Architecture Session9

Software Design – Templates [6]

• Example 6: Design an online document publishing system for BITSo Requirements:

Authors submit documents online in different formats.

Publishing system uses different markup languages for different displays.

Documents have to spell-checked before being published.

Page 27: Software Architecture Session9

Software Design – Templates [7]

• Example 6 (contd..) - Design:

Generic Transducer

PDFDoc.

Word Doc.

XML

Spell CheckerXML

Device Transducer

BITS Styler

DeviceML

Display / BlasterDeviceML

DeviceStyle

Page 28: Software Architecture Session9

Software Design – Templates [8]

• Example 6 (contd..) – Design:o Modules are designed as input to output

transducers. That is, they are filters! (recall Unix commands)

o Modules are not sharing any external data or other modules. So, they can be run concurrently (without explicit

synchronization). That is, they can be piped! (recall Unix pipes)

Page 29: Software Architecture Session9

Software Design – Templates [9]

• Observations:o There are some differences among templates o Problem contexts are different:

Low level design (close to coding) Medium level design High level design (close to architecture)

o Often leads to different granularities!

Page 30: Software Architecture Session9

Software Design – Templates [10]

• Low level templates:o Fine grained;o Often no additional work required to use.o Implementation (say language or OS) specific o An IDIOMSo Almost always work as advertised!o Examples:

1 (Iteration & Arrays), 2 (Sharing & Indirection) 3 (Program Structuring in C)

Page 31: Software Architecture Session9

Software Design – Templates [11]

• Medium level templates:o Not so fine-grained;o Adaptations often required for specific

situation/problem.o May lead to minor problems when mis-applied.

Page 32: Software Architecture Session9

Software Design – Templates [12]

• High level templates:o Coarse-grained.o Often require lot of customization and

implementation to achieve desired result.o Often Specific to problem domain.o When mis-applied lead to disastrous results!o An (ARCHITECTURAL) FRAMEWORKS o Examples:

6 (Document Publishing – Pipe & Filter Architecture)

Page 33: Software Architecture Session9

Summary

5:32 AM SEPS ZG651 Software Architectures

Page 34: Software Architecture Session9

5:32 AM SEPS ZG651 Software Architectures