← Back to context

Comment by kbart

11 years ago

Libraries/modules should help to solve complex problems where writing your own version is not optimal. Single line functions as modules, on the other hand, won't help you compete with Google or Microsoft and result in more problems than they solve. If a simple padding or "is this int positive?" is a complex problem, well, there are different professions than programmer's..

The less code you write, the less code you have to maintain. Even if it's just one less thing, it's a win.

The comonJS module pattern also helps tremendously, as your requires are block/function scoped. It makes it trivial to refactor (remove/rewrite) code.

  • In a perfect world yes, but in the real world, with unreliable dependencies and their imperfect management, it doesn't come for free.