https://github.com/iluwatar/java-design-patterns-web/issues/8 Update pattern categories and tags
This commit is contained in:
@ -5,9 +5,8 @@ folder: prototype
|
||||
permalink: /patterns/prototype/
|
||||
categories: Creational
|
||||
tags:
|
||||
- Java
|
||||
- Gang Of Four
|
||||
- Difficulty-Beginner
|
||||
- Instantiation
|
||||
---
|
||||
|
||||
## Intent
|
||||
@ -68,10 +67,10 @@ System.out.println(cloned.getName()); // Dolly
|
||||
## Applicability
|
||||
Use the Prototype pattern when a system should be independent of how its products are created, composed and represented; and
|
||||
|
||||
* when the classes to instantiate are specified at run-time, for example, by dynamic loading
|
||||
* to avoid building a class hierarchy of factories that parallels the class hierarchy of products
|
||||
* when instances of a class can have one of only a few different combinations of state. It may be more convenient to install a corresponding number of prototypes and clone them rather than instantiating the class manually, each time with the appropriate state
|
||||
* when object creation is expensive compared to cloning
|
||||
* When the classes to instantiate are specified at run-time, for example, by dynamic loading
|
||||
* To avoid building a class hierarchy of factories that parallels the class hierarchy of products
|
||||
* When instances of a class can have one of only a few different combinations of state. It may be more convenient to install a corresponding number of prototypes and clone them rather than instantiating the class manually, each time with the appropriate state
|
||||
* When object creation is expensive compared to cloning
|
||||
|
||||
## Real world examples
|
||||
|
||||
|
Reference in New Issue
Block a user