Reconstructing an Architecture
Why Lost documentation No documentation ever Architectural drift Prove conformance
Approaches Manual Methods Top down Bottom up Opportunistic Tools
Tool-Based Reconstruction System Tool-Based Reconstruction Reconstruction Pattern Recogn. View Extraction Visualization DB Doc Presentation View Fusion
Data Source Types Static Dynamic
Tools Parsers Abstract Syntax Tree Analyzers Lexical Analyzer Profilers Code instrumentation tools Ad hoc Workbench
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>
Guidelines Use least-effort Validate the information extracted Extract dynamic information when needed
Tool-Based Reconstruction System Tool-Based Reconstruction Reconstruction Pattern Recogn. View Extraction Visualization DB Doc Presentation View Fusion
Database Structure Need a standard format or model Efficient queries Authors use Rigi Standard Format Efficient queries Support fusion Checkpointing for intermediate results
DB tables Table of relation names Table of elements Table for each relation - triples RelationTable RelationType Thing1 Thing2 And/Or IncludesTable File1 File2 ContainsTable File Function …
Tool-Based Reconstruction System Tool-Based Reconstruction Reconstruction Pattern Recogn. View Extraction Visualization DB Doc Presentation View Fusion
View Fusion Reconcile Augment Establish connections
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::getnth ArithmeticOp::Compute StringOp::Compute What about these? Static analyzer missed this (no reason given)
Fusing static+dynamic, continued PrimitiveOp +Compute Static analyzer saw this Profiler saw these ArithmeticOp +Compute StringOp +Compute Fused list of calls: See examples 10-4, 10-5 p 240 List::length List::getnth PrimitiveOp::Compute
Example: fusing calls from different processes main() { register(); } Server main() { launch(); } GUI Launcher Unfused Fused Calls Calls main register launch Server.main register Launcher.main launch
Guidelines for Fusions When no single view shows needed information When a view is too ambiguous and ambiguity can be resolved by fusion Use multiple extraction techniques Different kinds of tools Different implementations of tools
Tool-Based Reconstruction System Tool-Based Reconstruction Reconstruction Pattern Recogn. View Extraction Visualization DB Doc Presentation View Fusion
Reconstructions SQL examples for Reconstructions See 10.9 – aggregate local variables Build SQL queries for reconstruction
Guidelines Work with the architect if possible Code segments should be effective at producing new and useful view Naming conventions Directory structure
Example in text Repeated view fusions and aggregations eventually produce a just-barely-usable view pp 248 – 257