Sunday, 7 June 2015

Do not represent an object's life cycle using enums

Avoid 'summarising' the state of an object using enums.

While it is often convenient to idealise an object's life cycle as a linear sequence of states, such representations are inherently inaccurate and fragile; over time they become a source of bugs.

No comments:

Post a Comment