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

What is Singleton Pattern ? Singleton pattern is used when we want to create only one instance of a class. A very simple example is say Logger, suppose we need to implement the logger and log it to some file according to date time. In this case, we cannot have more than one instances of […]

Enterprise Design Patterns in Java

This article provides an introduction to Enterprise Java design Patterns.   MVC Pattern Model represents application’s data and business logic. View is the visual representation of data in model. Controller links the view to the model and directs application flow.   In Java EE, model is located in business layer, usually in form of an EJB […]

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 […]