Skip to content

Comment on Ask HN: Functions: how long is too long?

Comments

Too long is when you need more than once sentence to describe what a function does or when the function name gets too long.

That's a pretty good indicator because it shows that you could 'abstract' something out and make it an individual routine.

Err on the side of caution, better to have smaller functions than larger ones, unless you have a very good reason not to.

And if performance is your worry and you work in 'C' then inline is your friend.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.