State pattern
![State in UML[1][3]](/uploads/202502/13/State_Design_Pattern_UML_Class_Diagram.svg0343.png)
![State in LePUS3[3][4]](/uploads/202502/13/State_pattern_in_LePUS30343.gif)
The state pattern, which closely resembles Strategy Pattern, is a behavioral software design pattern, also known as the objects for states pattern. This pattern is used in computer programming to encapsulate varying behavior for the same object based on its internal state. This can be a cleaner way for an object to change its behavior at runtime without resorting to large monolithic conditional statements and thus improve maintainability.