I — What is that Interface Segregation?

Tuba Saday
What is that  ‘SOLID’?
2 min readOct 20, 2021

Interface segregation is a principle that determines how we should design our interfaces.

The ISP was first used by Robert Martin when consulting for Xerox. Xerox had designed a new printer capable of performing a variety of tasks such as stapling and faxing. The software that used on the devices for this system was created from scratch.

As the software is rebuilt, all the responsibilities that the machine can do, including printing, stapling, are assigned to the same class.
As time passes, It became more and more difficult to make changes to the code, and even the smallest change required an hour of deployment time, making it nearly impossible to develop the software.

As a result of this situation, Martin organized the software with the principles of interface Segregation and Dependency Inversion and separated this god class into small interfaces.

According to this principle, units should not inherit methods and variables that they do not need. Small and high coherence classes should be preferred instead of fat and non-coherence classes.

If we have these in our code, it means we do not comply with the ISP;

  • Fat Interfaces
  • NotImplementationException
  • A class that uses only a small part of a large interface

We can solve the above problems by separating these big interfaces according to their in-class coherence.

--

--

Tuba Saday
What is that  ‘SOLID’?

It’s a non stoppable learner and an insane developer.