Design Patterns Tutorial

The design patterns are the best practices to develop software applications effectively. Design patterns are not specific to one language/technology or framework, it can be implemented anywhere. But for large-scale, complex, and high-end applications mainly Java language is used and Java programmers encounter many problems compared to other language developers. The problem may be a memory/performance or integration issue and therefore we can see more utilization of design patterns in the Java language.


  • Singleton Design Pattern in Java
    Singleton Design Pattern | The Singleton pattern is one of the simplest design patterns in Java. This pattern involves a single class that is responsible for creating an object while making sure that only a single object gets created in one JVM. This class provides a way to access its only object which can be accessed directly without the need to instantiate the object of the class.  Singleton class is a… Read more: Singleton Design Pattern in Java
  • Strategy Design Pattern in Java
    Strategy Design Pattern in Java | In project development, we develop multiple classes having a dependency. The class that takes the service/support of other classes is called the target class and the class that acts as helper class is called the dependent class. Strategy design pattern allows to development of usable, flexible, extensible, easily maintainable software applications as a loosely coupled collection of interchangeable parts.  Strategy design pattern says “Develop… Read more: Strategy Design Pattern in Java
  • Flyweight Design Pattern
    Flyweight Design Pattern | Flyweight means removing or reducing or decreasing the weight. This design pattern says to use JVM memory of RAM effectively while creating a huge number of objects so that less memory can be used to maintain more objects.  According to GOF, the Flyweight design pattern intent is “Use sharing to support large numbers of fine-grained objects efficiently.”  The flyweight design pattern is a structural design pattern… Read more: Flyweight Design Pattern
  • Adapter Design Pattern in Java
    Adapter Design Pattern in Java | The Adapter design pattern is one of the structural design patterns and it is used so that two unrelated interfaces can work together. The object that joins these unrelated interfaces is called an Adapter. Need of Adapter Design Pattern? Let us understand it through an example. The projects/services that are external to all the projects and whose services can be used in multiple projects… Read more: Adapter Design Pattern in Java
  • Decorator Design Pattern in Java
    Decorator Design Pattern in Java | Decorator Design Pattern is a structural pattern that allows us to add new functionalities or responsibilities to existing objects without affecting the behavior of other existing objects. It means we can add dynamic functionalities or responsibilities to the existing object as the wrapper around the existing object, so it is called decorator or wrapper design pattern. It is one of the popularly used structural… Read more: Decorator Design Pattern in Java
  • Builder Design Pattern in Java
    Builder Design Pattern | Here we will discuss what is the builder design pattern in Java? When to use builder design pattern? We will also see the simple example of the builder design pattern in Java. What are the advantages and disadvantages of the builder design pattern? The Builder design pattern is a creational design pattern used to assemble complex objects. It says to create complex objects step by step… Read more: Builder Design Pattern in Java
  • Template Method Design Pattern
    Template Method Design Pattern | The template design pattern defines the skeleton of an algorithm in the superclass to complete a task or job leaving some operations to implement for the subclasses.  Ultimately superclass defines the algorithm but it doesn’t implement every operation. The operations which are not common will be defined by subclass only.  If we see the dictionary meaning of template then it represents a format, used as… Read more: Template Method Design Pattern
  • Factory vs Factory Method vs Abstract Factory Design Pattern
    We have three design patterns containing the “factory” word, they are:- Factory Pattern or Simple factory design pattern, Factory method design pattern, Abstract factory design pattern. In their own respective post, we have already discussed this in detail. Now let us see a short comparison between factory pattern vs factory method pattern vs abstract factory pattern. Factory Design Pattern:- It provides an abstraction on creating one of the several related… Read more: Factory vs Factory Method vs Abstract Factory Design Pattern
  • Abstract Factory Design Pattern
    Abstract Factory Design Pattern is also called a Super factory or factory of factories. The abstract factory pattern is one level of abstraction higher than the Simple Factory Pattern. We can use this pattern to return one of the several related classes of objects, each of which can return several different objects on request. In another word, an Abstract factory is a factory object that returns one of several groups… Read more: Abstract Factory Design Pattern
  • Factory Method Design Pattern
    Factory Method Design Pattern | The factory method design pattern provides the set of rules and guidelines for multiple factories when they are creating objects for the same family classes. The classes that belong to the same inheritance hierarchy either having a common superclass or common implementation interface can be called as same family classes. Note:- The Java factory method is different from the factory method design pattern. In Java,… Read more: Factory Method Design Pattern
  • Factory Pattern in Java
    In this tutorial, we will discuss the following points:- What is the factory pattern? What are the problems and why do we need to use the Factory pattern? How factory pattern in Java solves those problems. What are real-time examples of factory design patterns in Java?  There are four different terms that contain “Factory” words:- Static Factory Method:- Any method which creates and returns an object is called a factory… Read more: Factory Pattern in Java
  • Types of Design Patterns
    Previously, we discussed what is design patterns, GoF, and J2EE patterns. See here:- Design Patterns. Now, let us see the different types of design patterns used in Java. There are many pattern catalogs are available but mainly two of them are very popular. GoF Design Patterns:- The GoF design patterns deal with the reoccurring problems of OOP. J2EE Design Patterns:- It gives problem and solution related to JEE (Java Platform… Read more: Types of Design Patterns
  • Design Patterns in Java
    What are design patterns? What are the design patterns in Java with examples? What are the software design patterns? Why we should learn design patterns? What are the gang of four (GoF) and J2EE design patterns in Java? What is the prerequisite to learn the design pattern? When we use regular language / technology / framework in a regular manner in product or application development then there may be a… Read more: Design Patterns in Java

Subscribe

Subscribe to our newsletter and follow on Facebook, Instagram, Twitter to receive the latest tutorial and programs to improve your programming skills.