CodeIntermediate

Single Responsibility Principle

Also known as SRP · single responsibility

A design principle that groups code around one responsibility, so it has one coherent reason to change.

In the real world

Separate invoice calculation from PDF formatting because pricing rules and document layouts change for different reasons.

Related

Go a little deeper