Saturday, February 16, 2013

Interface Segregation principle (ISP)

This principle is I of S.O.L.I.D design principles.

Interface Segregation Principle stats that a client should not implement an interface if it doesn’t use that. this happens mostly when one interface contains more than one functionality and client only need one functionality and not other.Interface design is tricky job because once you release your interface you can not change it without breaking all implementation. Another benefit of this desing principle in Java is, interface has disadvantage to implement all method before any class can use it so having single functionality means less method to implement.

Here is an easy to understand ISP example

No comments: