Interface Segregation Principle

Published on January 14, 2018

In this video we will discuss
1. Interface Segregation Principle
2. Will look at a Case Study of Interface Segregation Principle
3. And will implement Interface Segregation Principle with a simple example

In the first video of SOLID Introduction we have understood that I in the SOLID is acronym for Interface Segregation Principle
1. The interface-segregation principle (ISP) states that “no client should be forced to depend on methods it does not use”.
2. Which means, Instead of one fat interface many small interfaces are preferred based on groups of methods with each one serving one submodule.
3. The ISP was first used and formulated by Robert C. Martin while consulting for Xerox.

Let us now understand how the ISP was evolved with a case study.

CASE Study

Problem
• As we all know Xerox Corporation manufactures printer systems. In their development process of new systems Xerox had created a new printer system that could perform a variety of tasks such as stapling and faxing along with the regular printing task.

• The software for this system was created from the ground up.

• As the software grew for Xerox, making modifications became more and more difficult so that even the smallest change would take a redeployment cycle of an hour, which made development nearly impossible.

• The design problem was that a single Job class was used by almost all of the tasks. Whenever a print job or a stapling job needed to be performed, a call was made to the Job class.

• This resulted in a ‘fat’ class with multitudes of methods specific to a variety of different clients.

Because of this design, a staple job would know about all the methods of the print job, even though there was no use for them.

Solution

• To overcome this problem Robert C Martin suggested a solution which is called the Interface Segregation Principle.

• Which means, Instead of one fat interface many small interfaces are preferred based on groups of methods with each one serving one submodule.

For the example used in the demo, please refer to the link below

Text version of the video

Slides

SOLID Design Principles Tutorial

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

Enjoyed this video?
"No Thanks. Please Close This Box!"