3 ms·
https://gist.github.com/aamedina/8115304 https://gist.github.com/aamedina/8115304 First version here: Uses only a case statement to dispatch the proper behavio
by adrianm 13y ago
https://gist.github.com/aamedina/8115304 https://gist.github.com/aamedina/8115304
First version here: Uses only a case statement to dispatch the proper behavior, but as a pure function.
When she begins to take the state of the map and all of the other variables into account, this case statement will prove confusing to wade through - because it's one function that is doing four related but separate tasks. So version two is what you'd likely end up doing after the code got too unwieldy.
Oh wait... that's what a multimethod is! Now you've gone full circle. I hope you can see the point I was trying to make more generally, beyond the limited example I gave here.