Konubinix' opinionated web of thoughts

Single-Responsibility Principle

Fleeting

As a function gains responsibilities, it becomes more difficult to reason about, harder to test, and harder to change without breaking one of its parts. It’s best to separate functionality so each function is responsible for one task.

https://doc.rust-lang.org/book/ch12-03-improving-error-handling-and-modularity.html

The single-responsibility principle (SRP) is a computer-programming principle that states that every class in a computer program should have responsibility over a single part of that program’s functionality, which it should encapsulate. All of that module, class or function’s services should be narrowly aligned with that responsibility.

Robert C. Martin, the originator of the term, expresses the principle as, “A class should have only one reason to change,"[1] although, because of confusion around the word “reason” he more recently stated “This principle is about people."[2]

https://en.wikipedia.org/wiki/Single-responsibility_principle

Notes pointant ici