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

I disagree. It's not the purity of the functions, its having to know the details of them. The details, which could have existed here, are now in two other places. If you need to figure out how a value is calculated, and you use a half dozen functions to come to that value, you now have a half dozen places you need to jump to within the codebase.

Small functions increase the chances of you having to do this. Larger ones decrease it, but can cause other issues.

Also, many small functions doesn't make code modular. Having well defined, focused interfaces (I don't mean in the OO sense) for people to use makes it modular. Small functions don't necessarily harm it, but if you're not really good at organizing things they definitely can obscure it.



I find how easy it is to name something is a pretty good indicator. If I'm struggling to name a function then it probably needs some more attention.




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

Search: