Open Closed Principle

Open Closed Principle

In this article, we will discuss about Open Closed Principle and how to implement it in Java.   What is Open Closed Principle ?(OCP)   In object-oriented programming, the open/closed principle states “software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification”; i.e, such an entity can allow its behaviour […]

Single Responsibility Principle

Single Responsibility Principle

In this article, we will discuss about Single Responsibility Principle and how to implement it in Java   What is Single Responsibility Principle(SRP)?   The single responsibility principle states that every module or class should have responsibility over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated […]

Singleton Design Pattern Interview Questions

Introduction to Singleton design pattern Singleton Design Pattern is used in object-oriented programming to ensure that a class can have only one instance, while providing a global point of access to this instance. A very simple example is Logging class. suppose we need to implement the logging class (say Logger) and log it to some […]

Enterprise Design Patterns in Java

Enterprise design patterns are a set of best practices and reusable solutions for common problems that arise when developing large-scale applications in Java. These patterns help to improve the performance, scalability, and maintainability of code, making it easier for developers to build and manage complex software systems. Some common enterprise design patterns in Java include: […]

Java Design Pattern Interview questions

  1 – If two different classloaders load a singleton class, would they load it twice ? Two objects loaded by different class loaders are never equal even if they carry the same values. So, each class loader will have its own singleton.   2 – What is Decorator design pattern ?   The decorator […]