Stop Writing If-Else Trees: Use the State Pattern Instead
(medium.com)
The State design pattern is a behavioral software pattern that allows an object to alter its behavior when its internal state changes. In simpler terms, the State pattern lets an object behave differently based on its current state, without cluttering the code with endless if/else or switch statements.
The State design pattern is a behavioral software pattern that allows an object to alter its behavior when its internal state changes. In simpler terms, the State pattern lets an object behave differently based on its current state, without cluttering the code with endless if/else or switch statements.