Five Things I Love About Spring
Subject:   What is a dependency again?
Date:   2005-05-18 07:22:14
From:   kelzer
Response to: What is a dependency again?

Apologies to O'Reilly for recommending a competitor's book, but Agile Software Development, Principles, Patterns, and Practices by Robert C. Martin (aka "Uncle Bob") has a very good section on the topic of dependencies. His name for the concept, the "Dependency-Inversion Principle", is less common than "Inversion of Control" (IoC) or "Dependency Injection", but they all deal with the same issue.

You can do a Google search to learn more on this topic, but in a nutshell, it says that your high level important business classes shouldn't be dependent upon lower level (less important) classes. You may have heard the terms "tightly coupled" and "loosely coupled" describing this same type of thing. Sometimes the dependencies are even cyclical, which is the worst condition (though it's acceptable, as is tight coupling, when the classes involved truely are very closely related and expected to always be used together. Normally, you'd expect these classes to exist in the same package.)