Hacker News new | ask | show | jobs
by cadamsdotcom 418 days ago
This is a domain modeling question.

If your if-else branches and flags are creating a combinatorial explosion and/or allowing more states to exist than are valid, pay the complexity tax of introducing a State pattern - it will pay itself back in maintainability and lack of bugs over time.

But if you’re just talking about one or two standalone values, the state is already there, represented as simply as possible by your enums.