210 likes | 302 Views
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
E N D
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 • Use whatever is available • Tools
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 • For example, if the system uses a lot of late binding or runtime configuration
System Tool-Based Reconstruction Reconstruction Pattern Recogn. View Extraction Visualization DB Doc Presentation View Fusion
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 queries • Support fusion • Checkpointing for intermediate results
DB tables • Table of relation names • Table of elements • Table for each relation - triples And/Or …
System Tool-Based Reconstruction Reconstruction Pattern Recogn. View Extraction Visualization DB Doc Presentation View Fusion
View Fusion • Reconcile • Augment • Establish connections
What about these? Static analyzer missed this (no reason given) 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 saw this PrimitiveOp ArithmeticOp StringOp +Compute +Compute +Compute Profiler saw these Fusing static+dynamic, continued Fused list of calls: See examples 10-4, 10-5 p 240 List::length List::getnth PrimitiveOp::Compute
Server GUI Launcher main() { register(); } main() { launch(); } Example: fusing calls from different processes Unfused Fused Calls Calls
Guidelines for Fusions • Fuse when no single view shows needed information • Fuse 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
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
Yet more guidelines • Work with the architect if possible • Code 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
Example in text • Repeated view fusions and aggregations eventually produce a just-barely-usable view • pp 248 – 257