←back to thread

396 points Bogdanp | 1 comments | | HN request time: 0.208s | source
Show context
theamk ◴[] No.45533317[source]
Examples are best only for the beginner/occasional users. For more experience devs, you want regular docs, with full parameter list.

Case in point: requests. Google always drops me to the pages like Quickstart[0], which are full of examples. But they are useless for advanced users! Yes, even my limited brain can remember that you call "get" to issue HTTP GET. What other options does it take? Does it take a timeout? How do I pass in content-type? Does raise_for_status ignore 204?

Both have their merits, but if developer only has time for one, I'd go for proper doc.

[0] https://requests.readthedocs.io/en/latest/user/quickstart/

replies(8): >>45534019 #>>45535215 #>>45535253 #>>45535369 #>>45535610 #>>45535847 #>>45536180 #>>45538163 #
happytoexplain ◴[] No.45535215[source]
Examples are often crucially valuable, not just for beginners. Some of them can inject in five seconds an understanding equivalent to an hour of reading the very-objective docs and experimenting. I'm thinking of some git doc pages. But it applies just as well to single functions that are very simple conceptually, but hard to describe clearly and briefly and completely.

The developer has time for neither or both. Once the productivity barrier for one has been broken, the other is a tiny extra effort. In that case, they must provide both, except in the small minority of cases that are exceptionally self-describing, where one (usually docs) is sufficient.

replies(1): >>45535246 #
skydhash ◴[] No.45535246[source]
Examples is for beginners. Beginners here refer to people that started to learn something, anything. But one you've got a conceptual understanding of the thing. You mostly need a full manual/reference.
replies(3): >>45538600 #>>45538613 #>>45539478 #
1. pixl97 ◴[] No.45539478[source]
>Examples is for beginners.

No, not really, or I should say simple examples are for beginners.

Typically when I'm writing example pages I write it in

Simple example

Simple example

Simple example

Intermediate example

Intermediate example

Complex example.

Having complex examples can really help those that are looking at going beyond the basics.