mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-03 11:12:23 +00:00
https://github.com/iluwatar/java-design-patterns-web/issues/8 Update pattern categories and tags
This commit is contained in:
1 parent
0335c61512
commit
b2b1ba95eb
127 files changed
+282
-450
No files matched your search
+2
-4
@@ -5,8 +5,6 @@ folder: state
|
||||
permalink: /patterns/state/
|
||||
categories: Behavioral
|
||||
tags:
|
||||
- Java
|
||||
- Difficulty-Intermediate
|
||||
- Gang Of Four
|
||||
---
|
||||
|
||||
@@ -23,8 +21,8 @@ changes. The object will appear to change its class.
|
||||
## Applicability
|
||||
Use the State pattern in either of the following cases
|
||||
|
||||
* an object's behavior depends on its state, and it must change its behavior at run-time depending on that state
|
||||
* operations have large, multipart conditional statements that depend on the object's state. This state is usually represented by one or more enumerated constants. Often, several operations will contain this same conditional structure. The State pattern puts each branch of the conditional in a separate class. This lets you treat the object's state as an object in its own right that can vary independently from other objects.
|
||||
* An object's behavior depends on its state, and it must change its behavior at run-time depending on that state
|
||||
* Operations have large, multipart conditional statements that depend on the object's state. This state is usually represented by one or more enumerated constants. Often, several operations will contain this same conditional structure. The State pattern puts each branch of the conditional in a separate class. This lets you treat the object's state as an object in its own right that can vary independently from other objects.
|
||||
|
||||
## Real world examples
|
||||
|
||||
|
||||
Reference in new issue
Block a user