Effective Documentation for Open
Source Projects
Bryan Hughes, Ph.D.
Microsoft
@nebrius
aka.ms/nebrius-nceu18
Mindset
aka.ms/nebrius-nceu18
You are not
your users
aka.ms/nebrius-nceu18
User knowledge
is highly variable
Parts of a README
aka.ms/nebrius-nceu18
Introduction
aka.ms/nebrius-nceu18
aka.ms/nebrius-nceu18
System Requirements
aka.ms/nebrius-nceu18
aka.ms/nebrius-nceu18
Installation
aka.ms/nebrius-nceu18
aka.ms/nebrius-nceu18
Usage
aka.ms/nebrius-nceu18
aka.ms/nebrius-nceu18
Notes
aka.ms/nebrius-nceu18
aka.ms/nebrius-nceu18
API
aka.ms/nebrius-nceu18
Complete API
Doc Guidelines
aka.ms/nebrius-nceu18
Algorithm
•Start w/ module exports
•Recursively descend
•End with primitives
aka.ms/nebrius-nceu18
Example API Tree
module exports
function init string NAME Class Badge
bool successstring connect
bool retry
string name bool connected
number backlight
arguments return constructor properties
aka.ms/nebrius-nceu18
Primitives
•Type
•Default Value?
•Optional/Required?
•Value limits?
aka.ms/nebrius-nceu18
Functions
•Return value
•All arguments
•Bonus: does it throw?
aka.ms/nebrius-nceu18
Objects
•Each property’s name
•Each property’s value
•Bonus: prototype
aka.ms/nebrius-nceu18
Classes
•Everything from Objects
•Constructor
•Overridable functions
aka.ms/nebrius-nceu18
Event
Emitters
•Each event’s name
•Each event’s arguments
aka.ms/nebrius-nceu18
Promises
•Resolve arguments
•Each rejection’s arguments
Documentation
is key to success
@nebrius

Effective Documentation for Open Source Projects

Editor's Notes

  • #7 Project Summary Why you should use it Badges
  • #9 OS+Node.js version Non-npm dependencies Hardware reqs/peripheral reqs
  • #11 npm Command in ``` Root/Admin privileges? Different variants?
  • #13 Short example(s) Most common use case Description of code
  • #15 Known edge cases Common bugs Non-obvious tips
  • #17 Fully documents all Props, methods, events Types of everything