SOLID

Solid By Clean Architecture Robert C. Martin Series 2020-02-01

[S] - SRP, single responsibility principle

Of all the SOLID principles, the Single Responsibility Principle (SRP) might be the least well understood. That’s likely because it has a particularly inappropriate name. It is too easy for programmers to hear the name and then assume that it means that every module should do just one thing.

Make no mistake, there is a principle like that. A function should do one, and only one, thing. We use that principle when we are refactoring large functions into smaller functions; we use it at the lowest levels. But it is not one of the SOLID principles—it is not the SRP.A module should have one, and only one, reason to change.

A module should be responsible to one, and only one, actor.

[O] - OCP: THE OPEN-CLOSED PRINCIPLE

A software artifact should be open for extension but closed for modification.

Divide the parts that change and the parts that aren't. And apply composition or inheritance. Depends on interfaces not concrete one between components.

Reference fro

Clean Architecture: A Craftsman's Guide to Software Structure and Design (Robert C. Martin Series)

Buy Me A Coffee