Skip to content

Commit 36357ff

Browse files
committed
more readme tips revising
1 parent 17c04a3 commit 36357ff

File tree

1 file changed

+103
-75
lines changed

1 file changed

+103
-75
lines changed

readme_tips.md

Lines changed: 103 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
# the art of readme
1+
# Art of README
22

3-
## what's a readme?
3+
## What is a "README" anyway?
44

5-
TODO: read up on the etymology of readme and relate it to the content
5+
The nomenclature of "README" dates back to *at least* the 1970s [and the
6+
PDP-10](http://pdp-10.trailing-edge.com/decuslib10-04/01/43,50322/read.me.html),
7+
though it may even extend back to the days of notes placed atop stacks of
8+
punchcards. The use of all-caps in the name is also functional: UNIX systems
9+
would sort capitals before lower case letters, conveniently putting the README
10+
before the rest of the directory's content[1](1).
611

7-
8-
## who
12+
The intent of the file is clear: information for the user to read before
13+
proceeding any further into the bowels of the system.
914

1015
This article is written for module creators, because as a builder of modules,
1116
your job is to create something that will last.
@@ -25,10 +30,10 @@ Looking at the subject of the README from both angles gives a healthy
2530
perspective on the subject from both sides.
2631

2732

28-
## what's the problem? (a massive pile of good and bad things)
33+
## A massive pile of *things*: some good, some bad
2934

3035
The node ecosystem is powered by its modules. Each module is a superpower. If
31-
node was a train, it's npm taht arranges them into a string of boxcars, and puts
36+
node was a train, it's npm that arranges them into a string of boxcars, and puts
3237
a driving locomotive behind all of it.
3338

3439
This train of superpowers runs on schedule at [npm](https://npmjs.org). In the
@@ -47,7 +52,7 @@ modules have no documentation -- no README even. Some modules don't have tests.
4752
Some modules don't even have a maintainer. And without a human readily on hand
4853
to answer questions and explain what a module does, and no remnants of
4954
documentation left behind, a module becomes a bizarre alien artifact, unusable
50-
and incomprehensible by the archeologist-developers of tomorrow.
55+
and incomprehensible by the archaeologist-developers of tomorrow.
5156

5257
Some modules do have documentation, but once again, the quality bar varies.
5358
Maybe it's just a one-liner description. Maybe it's just an example. All of
@@ -58,9 +63,9 @@ about keeping the users out of the source code and providing instructions
5863
sufficient to enjoy the abstraction that your module brings.
5964

6065
Node has a "wide" ecosystem: it's largely made up of a very long list of
61-
independent modules under no flag but its own. There are [exceptions](lodash),
62-
but despite these fiefdoms, the do-one-thing-well commoners, in their numbers,
63-
rule the node kingdom.
66+
independent modules under no flag but its own. There are
67+
[exceptions](https://github.com/lodash/lodash), but despite these fiefdoms, the
68+
do-one-thing-well commoners, in their numbers, rule the node kingdom.
6469

6570
This has a natural consequence: it can be hard to find *quality* modules that do
6671
what you want.
@@ -70,17 +75,17 @@ discoverability problem is infinitely better than a culture problem, where only
7075
the privileged few may participate.
7176

7277

73-
## a body of solutions
78+
## A Smorgasboard of Solutions
7479

7580
Node developers have responded to this in different ways.
7681

77-
[Curated lists](https://github.com/sindresorhus/awesome-node) have also
82+
[Curated lists](https://github.com/sindresorhus/awesome-nodejs) have also
7883
appeared, by using the wisdom of experienced node developers to highlight
7984
quality modules amongst different categories.
8085

8186
How about the social graph? This idea spurred the creation of
8287
[node-modules.com](http://node-modules.com/), a npm search replacement that
83-
leverages your github social graph to find modules your friends like or have
88+
leverages your Github social graph to find modules your friends like or have
8489
made.
8590

8691
Many will gradually build up a personal heuristic for quickly identifying
@@ -89,36 +94,38 @@ hundreds of modules over weeks or months. Others have [written about
8994
this](http://substack.net/finding_modules) heuristic-building process, and the
9095
criteria that the brain starts to look for.
9196

92-
No matter your approach, you will still ultimately find yourself on npmjs.org or
93-
github.com or somewhere else, staring at a README. What then?
97+
No matter your approach, you will still ultimately find yourself on
98+
[npmjs.org](https://npmjs.org) or [github.com](https://github.com) or somewhere
99+
else, staring at a README. What then?
94100

95101

96-
## professional module spelunkying
102+
## Professional Module Spelunkying
97103

98-
### readme
104+
### The README: Your One-Stop Shop
99105

100106
A README is a module consumer's first (and maybe only) look into your creation.
101107
The consumer wants a module to fulfill their need, so you need to explain
102108
exactly what need your module fills, and how effectively it does so.
103109

104110
Your job is to
105111

106-
1. tell them what it is (/w or /wo context)
112+
1. tell them what it is (with or without context)
107113
2. tell them what it looks like in action
108114
3. tell them how they use it
109115
4. tell them any other relevant details
110116

111-
This is your job, again, because of the width of the ecosystem and its resultant
112-
varying quality bar. Your README is your external, public-facing measure of
113-
where your work lies on that quality spectrum.
117+
This is *your* job, again, because of the width of the ecosystem and its
118+
resultant varying quality bar. Your README is your external, public-facing
119+
measure of where your work lies on that quality spectrum.
114120

115121

116-
### no readme => abstraction broken
122+
### No README? No abstraction.
117123

118-
The strongest signal when looking at a module is its README.
124+
The strongest signal when looking at a module is the presence or absence of a
125+
README.
119126

120-
The lack of any readme is a powerful red flag, but even a lengthy readme is not
121-
indicative of there being high quality. The ideal readme is as short as it can
127+
The lack of any README is a powerful red flag, but even a lengthy README is not
128+
indicative of there being high quality. The ideal README is as short as it can
122129
be without being any shorter. Detailed documentation is good -- make a separate
123130
page for it -- but keep your README succinct.
124131

@@ -134,17 +141,17 @@ wisdom on this:
134141
> Remember: the documentation, not the code, defines what a module does.
135142
136143

137-
### key elements
144+
### Key README Elements
138145

139-
once a readme is located the hypothetical developer must scan it to discern if
140-
it matches the developer's needs. this becomes essentially a series of pattern
146+
Once a README is located the hypothetical developer must scan it to discern if
147+
it matches the developer's needs. This becomes essentially a series of pattern
141148
matching problems to solve, where each step takes me deeper into the module and
142149
its details:
143150

144151
1. *Name* -- ideally the module name is self-evident.
145-
[`sorted-array`](https://github.com/javascript/sorted-array) sounds
146-
promising if I'm looking for an array that maintains a sort order on itself.
147-
if the name sounds too vague or unrelated, I can move on.
152+
[`sorted-array`](https://github.com/javascript/sorted-array) sounds promising
153+
if one is looking for an array that maintains a sort order on itself. If the
154+
name sounds too vague or unrelated, one can move on.
148155

149156
2. *One liner* -- having a one-liner that describes the module is useful for
150157
getting an idea of what the module does in slightly greater detail.
@@ -153,20 +160,20 @@ its details:
153160
> An implementation of John von Neumann's sorted arrays in JavaScript.
154161
> Implements insertion sort and binary search for fast insertion and deletion.
155162
156-
a bit wordy, but the second sentence makes it very clear that it does what I
163+
The second sentence makes it very clear that it does what I
157164
want. Excellent! Now I need to gauge how well it'd fit into my code.
158165

159166
3. *Usage* -- rather than starting to delve into the API docs, it'd be great to
160167
see what the module looks like in action. I can quickly determine whether the
161168
example JS fits the desired style and problem. People have lots of opinions
162-
on things like promises/callbacks and ES6. if it does fit the bill, then I
163-
can proceed to greater detail. if it does, then I can proceed to greater
169+
on things like promises/callbacks and ES6. If it does fit the bill, then I
170+
can proceed to greater detail. If it does, then I can proceed to greater
164171
detail.
165172

166173
4. *API* -- the name, description, and usage of this module all sound appealing
167174
to me. I'm probably very likely to use this module at this point. I just need
168175
to scan the actual API to make sure it does exactly what I need and doesn't
169-
have any unexpected caveats. The API section oight to detail the module's
176+
have any unexpected caveats. The API section ought to detail the module's
170177
objects and functions, their signatures, return types, callbacks, and events
171178
in good detail. Types should be included where they aren't obvious. Caveats
172179
should be made clear.
@@ -181,11 +188,11 @@ want. Excellent! Now I need to gauge how well it'd fit into my code.
181188
6. *License* -- most modules put this at the very bottom, but this might
182189
actually be better to have higher up; you're likely to exclude a module VERY
183190
quickly if it has an incompatible license to your work. I generally stick to
184-
the MIT/BSD/X11/ISC flavours. if you have a non-permissive license, stick it
191+
the MIT/BSD/X11/ISC flavours. If you have a non-permissive license, stick it
185192
at the very top of the module to prevent any confusion
186193

187194

188-
## cognitive funneling, economy of scale
195+
## Cognitive Funneling
189196

190197
The ordering of the above was not chosen at random.
191198

@@ -197,11 +204,22 @@ benefits from predictable patterns.
197204
You also start to build out your own personal heuristic for what information you
198205
want, and what red flags disqualify modules quickly.
199206

200-
Thus, it follows that in a readme it is desirable to have:
207+
Thus, it follows that in a README it is desirable to have:
201208

202209
1. a predictable format
203210
2. certain key elements present
204211

212+
You don't need to use *this* format, but try to be consistent to save your users
213+
precious cognitive cycles.
214+
215+
The ordering presented here is lovingly referred to as "cognitive funneling",
216+
and can be imagined as a funnel held upright, where the widest end contains the
217+
broadest more pertinent details, and moving deeper down into the funnel presents
218+
more specific details that are pertinent for only a reader who is interested
219+
enough in your work to have reached that deeply in the document. Finally, the
220+
bottom can be reserved for details that only those intrigued by the deeper
221+
context of the work (background, credits, biblio, ...)
222+
205223
Once again, the Perl monks have wisdom to share on the subject:
206224
> The level of detail in Perl module documentation generally goes from
207225
> less detailed to more detailed. Your SYNOPSIS section should
@@ -218,39 +236,24 @@ Once again, the Perl monks have wisdom to share on the subject:
218236
> progressively greater amount of knowledge. -- from `perlmodstyle`
219237
220238

221-
222-
## enable short-circuiting, mindest, altruism
239+
## Care About People's Time
223240

224241
Awesome; the ordering of these key elements should be decided by how quickly
225-
they let someone 'short circuit' and bail on your module.
242+
they let someone 'short circuit' and bail on your module.
226243

227-
But this sounds bleak, doesn't it? Your job, when you're doing it optimally
228-
altruisticly, isn't to "sell" people on your work. it's to let them evaluate
229-
what your creation does as objectively as possible, and decide whether it meets
230-
their needs or not. not to, say, maximize your downloads or userbase.
244+
This sounds bleak, doesn't it? But think about it: your job, when you're doing
245+
it with optimal altruism in mind, isn't to "sell" people on your work. It's to
246+
let them evaluate what your creation does as objectively as possible, and decide
247+
whether it meets their needs or not. Not to, say, maximize your downloads or
248+
userbase.
231249

232250
This mindset doesn't appeal to everyone; it requires checking your ego at the
233251
door and letting the work speak for itself as much as possible. Your only job is
234-
to describe its promise as succinctly as you can.
235-
236-
You don't need to use *this* format, but try to be consistent to save your users
237-
precious cognitive cycles.
238-
239-
The ordering presented here is lovingly referred to as "cognitive funneling",
240-
and can be imagined as a funnel held upright, where the widest end contains the
241-
broadest more pertinent details, and moving deeper down into the funnel presents
242-
more specific details that are pertinent for only a reader who is interested
243-
enough in your work to have reached that deeply in the document. finally, the
244-
bottom can be reserved for details that only those intrigued by the deeper
245-
context of the work (background, credits, biblio, ...)
246-
247-
Not coincidentally, this is also the format used by
248-
[**common-readme**](https://github.com/noffle/common-readme), a set of README
249-
guidelines and handy command-line generator. If you like what's written here,
250-
you may save some time writing READMEs with `common-readme`.
252+
to describe its promise as succinctly as you can, so module spelunkyers can
253+
either use your work when it's a fit, or move on to something else that does.
251254

252255

253-
## bonus section: what other good practices are there?
256+
## Bonus: what other good practices are there?
254257

255258
Outside of the key points of the article, there are other practices you can
256259
follow (or not follow) to raise your README's quality bar even further, and
@@ -281,7 +284,7 @@ maximize its usefulness to others.
281284
function, `num` probably means a `Number`).
282285

283286
5. Include the JS in **Usage** as a file in your repo called `example.js` --
284-
it's great to have readme code that users can actually run if they clone the
287+
it's great to have README code that users can actually run if they clone the
285288
repository.
286289

287290
6. Don't be shy about having additional sections in the README to explain
@@ -294,10 +297,10 @@ maximize its usefulness to others.
294297
README, and generally only function if the user reading your markdown in a
295298
browser online, since the images are generally hosted elsewhere on the
296299
internet. For each badge, consider: "what real value is this badge providing
297-
to the typical viewer of this readme"? Have a CI badge to show build/test
300+
to the typical viewer of this README"? Have a CI badge to show build/test
298301
status? this signal would better reach important parties by emailing
299302
maintainers or automatically creating an issue -- always consider the
300-
audience of the data in your readme and ask yourself if there's a flow for
303+
audience of the data in your README and ask yourself if there's a flow for
301304
that data that can better reach its intended audience. (If you absolutely
302305
must have a badge, make sure it's wrapped in a link that points to further
303306
contextual information.)
@@ -313,10 +316,10 @@ maximize its usefulness to others.
313316
However, this can also be a strong signal that the function is too complex
314317
and needs to be refactored, broken into smaller functions, or removed
315318
altogether
316-
e. aggressively linkify specialized terminology! in markdown you can keep
319+
e. aggressively linkify specialized terminology! In markdown you can keep
317320
[footnotes](https://daringfireball.net/projects/markdown/syntax#link) at
318321
the bottom of your document, so referring to them several times throughout
319-
becomes cheap. some of my personal preferences on api formatting can be
322+
becomes cheap. Some of my personal preferences on api formatting can be
320323
found [here](api_formatting.md)
321324

322325
9. If your module is a small collection of stateless functions, having a
@@ -325,13 +328,14 @@ maximize its usefulness to others.
325328
calls and results might communicate usage more clearly than a source code
326329
file to run.
327330

328-
10. If your module provides a CLI (command line interface) insted of (or in
331+
10. If your module provides a CLI (command line interface) instead of (or in
329332
addition to) a programmatic API, show usage examples as command invocations
330333
and their output. if you create or modify a file, `cat` it to demonstrate
331334
the change before and after.
332335

333-
11. Don't forget to use `package.json` keywords to direct module hunters to your
334-
doorstep. (TODO: link to this page on npm)
336+
11. Don't forget to use `package.json`
337+
[keywords](https://docs.npmjs.com/files/package.json#keywords) to direct
338+
module spelunkers to your doorstep.
335339

336340
12. The more you change your API, the more work you need to exert updating
337341
documentation -- the implication here is that you should keep your APIs
@@ -344,7 +348,31 @@ maximize its usefulness to others.
344348
correction cost you nothing but a simple substitution of one module for
345349
another.
346350

347-
13. Your git repository and its README will outlive your repository host and any
348-
of the crap you link to, especially images, so inline anything that is
349-
essential to grokking the module.
351+
13. Finally, please remember that your version control repository and its
352+
embedded README will outlive your [repository host](https://github.com) and
353+
any of the things you hyperlink to--especially images--so *inline* anything
354+
that is essential to future users grokking your work.
355+
356+
357+
## Bonus: `common-readme`
358+
359+
Not coincidentally, this is also the format used by
360+
[**common-readme**](https://github.com/noffle/common-readme), a set of README
361+
guidelines and handy command-line generator. If you like what's written here,
362+
you may save some time writing READMEs with `common-readme`. You'll find
363+
real module examples with this format, too.
364+
365+
366+
## Call to Arms!
367+
368+
Go forth, brave module spelunker, and make your work discoverable and useable
369+
through excellent documentation!
370+
371+
372+
## Footnotes
373+
374+
1. See [The Jargon File](http://catb.org/~esr/jargon/html/R/README-file.html).
375+
However, most systems today will not sort capitals before all lowercase
376+
characters, reducing this convention's usefulness to just the visual
377+
strikingness of all-caps.
350378

0 commit comments

Comments
 (0)