Better functions

1412208000

Aim for short, dense functions. Say a lot with few lines.

You want your functions to be expressive. Choose carefully the names to describe the module you’re designing. Taking the time to do so will even help you restructure your code in a way that can improve your understanding of the problem at hand.

Strive to write functions that pass few arguments. It’s hard to follow (and test) functions that receive four or more arguments.

Many “rules” like this have been written on the subject, although there’s little or no scientific proof that all of them work, any experienced developer will attest to their benefits. I encourage you to dig deeper and choose the ones that work best for you.

Further reading