Can you explain me about this Extension Object Pattern and how it differ from the Adapter Pattern?
There seems to be only few resources in web that explains the Extension Object Pattern and most of them are bit confusing (at least for me).
Thanks in advance.
Main difference is: Decorator is used to decorate individual objects at run-time. Adapter is used to add features to the class and therefore to ALL of its objects. It's true that Adapter targets the class and therefore to ALL of its objects.
The main difference: Class Adapter uses inheritance and can only wrap a class. It cannot wrap an interface since by definition it must derive from some base class. Object Adapter uses composition and can wrap classes or interfaces, or both.
An extension fracture pattern is a kind of spinal fracture that happens when the small bones in your spine, called your vertebrae, separate from each other because they were extended too far.
Adapter pattern is used after the application components are designed so that we can use them without modifying the source code. This is in contrast to the Bridge pattern, which is used before the components are designed.
The main difference is in the time of usage:
You would use an Adapter during development of your software, in cases you cannot change the existing interface you introduce an Adapter.
The extension object pattern provides for such changes and enables you to e.g. extend already deployed software.
Also, from the Text you posted:
Adapter supports to adapt an existing interface. The Extension Objects pattern supports additional interfaces. Extension Objects and Adapter can work together in situations where an object needs to be adapted to an extension interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With