Podcast
Questions and Answers
What is the single-responsibility principle?
What is the single-responsibility principle?
- A module should be responsible to one and only one user
- A class should have only one reason to change (correct)
- A module should be responsible to multiple users
- A class should have multiple reasons to change
What is the goal of the single-responsibility principle?
What is the goal of the single-responsibility principle?
- To make a class more robust (correct)
- To couple two things that change for different reasons
- To make a class more efficient
- To make a class more versatile
What is an example of the single-responsibility principle?
What is an example of the single-responsibility principle?
- Separating the content of a report from the format of a report (correct)
- Having a module that compiles and prints a report
- Having a module that is responsible to multiple users
- Having a module that is responsible to one user