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

Short functions is a pretty universal and good heuristic.

Breaking things down in smaller easier to understand pieces if you can applies to any language probably. 7 lines is just a heuristic.




It really isn't. As another user said below, following long function call chains is counter-productive and if you don't have an ultra strict function naming policy you will have functions with duplicate functionalities very quickly.


> following long function call chains is counter-productive

Well, be productive then!

It is a heuristic. I don't think I am in the minority saying that "breaking things down in small manageable chunks is a good thing". That's is not just Erlang that's common sense. That's the point. That doesn't mean having to count lines if you go over 7 start making functions like next1 next2 and so on. That's called being pedantic.


No being pedantic is giving a fixed number. Just say: "try to keep functions small" and be done with it without needing to debate semantics.




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

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

Search: