@@ -16,11 +16,13 @@ through documentation.
16
16
## Table of Contents
17
17
18
18
- [ Why do we need documentation?] ( #why-do-we-need-documentation )
19
- - [ Documentation with Meta: Magical ] ( #documentation -with-metamagical )
19
+ - [ Metadata with Meta: Magical ] ( #metadata -with-metamagical )
20
20
- [ Social meta-data] ( #social-meta-data )
21
21
- [ Execution meta-data] ( #execution-meta-data )
22
22
- [ Organisation meta-data] ( #organisation-meta-data )
23
23
- [ Usage meta-data] ( #usage-meta-data )
24
+ - [ Common categories] ( #common-categories )
25
+ - [ How to write documentation] ( #how-to-write-documentation )
24
26
25
27
26
28
## Why do we need documentation?
@@ -112,7 +114,7 @@ Tower's JavaScript projects. Note that they are not a general approach that can
112
114
be applied to any other language, even if the principles can be useful for them.
113
115
114
116
115
- ## Documentation with Meta: Magical
117
+ ## Metadata with Meta: Magical
116
118
117
119
Most of the different kinds of documentation described in the previous section
118
120
(and more) are attached to JavaScript objects using the
@@ -281,3 +283,64 @@ expect from using that code.
281
283
value is an object where the key is the kind of exception thrown, and the
282
284
value a description of when it's thrown and why.
283
285
286
+
287
+ ### Common categories
288
+
289
+ A few standard categories to use when describing your objects:
290
+
291
+ - ** Refining** , the function constructs a new object that's similar to some
292
+ object provided as argument, but with some new characteristics.
293
+
294
+ - ** Constructing** , the function constructs a new object from scratch.
295
+
296
+ - ** Inspecting** , the function is meant for debugging/runtime reflection.
297
+
298
+ - ** Comparing and testing** , the function allows one to compare different
299
+ objects, or test some property in a particular object. ` isFoo ` functions
300
+ always fall in this category.
301
+
302
+ - ** Extracting information** , retrieves part of a compound object.
303
+
304
+ - ** Converting to other types** , allows converting from one type to another
305
+ (like ` toString ` ).
306
+
307
+ - ** Transforming** , allows transforming some of the data represented by the
308
+ object.
309
+
310
+ - ** Combining** , allows combining different objects to yield a new one.
311
+
312
+ - ** Handling errors** , allows handling errors that may be represented
313
+ by/stored in the object.
314
+
315
+
316
+ ## How to write documentation
317
+
318
+ > ** TODO**
319
+ > This section is a stub and needs to be improved.
320
+
321
+ Your documentation should look something like:
322
+
323
+ ``` text
324
+ [short descriptive summary of what the object/message does]
325
+
326
+ ## Why?
327
+
328
+ [detailed description of WHY the object exists. This should provide
329
+ compelling arguments on why someone might use the object.]
330
+
331
+ ## Drawbacks
332
+
333
+ [if applicable, provide a description of the problems people might
334
+ run into by using this object, because of some design trade-off
335
+ you made (maybe your API is easy to use and consistent, but not
336
+ very efficient? Detail that here)]
337
+
338
+ ## Architecture
339
+
340
+ [For objects/modules, describe the general architecture, so people
341
+ know how each piece fits together, and can better reason about
342
+ its behaviour/contribute]
343
+ ```
344
+
345
+ Where possible, examples of how to use an object/method/function should be
346
+ provided. Examples are great for people to start playing around with.
0 commit comments