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

This reminds me of the policy of some of my CS professors:

If it's longer than 2 lines, it belongs in a function.

(Really guys?)

I can appreciate a few layers of indirection as being useful for maintenance later on - handling new corner cases by giving you some opportunities for making the most minimal possible change.

There's a diminishing return after a few layers, and then of course you start to make maintenance itself harder by making it harder to understand and navigate.



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

Search: