2015-12-26 22:29:45 +00:00
|
|
|
---
|
2015-12-28 18:16:58 +00:00
|
|
|
layout: pattern
|
|
|
|
title: Delegation
|
|
|
|
folder: delegation
|
|
|
|
permalink: /patterns/delegation/
|
|
|
|
categories: Behavioral
|
|
|
|
tags:
|
|
|
|
- Java
|
|
|
|
- Difficulty-Beginner
|
|
|
|
---
|
|
|
|
|
2015-12-30 18:26:32 +00:00
|
|
|
**Also known as:** Proxy Pattern
|
2015-12-26 22:29:45 +00:00
|
|
|
|
2015-12-28 18:16:58 +00:00
|
|
|
**Intent:** It is a technique where an object expresses certain behavior to the outside but in
|
|
|
|
reality delegates responsibility for implementing that behaviour to an associated object.
|
2015-12-26 22:29:45 +00:00
|
|
|
|
2015-12-28 18:16:58 +00:00
|
|
|

|
2015-12-26 22:29:45 +00:00
|
|
|
|
2015-12-28 18:16:58 +00:00
|
|
|
**Applicability:** Use the Delegate pattern in order to achieve the following
|
2015-12-26 22:29:45 +00:00
|
|
|
|
2015-12-28 18:16:58 +00:00
|
|
|
* Reduce the coupling of methods to their class
|
|
|
|
* Components that behave identically, but realize that this situation can change in the future.
|
2015-12-26 22:29:45 +00:00
|
|
|
|
2015-12-28 18:16:58 +00:00
|
|
|
**Credits**
|
2015-12-26 22:29:45 +00:00
|
|
|
|
2015-12-30 18:26:32 +00:00
|
|
|
* [Delegate Pattern: Wikipedia ](https://en.wikipedia.org/wiki/Delegation_pattern)
|
|
|
|
* [Proxy Pattern: Wikipedia ](https://en.wikipedia.org/wiki/Proxy_pattern)
|