Design Patterns in Java

True that!

Not everything can be taught from books. So is design pattern!

The soul purpose of design patterns is to minimize duplication and improve maintainability. A lazy lad can find many applications in real life. Even, this page could be considered as an application of design pattern. Ya, may be the Singleton Pattern!

Instead of adding the entire series links on every article I wrote, I created a common page(decoupling from child classes), for consolidating the articles. I included this article link on every article related to Design Pattern.

In other words: rather than instantiating DesingPatternSeries class on every article, I provided a reference( getInstance() ) to this loosely coupled class, so that, I as an author, only need to update this page! 😵

Also note that, design patterns is kind of an approach. It is not mandatory to follow them as same as the UML diagram. You are free to make your own adaptions. It could be compared to Driving. When we are learning driving, we are taught to keep hand on the steering in 10:02 position. But when we are comfortable, we adapt the hand position on steering.

  1. Strategy Pattern: Decouple algorithms from the concrete class, so that, they can vary based on use-case. (Binary Search, ISorter)

2. Decorator Pattern: Instead of creating classes for every permutation, create standard classes, and use there combinations at run-time.(MovableX, MovableY, MovableZ)

3. Factory Method Pattern: Instead of hard-coding object creation, create them dynamically based on the input. (PNGImage, JPEGImage)

4. Abstract Factory Pattern: Instead of hard-coding a factory, create them dynamically based on the input. (LollipopDialogue, NougatDialogue)

5. Singleton Pattern: Making object creation a one time process, so that, you can reuse it where-ever needed. This creates a Single Point of Information. (React-Redux Store)

6. Command Pattern: When you want undo/redo, customize button actions etc. Decoupling Commands from Concretions. (Medium editor / ASWD Buttons)

7. Adapter Pattern: Adapting variant classes to standard classes. (IBM_XRay/Cisco_XRay)

8. Facade Pattern: Black boxing the complex part. (ANN libraries, Rotating Cube, Retrofit)

9. Proxy Pattern: Used as an alternative to the real one.(Firebase,
Intra/e-netProxy)

10. Composite Pattern: When hierarchy matters. (File/Folder)

11. Template Pattern: Skeleton is fixed. Sub-classes can re-define the implementation for some parts. (doGet()/doPost() — HTTPServlet)

12. Observer Pattern: Subject notifies the observers, when there is a change. ( JavaScript event emitter )

Contents will be updated, when published. Enjoy learning !

Writes on Big Data, AWS & Backend technologies.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store