3 ms·
The most important thing I want from API documentation is that every method should have a minimal working code example. Minimal - the example should be focused
by cousin_it 13y ago
The most important thing I want from API documentation is that every method should have a minimal working code example.
Minimal - the example should be focused on demonstrating how to call that specific method, with as little other code as possible. That way I don't have to puzzle which parts are essential and which are arbitrary.
Working - if I paste the example code into a separate file and run it, it should work. Surprisingly many attempts at documentation fail this test.
When we're faced with an unfamiliar problem and an unfamiliar API that can solve that problem, the quickest way of programming is copy-paste programming. The documentation should make copy-paste programming as easy as possible. Understanding comes after imitation.
- 14113 13y agoAlso, if there is some common code between the examples, include this near the start as scaffolding for the examples. This way the examples are leaner, yet still runnable.
- roopeshv 13y agoI think this is a wonderful class for someone starting out and a good outline for people who want to get into practice of doing systematic design. https://class.coursera.org/programdesign-001/class https://class.coursera.org/programdesign-001/class