Search code examples
oopinterfacesoasolid-principlesinterface-segregation-principle

When does the Interface Segregation Principle not apply? SOA?


I am looking for examples of scenarios where the Interface Segregation Principle (from SOLID) shouldn't be used.

The only one that I have seen mentioned (but not explained) is the case of the interface for a service in the context of SOA. But why? Is it because in this case the interface is supposed to be fat by design? By SOA decree?

Are there other situations where the ISP is not a good idea?

Thanks in advance.


Solution

  • SOLID are good principle, my idea is that you shouldn't apply them when you think you're over-engineering ! For instance I apply ISP mainly on the classes of my Service Layer, in the business layer, I'll change my classes because it's a change in business, I won't create a new implementation (and I break the Open/Close principle, but I don't care because it's business changes !).

    EDIT : I also apply ISP in my Data Layer, so I fact I apply ISP mainly for all the I/O matters (xml, sql, email ...).

    If you apply ISP every where, you'll end up with hundreds of interface, and that could be a nightmare to debug / initialize.