CSE Roadmap

Core tier · about 3 hours · 7 parts

Part 1 of 7 · 1 min read

Why this page comes first in Level 2

In this module you will

  • State the single responsibility principle (SRP) in terms of who asks for a change.
  • Spot a class that serves two different groups of people.
  • Explain how shared code causes accidental duplication and merge trouble.
  • Split a class into smaller ones and keep one simple entry point.
  • Tell SRP apart from the weaker rule "a function should do one thing".

Level 1 showed how to build classes. This level asks how to build good ones, and the first answer is also the most used in interviews: keep each class small in purpose. The source is "Clean Architecture" (CA), chapter 7, with help from "Clean Code" (CC). Code was compiled and run before it was written here. Numbers marked "made up" only show the idea.