• stock market

    Factory Design Pattern in Java for Beginners

    The Factory Design Pattern is a creational design pattern used to create objects without exposing the object creation logic to the client. Instead of using the new keyword directly, the client relies on a factory method to get the required object. Factory Design pattern is used when we have a super class with multiple subclass and based on input , we return the one of the subclasses . Super class in factory pattern can be an interface , abstract class ,or a normal java class . Example : Computer.java Pc.java Server.java ComputerFactory.java TestFactoryMain.java

  • stock market

    SOLID Design Principles in Java – A Complete Guide with Examples

    SOLID is a set of five object-oriented design principles that help developers design clean, maintainable, scalable, and flexible software systems. These principles reduce tight coupling between classes, improve code readability, and make applications easier to extend and test. It is a set of 5 object-oriented design principles that help you write clean, maintainable, scalable, and testable Java code. Design patterns are often built on top of SOLID principles. 1.Single Responsibility Principle (SRP) there should never be more than one functionality for a class to change , single responsibility focused , single logic/functionality addresses a specific concern . Example: We have written a code in a single class that code is…