Loading...

Java Design Patterns – Example Tutorial

Java Design Patterns – Example Tutorial

Faisal / Java

Design Patters are a set of industry standard approach to a software problem. They are very popular among software developers.

Important uses and benefits of using design patterns are:

  1. Design Patterns make code re-usable and editable easily, since they are already defined ways to follow code writing and hence any new member can easily know what process the code is following easily.
  2. If used sensibly, it can lead to saving a lot of time as it provides a standard approach to solving a common problem.
  3. It also leads to creation of robust and highly maintainable code from all aspects.

java-design-patterns

Java Design Patterns are basically divided into three main categories . Creational, Structural and Behavioral design patterns. They are defined with examples below one by one.

Creational Design Patterns

Creational Design Patterns help to give solution to instantiate an object in the most possible best way in specific situations.

1. Singleton Pattern

A design pattern in which only one instance of class exists in the java virtual machine is defined as a Singleton Pattern. It restricts instantiation of the class hence making it appear only once at a time. Singleton Pattern does come with a lot of implementation concerns as there are many different approaches in its implementation. Checkout Java Singleton Pattern for examples.

Leave a Comment