Grokking SOLID Design Principles
Vote
0% completed
How Small Should an Interface Be
The previous lesson broke one large Printer interface into four, one method each.
That made the mechanics easy to see on a single screen. It is not a rule to follow.
If you apply "smaller is better" without a stopping point, you end up with one interface per method across a whole codebase. That is a real design in the same way that one class per line of code is a real design.
So what is the actual rule?
Group by Caller, Not by Method
An interface should carry the methods that one kind of caller needs.
Interfaces built this way are called role interfaces
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%