...

/

Integration Segregation Principle

Integration Segregation Principle

Learn about the integration segregation principle (ISP) in software design.

The interface segregation principle (ISP) provides some guidelines for an idea that we have covered repeatedly already: that interfaces should be small. In object-oriented terms, an interface is represented by the set of methods and properties an object exposes. That is to say that all the messages that an object is able to receive or interpret constitute its interface, and this is what other clients can request. The interface separates the definition of the exposed behavior for a class from its implementation. In Python, interfaces are implicitly defined by a class according to its methods. This is because Python follows the so-called duck typing principle.

Press + to interact

Traditionally, the idea behind duck typing was that any object is really represented by the methods it has, and by what it is capable of doing. This means that, regardless of the type of the class, its name, docstring, class attributes, or instance attributes, what ultimately defines the essence of the object are the methods it has. The methods defined in a class (what it knows how to do) are what determines what that object will be. It was called duck typing because of the idea that, "If it walks like a duck, and quacks like a duck, it must be a duck." ...