Thursday, October 22, 2020

Design pattern discussion

 Design pattern

Design pattern represents a industrial best practice that is used by experienced developer. Design pattern concept is needed to develop a framework or understand the framework coding.

Type:

  1. Creational Patterns: Discuss about a object create by hiding object creation logic.  
  2. Structural Patterns: Structural patterns are concerned with how classes and objects are composed to form larger structures.
  3. Behavioral Patterns: These design patterns are specifically concerned with communication between objects.

Design Pattern - Factory Pattern  (EASY)

Design Pattern - Abstract Factory Pattern (EASY)

Design Pattern - Singleton Pattern

Singleton pattern is one of the simplest design patterns in Java. This type of design pattern comes under creational pattern as this pattern provides one of the best ways to create an object.

This pattern involves a single class which is responsible to create an object while making sure that only single object gets created. This class provides a way to access its only object which can be accessed directly without need to instantiate the object of the class.


Implementation Example: Database connection. Connection will be created only one time.


REf: https://www.tutorialspoint.com/design_pattern/singleton_pattern.htm

Design Patterns - Builder Pattern


No comments:

Post a Comment

Autoboxing and Unboxing

  Autoboxing  is the automatic conversion that the Java compiler makes between the primitive types and their corresponding object wrapper cl...