Cataloging Dependency Injection Anti-Patterns in Software Systems
Rodrigo Laigner, Diogo Mendon\c{c}a, Alessandro Garcia and, Marcos Kalinowski

TL;DR
This paper introduces a catalog of 12 Java Dependency Injection anti-patterns, validated through static analysis and practitioner surveys, aiming to improve code quality by guiding developers to avoid common DI pitfalls.
Contribution
The study proposes a comprehensive catalog of DI anti-patterns, develops a static analysis tool with high accuracy, and evaluates practitioner perceptions, filling gaps in practical understanding of DI anti-patterns.
Findings
At least 9 DI anti-patterns are common in analyzed projects.
The static analyzer achieved 92.19% recall and high precision.
Practitioners find the catalog relevant and are willing to refactor anti-patterns.
Abstract
Context: Dependency Injection (DI) is a commonly applied mechanism to decouple classes from their dependencies in order to provide higher modularization. However, bad DI practices often lead to negative consequences, such as increasing coupling. Although white literature conjectures about the existence of DI anti-patterns, there is no evidence on their practical relevance, usefulness, and generality. Objective: The objective of this study is to propose and evaluate a catalog of Java DI anti-patterns and associated refactorings. Methodology: We reviewed existing reported DI anti-patterns in order to analyze their completeness. The limitations found in literature motivated proposing a novel catalog of 12 DI anti-patterns. We developed a tool to statically analyze the occurrence level of the candidate DI anti-patterns in both open-source and industry projects. Next, we survey practitioners…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Software System Performance and Reliability · Software Reliability and Analysis Research
