liveBook · Manning

Dependency

As explained in .NET in Action, Second Edition

A dependency is an external software component required by an application or another software component.

A software dependency is an external component or resource that an application relies on. Dependencies can complicate unit tests or cause applications to behave differently across machines. section 6.1 section 13.1

Keep unit tests quick and independent of external dependencies where possible. For complex code, dependency injection and dependency inversion support replacing dependencies with mocks or fakes that return chosen values. section 6.1 section 7.0

Containers make required resources and dependencies explicit. A container based on a specific .NET image can also limit exposure to changes in the host machine’s .NET version. A .NET Framework 4.5 application that assumes paths stop at 260 characters, for example, can fail on a machine running .NET Framework 4.6.2, where the path limit differs. section 13.1

How .NET in Action, Second Edition covers it

How deep it goes
Explains test substitution and container-based dependency control through practical examples, without detailing dependency implementation.
Examples
Uses file and console side effects, ASP.NET Core components, and a .NET Framework path-length mismatch to illustrate dependency concerns.
What you can do after
Evaluate testing and deployment risks arising from external dependencies and machine-specific runtime differences.
How it connects
Connects dependencies to unit testing, side effects, dependency injection, dependency inversion, mocks, fakes, and containers.

Also explained in

Compare how 27 books explain dependency →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of .NET in Action, Second Edition. The section links point to the parts of the book it draws on.