Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The reason to make them unrepresentable so you will be able to catch the case when the input was illegal.

Otherwise you may never notice that illegal state was there in the first place.

I encountered many systems that would take invalid inputs and produce invalid (but sometimes even valid) results [1].

Illegal internal states are even harder to catch. When using FSM / StateCharts I usually automatically print error to log (and crash) for all illegal state/event combinations in the State Transition Table, instead of silently ignoring them.

[1] GIGO - Garbage In Garbage Out

https://en.wikipedia.org/wiki/Garbage_in,_garbage_out



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: