From the course: Learning SOLID Programming Principles
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Introduction to single responsibility - Python Tutorial
From the course: Learning SOLID Programming Principles
Introduction to single responsibility
- [Instructor] The fifth and final SOLID design principle I'd like to demonstrate is the Single Responsibility Principle. The Single Responsibility Principle says a class should have responsibility over a single part of the functionality provided by the software, and the responsibility should be entirely encapsulated by the class. A common paraphrase of this is, a class should have one and only one reason to change. This raises an interesting question. What does single mean here? Does single mean the whole boat, or just one mast, or just one sail? What does single mean? This question is really about finding the right level of abstraction. The goal is to have a class which can be summarized with a succinct responsibility statement. The statement distinguishes one class from all the other classes in the application. Membership in the class is unambiguous. A class which models a ship as a whole, will be a composite…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.