Implementation of solid principles and most useful design patterns
- Single Resp Principle Example
- Example:- Taxcalculator.new(employee) => We move out logic of tax calc from employee
- Open closed Principle
- Example:- VehicleInsurance, HealthInsurance, HomeInsurance
- Liskov Substitution Principle
- Example:- Ostrich Bird, Fly Interface
- Interface Segregation Principle
- Example:- Print Copy Scan - Have smaller interfaces or small independent modules
- Dependency Inversion/Dependency Injection
- Example:- Inject a low level dependency into class. ProductCatalog Class injecting ProductRepo class
- Payment example:- Stripe Payment, CreditCard Payment
- Have a common interface - order.pay(StripePayment.new)
- Abstractions should not depend upon details