thrashtechinfo / solid-design-pattern-angular

Usage of Solid Design Pattern in Angular v18
2 stars 0 forks source link

Add code example for - I: Interface Segregation Principle #4

Open muhammadawaisshaikh opened 2 hours ago

muhammadawaisshaikh commented 2 hours ago
  1. Without: Imagine you're building an e-commerce application and have an interface for different types of payments. If you have a PaymentProcessor interface with a bunch of methods, but not all payment methods require all those methods, you violate the ISP.
    1. With: you should split the PaymentProcessor interface into smaller, more specific interfaces. This way, each class only implements the methods it actually needs.
thrashtechinfo commented 2 hours ago

@muhammadawaisshaikh let's add this in terms of component level with and without - I: Interface Segregation Principle