- Référence externe : https://doc.rust-lang.org/book/ch12-03-improving-error-handling-and-modularity.html
- Référence externe : https://en.wikipedia.org/wiki/Single-responsibility_principle
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.
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," although, because of confusion around the word “reason” he more recently stated “This principle is about people."
Notes pointant ici
- advice for computer scientists
- playwright/test + ts-node = wrong stack traces (blog)
- polymorphic command line interface (in clk)
- service mesh implementation and single-responsibility principle