Glossary
By the Glue Team
Code dependencies are relationships where one piece of code relies on another. A function depends on a library. A service depends on a database. A module depends on another module. Understanding dependencies is crucial for understanding impact of changes, managing complexity, and architecting systems.
Code dependencies include:
Change Impact: Understanding dependencies shows what breaks if you change something. High-impact dependencies need careful changes.
Architecture Understanding: The dependency graph IS the architecture. Understanding dependencies reveals how systems interconnect.
Bottleneck Identification: If many things depend on one thing, that's a bottleneck. Changes require careful planning.
Risk Management: Tight coupling creates risk. Loose coupling reduces risk. Dependencies show coupling.
Scalability: Circular dependencies and tight coupling limit scalability.
"Dependencies are always bad." False. Some dependencies are necessary. Goal is to manage them, not eliminate them.
"Fewer dependencies is always better." False. Some dependencies make code simpler. Goal is appropriate coupling.
"You can't change code with many dependencies." False. Changes are possible but require care. Tests protect you.
Coupling: How tightly dependencies bind code.
Modularity: Good design minimizes inappropriate dependencies.
Architecture: Dependencies define architecture.
Q: How do you manage dependencies? A: Version carefully. Minimize surface area. Use dependency injection. Make dependencies explicit.
Q: What are dangerous dependencies? A: Circular dependencies. Hidden dependencies. Tight coupling. Dependencies on unstable code.
Q: Should you always minimize dependencies? A: Minimize inappropriate dependencies. Some dependencies make code clearer and more reusable.
Keep reading