-
Book Overview & Buying
-
Table Of Contents
Agile Technical Practices Distilled
By :
The Interface Segregation Principle (ISP) states that clients should not be forced to depend upon interfaces that they do not use. The goal of the ISP is to reduce the side effects and the amount of changes needed in a system by splitting the software into multiple, smaller, independent parts grouped by functionality.
Robert C. Martin, The Interface Segregation Principle, Engineering Notebook, C++ Report, Nov-Dec, 1996.
The dependency should be on the interface, the whole interface, and nothing but the interface. We refer to a sound line of reasoning, for example, as coherent. The thoughts fit, they go together, they relate to each other. This is exactly the characteristic of an interface that makes it coherent; the pieces all seem to be related, they seem to belong together, and it would feel somewhat unnatural to pull them apart. Such an interface exhibits cohesion.
Let's look at an example:
public class Car : IAmACar{
......
Change the font size
Change margin width
Change background colour