mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 10:58:42 +00:00
docs: add diagrams for event aggregator, event-based asynchronous, event queue, execute around, extension objects
This commit is contained in:
@@ -33,6 +33,10 @@ Wikipedia says
|
||||
|
||||
> In object-oriented computer programming, an extension objects pattern is a design pattern added to an object after the original object was compiled. The modified object is often a class, a prototype or a type. Extension object patterns are features of some object-oriented programming languages. There is no syntactic difference between calling an extension method and calling a method declared in the type definition.
|
||||
|
||||
Sequence diagram
|
||||
|
||||

|
||||
|
||||
## Programmatic Example of Extension Objects Pattern in Java
|
||||
|
||||
The Extension Objects pattern allows for the flexible extension of an object's behavior without modifying its structure, by attaching additional objects that can dynamically add new functionality.
|
||||
@@ -143,10 +147,6 @@ This produces the following console output.
|
||||
|
||||
This example demonstrates how the Extension Objects pattern allows for the flexible extension of an object's behavior without modifying its structure.
|
||||
|
||||
## Detailed Explanation of Extension Objects Pattern with Real-World Examples
|
||||
|
||||

|
||||
|
||||
## When to Use the Extension Objects Pattern in Java
|
||||
|
||||
This pattern is applicable in scenarios where an object's functionality needs to be extended at runtime, avoiding the complications of subclassing. It's particularly useful in systems where object capabilities need to be augmented post-deployment, or where the capabilities might vary significantly across instances.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Reference in New Issue
Block a user