Vlad's Roam Garden

Powered by 🌱Roam Garden

functions should be small

I believe the easiest way to understand why this is important is by considering functions that don't follow this rule.

Large functions are confusing, as they force you to be aware of a lot of things (violating )

You'd often straggle to give them a clear name. Function defines a concept in a . If your function is too large and it's doing too many things - you can't give it a name that would sharply define the concept. Making your language less expressive.

[[functions should do ]]

From the this harmonizes with the idea of executing the on the code you're reading. As it moves code in a direction that would minimize the amount of we are required to perform at any given node.