Pro EP 62 : Interface Segregation Principle of SOLID

Muhammad Waseem
Become .NET Pro !
2 min readAug 21, 2023

What is Interface Segregation Principle from SOLID and how to implement it in C# ?

ISP is fourth and second last principle from SOLID principles. At some point ISP and SRP resemble.

ISP says :-
- Class should not be forced to depend on methods it doesn’t use
- Split a lengthy interface to small relevant interfaces

Benefits of ISP:-
- Modularity
- Reusability
- Maintainability
- Low coupled code
- Reduces the chances of defects
- Makes code easy to test and deploy independently

Example
Bad :- Single interface that is responsible card and bank payment processing even if someone would be interested in only one

Good :- Divide single interface to three different interfaces one to process payment and other two for bank and card

Whenever you’re ready, there are 4 ways I can help you

  1. Subscribe to my Weekly .NET Newsletter of C#/.NET with 7000+ Software Engineers.
  2. Promote yourself to 7000+ subscribers by Sponsoring my Newsletter
  3. Download my eBook at Gum Road which contains 30+ .NET Tips (With 2800+ Downloads)
  4. TTo get 100+ free and paid resources for learning C# and .NET visit this GitHub Repository

--

--