The “Rule of 10” for functions, components and modules

Here’s my “Rule of 10” for functions, components and modules:

  • If a function has >10 lines of code, break out into multiple functions.
  • If a component has >10 functions, break out into multiple components.
  • If a module has >10 components, break out into multiple modules.

Update 1: I break these rules on a daily basis…

Update 2: Something I noticed recently, is that when I break up my code in micro functions, it’s much easier to spot repetitive and redundant code. I aim for tiny functions calling other tiny functions.

I build tools for creativity 🧩. CEO of @Weld_io , a #nocode tool for marketers. Father of two. Feminist. Fan of espresso and movies. Still learning.

I build tools for creativity 🧩. CEO of @Weld_io , a #nocode tool for marketers. Father of two. Feminist. Fan of espresso and movies. Still learning.