Exit Slides

Single Responsibility Principle (SRP)

overview

Summary

Remember: the single_responsibility_principle says each module, class, or function should have one responsibility. It should have a single_reason_to_change. If code both saves data and formats output, it violates SRP. Keeping one focus improves testability, readability, and maintenance. High cohesion and low coupling support SRP. Use clear names that reflect the single role. When requirements change, only the unit owning that role should change.
← Prev Topic Slide 1 / 2