Friday, 6 July 2012

What is the Interface Segregation Principle?

Clients should not be forced to depend upon interfaces that they don't use.

When we write our interfaces we should only add methods that should be there so that if we do a new concrete implementation that it is relevant and that all the methods are used since the concrete implementation will use those methods too. For example if we create an interface called Worker and add a method lunch break, all the workers will have to implement it. What if the worker is a robot?

No comments:

Post a Comment