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

Honestly what would you do if you need to switch hundreds of distinct cases? Hundreds of classes implementing an interface?


I don't have time to go insane today, so I have tried not to look at the code directly. But, "hundreds of distinct cases" would cause me to reach for a data-directed method using a lookup table or other decision-tree data structure.


The way I'm reading this code is that the cases aren't that distinct. Look at lines 4367 to 4390 and you see 23 distinct cases that could be handled by a range and Mod 3.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: