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.
Lets implement the Proxy :
- Strategy Pattern: Decouple algorithms from the concrete class, so that, they can vary based on use-case. (Binary Search, ISorter)
Strategy Pattern in Java
Started learning Design Patterns, recently. People suggested the books, “Head First Design Pattern” and “Gang of Four…
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)
Factory Pattern in Java
As the name suggests, it is like Factory. Input is a id(raw material), output is a product(finished goods).
4. Abstract Factory Pattern: Instead of hard-coding a factory, create them dynamically based on the input. (LollipopDialogue, NougatDialogue)
Abstract Factory Pattern in Java
Well, if had read my previous article on Factory Design Pattern in Java, this would be much simpler. I felt that…
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)
Singleton Pattern in Java
This has the same purpose as static variable in java. Can be initialized only once!
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)
Adapter Pattern in Java
As the name suggests, adapting the current class to work with another class. This is what an adapter does.
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,
Proxy Pattern in Java
The word proxy reminds me of faking someone and marking there attendance in collage days 😅 . Unless there is a…
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)
Template Method Pattern in Java
A Template method pattern provides a skeleton for performing any sort of algorithm or an operation, and it allows the…
Observer Pattern in Java
“Life was always a matter of waiting for the right moment to act.” ~Anonymous.
Contents will be updated, when published. Enjoy learning !