Hacker News new | past | comments | ask | show | jobs | submit login

I have this for Big Ol' Switch Statements. It's actually easier to have all the cases inline and let the function get huge than it is to have the cases call subroutines (because you then have to go find the subroutine, and you can't compare two subroutines in situ easily).

Like any rule, there are exceptions. Mostly I agree with 80x24, but I wouldn't implement it in a linter, because I need to break it every now and again (and Big Ol' Switch Statements are a common cause of breakage).




It depends on the switch statement, but I often use this style for state machines which are particularly handy to see a lot of times.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: