Dependency complexity
Issue summary
A component has an overly complex dependency structure, relying on too many or deeply nested dependencies. This increases architectural complexity, tight coupling, and maintenance difficulty, making the app harder to test, extend, and optimize.
Platform target and tolerance:
- Target: ≤ 5 dependencies per component
- Tolerance: up to 10 dependencies per component
Why it matters
Excessive dependency complexity makes the codebase rigid and error-prone, slowing development and increasing maintenance costs. Simplifying dependencies improves modularity, flexibility, and performance.
How severity is calculated
Severity | Definition |
---|---|
No issue raised | ≤ 5 dependencies. Low complexity, acceptable. |
Low–Medium | 6–10 dependencies. Moderate complexity, review needed. |
High–Critical | > 10 dependencies. High complexity, refactor strongly recommended. |
How to fix a dependency complexity issue
Since the Kotzilla platform has detected components with overly complex dependency trees, your focus should now be on analyzing these components’ responsibilities, identifying tightly coupled areas, and refactoring to reduce complexity and improve architecture.
Focus on:
- Applying Clean Architecture principles (SRP, SoC, DIP)
- Breaking down large components into smaller, focused services
- Organizing dependencies using Koin modules to keep layers separate and maintainable
Recommended actions
-
Apply the Single Responsibility Principle (SRP)
A class or component should only have one reason to change. If a component has more than five dependencies, it likely handles multiple concerns. Refactor by splitting responsibilities into distinct services or classes. -
Strengthen separation of concerns
Separate your app into clear layers (such as UI, domain, and data layer) and organize them into distinct Koin modules. This keeps dependencies decoupled and aligned with Clean Architecture principles, making the codebase easier to maintain. -
Follow the Dependency Inversion Principle (DIP)
Ensure high-level modules depend on abstractions, not on low-level implementation details. Use interfaces or abstractions for injected dependencies and configure them in Koin. This reduces coupling and improves testability.
Use the Kotzilla SDK API and the Console to investigate
The Kotzilla Console provides detailed insights into dependency graph complexity, showing how many direct and indirect dependencies each component has. Use the Timeline to visualize and analyze those complex graphs.
With the SDK API, you can also add custom instrumentation to trace and monitor dependency usage and resolution during runtime.
For full setup and usage, refer to the Kotzilla SDK API documentation.
Need help?
Facing challenges simplifying your dependency graph? Our experts are here to help you refactor and improve your architecture for better performance and maintainability. Reach out anytime for best practices and tailored guidance!