Chapter 2

Inverting Dependencies

After the rant about layered architecture in the previous chapter, you are right to expect this chapter to discuss an alternative approach. We will start by discussing the Single Responsibility Principle and the Dependency Inversion Principle. They are the "S" and the "D" of the SOLID principles, which you can read about in detail in "Clean Architecture" by Robert C. Martin or on Wikipedia at https://en.wikipedia.org/wiki/SOLID).

The Single Responsibility Principle

Everyone in software development probably knows the Single Responsibility Principle (SRP) or at least assumes they know it.

A common interpretation of this principle is this:

A component should do only one thing, and do it right.

That's good advice, ...

Get Get Your Hands Dirty on Clean Architecture now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.