Posts

Showing posts from January, 2022

SOLID Principles

Image
Overview SOLID stands for the following principles S - Single Responsibility Principle O - Open/Closed Principle L - Liskov Substitution Principle I - Interface Segregation Principle D - Dependency Injection Principle Single Responsibility Principle A class should serve only one purpose at a time. The class should take only one responsibility in a project or application. A class should have only one job. public class Order { private final int orderId ; private final double amount ; private final String productName ; private final String emailRecipient = "iamraajkanchan@gmail.com" ; public Order ( int orderId , double amount , String productName) { this . orderId = orderId ; this . amount = amount ; this . productName = productName ; } public void showDetails () { System. out .println( "Product Name: " + productName + " ,Amount: " + amount + " ,Order ID: " + orderId ) ; } pub