Hacker News .hnnew | past | comments | ask | show | jobs | submitlogin

I find the original example to be much clearer. If you want to know about all the valid transitions from the 'held' state, search for all usages of 'held'. Adding complicated dispatching doesn't help readability.

This seems a lot like the expression problem [1]. There are no perfect solutions. A problem can be split along multiple dimensions, but not all at once, or at least not as code saved in a text file.

Whether you split the problem first by method or by state, you will have code that's located far away from closely related code.

[1] https://en.wikipedia.org/wiki/Expression_problem



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

Search: