cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian LeRoux...@brian.io>
Subject [Node 101] Part 1: Small Modules
Date Thu, 12 Dec 2013 23:06:02 GMT
Create modules that are the smallest possible unit of code. Less code is
fast code. Faster to write. Faster to maintain. Faster to test. On the
extreme end characters in the Node community such as Substack advocate a
single function per module definition.

module.exports = function() {
  // my logic here
}

This is kind of extreme and not always possible but a good practice
nonetheless. The idea is not new. Its a part of the UNIX philosophy: "do
one thing well" coined by Doug Mcilroy. [1]

It can help you make code that looks like this [2] into this [3].



[1] http://homepage.cs.uri.edu/~thenry/resources/unix_art/ch01s06.html
[2]
https://github.com/apache/cordova-js/blob/c320378b484a172a02d3ee26634bcc584f43b939/Gruntfile.js
[3] https://github.com/apache/cordova-js/blob/master/Gruntfile.js

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message