thrashtechinfo / solid-design-pattern-angular

Usage of Solid Design Pattern in Angular v18
4 stars 1 forks source link

Add code example for - L: Liskov Substitution Principle #3

Closed muhammadawaisshaikh closed 1 month ago

muhammadawaisshaikh commented 1 month ago
  1. With LSP: Subclasses like CreditCardPaymentService and PaypalPaymentService properly replace the PaymentService class without breaking the logic of the PaymentComponent. The system is easy to extend and maintain.
    1. Without LSP: Introducing a subclass like CryptoPaymentService that doesn’t properly adhere to the expected behavior of the base class results in runtime errors and requires additional error handling, making the code less maintainable and extensible.
thrashtechinfo commented 1 month ago

@muhammadawaisshaikh let's add this in terms of component level with and without - L: Liskov Substitution Principle

thrashtechinfo commented 1 month ago

done, thanks