Sindre Sorhus blog.sindresorhus.com

Small focused modules

This was from an AMA, but Sindre turned it into a blog post since his response was so popular. Also, his answer applies particularly to Node.js. Sindre writes on his blog:

Make small focused modules for reusability and to make it possible to build larger more advanced things that are easier to reason about.

And, also…

It doesn’t matter if the module is one line or hundreds. It’s all about containing complexity. Think of node modules as Lego blocks. You don’t necessarily care about the details of how it’s made. All you need to know is how to use the Lego blocks to build your Lego castle. By making small focused modules you can easily build large complex systems without having to know every single detail of how everything works.


No comments

Sign in or join to comment

0:00 / 0:00