Extensibility

Parameter Object
Intent The syntax of Java language doesn’t allow you to declare a method with a predefined value for a parameter. Probably the best option to achieve default method parameters in Java is by using the method overloading. Method overloading allows you to declare several methods with the same name but with a different number of parameters. But the main problem with method overloading as a solution for default parameter values reveals itself when a method accepts multiple parameters.
Special Case
Intent Define some special cases, and encapsulates them into subclasses that provide different special behaviors. Explanation Real world example In an e-commerce system, presentation layer expects application layer to produce certain view model. We have a successful scenario, in which receipt view model contains actual data from the purchase, and a couple of failure scenarios. In plain words Special Case pattern allows returning non-null real objects that perform special behaviors.
Type-Object
Intent As explained in the book Game Programming Patterns by Robert Nystrom, type object pattern helps in Allowing flexible creation of new “classes” by creating a single class, each instance of which represents a different type of object Explanation Say, we are working on a game which has a hero and many monsters which are going to attack the hero. These monsters have certain attributes like attack, points etc. and come in different ‘breeds’ like zombie or ogres.
Decorator
Also known as Wrapper Intent Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. Explanation Real-world example There is an angry troll living in the nearby hills. Usually, it goes bare-handed but sometimes it has a weapon. To arm the troll it’s not necessary to create a new troll but to decorate it dynamically with a suitable weapon. In plain words Decorator pattern lets you dynamically change the behavior of an object at run time by wrapping them in an object of a decorator class.
Role Object
Also known as Post pattern, Extension Object pattern Intent Adapt an object to different client’s needs through transparently attached role objects, each one representing a role the object has to play in that client’s context. The object manages its role set dynamically. By representing roles as individual objects, different contexts are kept separate and system configuration is simplified. Class diagram Applicability Use the Role Object pattern, if: You want to handle a key abstraction in different contexts and you do not want to put the resulting context specific interfaces into the same class interface.
Strangler
Intent Incrementally migrate a legacy system by gradually replacing specific pieces of functionality with new applications and services. As features from the legacy system are replaced, the new system eventually covers all the old system’s features and may has its own new features, then strangling the old system and allowing you to decommission it. Class diagram Applicability This strangler pattern is a safe way to phase one thing out for something better, cheaper, or more expandable.
Twin
Intent Twin pattern is a design pattern which provides a standard solution to simulate multiple inheritance in java Explanation Real-world example Consider a game with a ball that needs features of two types, Game Item, and threads to function smoothly in the game. We can use two objects, with one object compatible with the first type and the other compatible with the second type. The pair of objects together can function as one ball in the game.
Abstract Document
Intent Use dynamic properties and achieve flexibility of untyped languages while keeping type-safety. Explanation The Abstract Document pattern enables handling additional, non-static properties. This pattern uses concept of traits to enable type safety and separate properties of different classes into set of interfaces. Real world example Consider a car that consists of multiple parts. However we don’t know if the specific car really has all the parts, or just some of them.