Reconstructing an Architecture

21
Reconstructing an Architecture

description

Reconstructing an Architecture. Why. Lost documentation No documentation ever Architectural drift Prove conformance. Approaches. Manual Methods Top down For example, start with high-level diagrams Bottom up For example, start with comments in code Opportunistic - PowerPoint PPT Presentation

Transcript of Reconstructing an Architecture

Page 1: Reconstructing an Architecture

Reconstructing an Architecture

Page 2: Reconstructing an Architecture

Why

Lost documentationNo documentation everArchitectural driftProve conformance

Page 3: Reconstructing an Architecture

Approaches

Manual Methods Top down

For example, start with high-level diagrams Bottom up

For example, start with comments in code Opportunistic

Use whatever is available

Tools

Page 4: Reconstructing an Architecture

Tool-Based Reconstruction

View Extraction

DB

Presentation

Pattern Recogn.

Visualization

View Fusion

Reconstruction

Doc

System

Page 5: Reconstructing an Architecture

Data Source Types

StaticDynamic

Page 6: Reconstructing an Architecture

Tools

ParsersAbstract Syntax Tree AnalyzersLexical AnalyzerProfilersCode instrumentation toolsAd hocWorkbench

Page 7: Reconstructing an Architecture

Extracted Data

<includes file file><contains file function><defines_var file variable><contains directory directory><contains directory file><calls function function><access_read function variable><access_write function variable>

Page 8: Reconstructing an Architecture

Guidelines

Use least-effortValidate the information extractedExtract dynamic information when needed For example, if the system uses a lot

of late binding or runtime configuration

Page 9: Reconstructing an Architecture

Tool-Based Reconstruction

View Extraction

DB

Presentation

Pattern Recogn.

Visualization

View Fusion

Reconstruction

Doc

System

Page 10: Reconstructing an Architecture

Database Structure

Need a standard format or model Authors use Rigi Standard Format RDF triples are very similar, and OWL

reasoning might be useful

Efficient queriesSupport fusion Checkpointing for intermediate results

Page 11: Reconstructing an Architecture

DB tables

Table of relation namesTable of elementsTable for each relation - triples

RelationTable

RelationType Thing1 Thing2

IncludesTable

File1 File2

ContainsTable

File Function

And/Or

Page 12: Reconstructing an Architecture

Tool-Based Reconstruction

View Extraction

DB

Presentation

Pattern Recogn.

Visualization

View Fusion

Reconstruction

Doc

System

Page 13: Reconstructing an Architecture

View Fusion

ReconcileAugmentEstablish connections

Page 14: Reconstructing an Architecture

Example: fusing static and dynamic views of the “calls” relation

Static: calls extracted from source List::length PrimitiveOp::Compute

Dynamic: calls detected by profiler List::length List::getnth ArithmeticOp::Compute StringOp::Compute

Static analyzer missed this (no reason given)

What about these?

Page 15: Reconstructing an Architecture

Fusing static+dynamic, continued

PrimitiveOp

+Compute

ArithmeticOp

+Compute

StringOp

+Compute

Static analyzer saw this

Profiler saw these

List::lengthList::getnthPrimitiveOp::Compute

Fused list of calls:See examples 10-4, 10-5p 240

Page 16: Reconstructing an Architecture

Example: fusing calls from different processes

main() { register();}

Server

main() { launch();}

GUI Launcher

Calls

main register

main launch

Calls

Server.main register

Launcher.main launch

Unfused Fused

Page 17: Reconstructing an Architecture

Guidelines for Fusions

Fuse when no single view shows needed informationFuse when a view is too ambiguous and ambiguity can be resolved by fusionUse multiple extraction techniques Different kinds of tools Different implementations of tools

Page 18: Reconstructing an Architecture

Tool-Based Reconstruction

View Extraction

DB

Presentation

Pattern Recogn.

Visualization

View Fusion

Reconstruction

Doc

System

Page 19: Reconstructing an Architecture

Reconstructions

SQL examples for ReconstructionsSee 10.9 – aggregate local variables

Build SQL queries for reconstruction

Page 20: Reconstructing an Architecture

Yet more guidelines

Work with the architect if possibleCode segments should be as re-usable as possible A “code segment” is a capability based on

DB query + other code, that can identify patterns or create views

Code segments can take advantage of Naming conventions Directory structure

Page 21: Reconstructing an Architecture

Example in text

Repeated view fusions and aggregations eventually produce a just-barely-usable viewpp 248 – 257