21 — Program Representations for Design Analysis¶
Driving question: What information must a machine observe to reason about design?
Learning objectives¶
- Compare AST, CFG, call graph, type graph, dependency graph, repository history, and learned representations.
- Match representation to research question.
- Recognize information lost by each abstraction.
- Build hybrid representations when structure alone is insufficient.
Representation determines detectable evidence¶
| Representation | Captures well | Misses / approximates |
|---|---|---|
| AST | syntax, declarations, local structure | runtime behavior, design intent |
| CFG/data-flow | control/data dependencies | architectural semantics |
| Type/dependency graph | relationships among entities | dynamic dispatch details, intent |
| Call graph | possible calls | precision under reflection/dynamic dispatch |
| Commit graph | co-change/evolution | causal explanation |
| Text embedding | lexical/semantic similarity | precise structural constraints |
| Graph embedding/GNN | topology + learned features | interpretability, benchmark dependence |
Multi-view design analysis¶
Pattern detection may combine inheritance/association structure with method-call signatures and names. Smell prioritization may combine metrics with change history. Recommendation may combine repository context with natural-language issue descriptions.
Design / research exercise¶
Define a research question about pattern or smell detection. Specify the minimum software representation needed, then list at least three relevant facts that representation cannot recover reliably.
Suggested reading¶
- Program analysis and repository mining literature.