Free SOLID and design smells lessonsSOLID and design smells · Stage 1 · Substitution and dependencies · Step 2
Interface segregation
Why clients shouldn't depend on methods they don't use, and how to split a fat interface into role interfaces. About 11 minutes.
Which is the clearest sign that an interface violates the interface segregation principle?
- ASome implementers throw UnsupportedOperationException for methods that don't apply to them
- BIt has only one method
- CIt uses generics
Show the answer
Some implementers throw UnsupportedOperationException for methods that don't apply to them. They're being forced to take on a contract that isn't theirs.
4 questions on this idea
Short questions that apply the idea to new cases: trace it, work out a number, put steps in order. A wrong answer explains itself.
Answer them in your browserFree account, no card. Your progress is saved, and the idea comes back in a quick review later.
Sign up free to solve