Skip to content

Commit 6857486

Browse files
iluwatar#541 Create README.md file
1 parent 08c4202 commit 6857486

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

extension-objects/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
layout: pattern
3+
title: Extension objects
4+
folder: extension-objects
5+
permalink: /patterns/extension-objects/
6+
categories: Behavioral
7+
tags:
8+
- Java
9+
- Difficulty-Intermediate
10+
---
11+
12+
## Intent
13+
Anticipate that an object’s interface needs to be extended in the future. Additional
14+
interfaces are defined by extension objects.
15+
16+
![alt text](./etc/extension_obj1.png "Extension objects")
17+
18+
## Applicability
19+
Use the Extension Objects pattern when:
20+
21+
* you need to support the addition of new or unforeseen interfaces to existing classes and you don't want to impact clients that don't need this new interface. Extension Objects lets you keep related operations together by defining them in a separate class
22+
* a class representing a key abstraction plays different roles for different clients. The number of roles the class can play should be open-ended. There is a need to preserve the key abstraction itself. For example, a customer object is still a customer object even if different subsystems view it differently.
23+
* a class should be extensible with new behavior without subclassing from it.
24+
25+
## Real world examples
26+
27+
* [OpenDoc](https://en.wikipedia.org/wiki/OpenDoc)
28+
* [Object Linking and Embedding](https://en.wikipedia.org/wiki/Object_Linking_and_Embedding)

0 commit comments

Comments
 (0)