23 — Automated Smell Detection¶
Driving question: How should a detector act when the smell concept itself has fuzzy boundaries?
Learning objectives¶
- Implement threshold/rule-based smell detection.
- Compare supervised and unsupervised approaches.
- Handle class imbalance and project-specific thresholds.
- Evaluate agreement with human judgments and downstream outcomes.
From rule to prediction¶
A detector can be framed as:
- rule evaluation;
- anomaly detection;
- binary/multilabel classification;
- ranking/prioritization;
- change-risk prediction.
Ranking may be more useful than binary labeling when developers have limited remediation capacity.
Evaluation beyond classification¶
Ask whether the detector:
- finds actionable issues;
- ranks important instances early;
- generalizes across projects;
- remains stable across versions;
- helps developers make better decisions;
- produces explanations that correspond to the actual rule/evidence.
Design / research exercise¶
Build a smell-ranking function that combines smell intensity and change frequency. Compare the top-10 ranking with a pure threshold detector and inspect which list seems more actionable.
Suggested reading¶
- Empirical literature on code smell detection and prioritization.