Singleton Design Pattern

Singleton Design Pattern
(Creational Design Pattern)

Singleton design pattern is the simplest design pattern we can found. It allows only to create only one instance at a time from the given class.

e.g. clipboard in windows and mobile devices

A singleton class,

  • Should be a private class
  • provides a global access point to the class (private static)


Class diagram

Facade Design Pattern

Facade Design Pattern
(Structural Design Pattern)

When it come to software development, following a design pattern is must if we need to develop a proper software application

Sometimes, earlier we used this structure of the facade design pattern while development without know the name of it.

It hides the complexity of the code by providing an easy interface to the user that can access the whole system. A single class provides all the methods required by the user from the system.

Implementation with Java

Lets assume a scenario where simple bank transaction process of withdraw money and deposit money.

Class diagram for bank transaction