The Interface Segregation Principle — it’s confused

James Ellis-Jones
6 min readSep 10, 2019

This principle is one of Bob Martin’s own. It’s described in an online article.

Uncle Bob says:

The ISP acknowledges that there are objects that require non-cohesive interfaces; however it suggests that clients should not know about them as a single class. Instead, clients should know about abstract base classes that have cohesive interfaces.

This isn’t terribly clear. Essentially I would put it like this:

The ISP recommends a client should instead of depending directly on a concrete class, depend on an abstraction of that class which has the minimum practical subset of the methods of that class

In the article, Uncle Bob elaborates on two examples. This is interesting as the examples are related but the ‘clients’ are client code in one case and inheritors in another, and you often find the online articles about the ISP talk about one but not the other. They’re not the same thing which is why the ISP is confusing. Also in one of these cases, the reason he and those writing after him give for following the principle is in fact pretty pointless, and there is actually another reason why you should follow it which is never mentioned.

The ISP for inheritors

--

--