Please don't follow this advice! The best thing about old school Python was that I could reliably pull up the documentation for a library and it would clearly list the arguments and return values for each function. Now when I look at the documentation for many JavaScript, and even Python, libraries it's just examples. That's great if I'm trying to just throw something together as quickly as possible, but not if I nee…
Personally - what you're asking for is type definitions. And it's a blurry line, since type definitions are a good form of documentation. It's just that type-system tooling has mostly replaced the need to go read through the docs for that. I expect to get it easily and obviously in whatever editor or IDE I've configured. I think the prevalence of example based documentation is because of this trend - don't waste time…
Examples are the best documentation
111–120 of 179 posts
Re: Examples are the best documentation
#112Re: Examples are the best documentation
#113Earlier quoted context omitted.
> I don't use $ in programming except for string interpolation ... but the entire point of the "$JOB" etc. slang is that it's a string interpolation...
Not how I use it, string interpolation would be $"{job}"
echo $JOB
and echo ${JOB}
are identical, though the latter is more flexible (Allowing eg. `echo ${JOB:-unemployment}` or `echo ${JOB}SUCKS`).Re: Examples are the best documentation
#114No. Please for the love of Cthulhu. I need documentation. Not examples. They will help with the common cases, but common cases are easy, it's corner cases I'm after. Not type signatures - type systems are that would be sufficiently expressive would be badly unsound and undecidable. I need to know assumption the code takes. Specially so with statefull/object-oriented code, aka "why I hate the builder pattern". Too muc…
Re: Examples are the best documentation
#115Please don't follow this advice! The best thing about old school Python was that I could reliably pull up the documentation for a library and it would clearly list the arguments and return values for each function. Now when I look at the documentation for many JavaScript, and even Python, libraries it's just examples. That's great if I'm trying to just throw something together as quickly as possible, but not if I nee…
I don't understand the resistance to examples being a part of documentation (and not a bonus).
Re: Examples are the best documentation
#116No. Please for the love of Cthulhu. I need documentation. Not examples. They will help with the common cases, but common cases are easy, it's corner cases I'm after. Not type signatures - type systems are that would be sufficiently expressive would be badly unsound and undecidable. I need to know assumption the code takes. Specially so with statefull/object-oriented code, aka "why I hate the builder pattern". Too muc…
Why not both? That way you can use the docs if you are learning the language AND if you already know the language but are looking for deep details.
Re: Examples are the best documentation
#117There's a couple other maladies that make for unreadable docs. Another is documenting only the last layer added by the Open Source collaborator and not documenting anything below, for example if I'm making an HTTP client:
http.get() makes an HTTP get request
http.set_tcp_params(param=value) sets the TCP parameter param to value
When you could do:
http.get() makes an http get request, which should be a read only requaest, that doesn't affect state of the server. Parameters are typically passed in the URL with ?param=value¶m2=value2 syntax as defined in RFCxxx
http.set_tcp_params() sets parameters of the tcp layer, as defined in RFCxxx, these can include most importantly the MTU which is the max packet size, which might be useful for fitting webpages... (One way to fail in this regard is to use one of those autodocs things, you just lost the battle.
Re: Examples are the best documentation
#118No. Please for the love of Cthulhu. I need documentation. Not examples. They will help with the common cases, but common cases are easy, it's corner cases I'm after. Not type signatures - type systems are that would be sufficiently expressive would be badly unsound and undecidable. I need to know assumption the code takes. Specially so with statefull/object-oriented code, aka "why I hate the builder pattern". Too muc…
Why not both? That way you can use the docs if you are learning the language AND if you already know the language but are looking for deep details.
Re: Examples are the best documentation
#119Please don't follow this advice! The best thing about old school Python was that I could reliably pull up the documentation for a library and it would clearly list the arguments and return values for each function. Now when I look at the documentation for many JavaScript, and even Python, libraries it's just examples. That's great if I'm trying to just throw something together as quickly as possible, but not if I nee…
Did you stop to consider that perhaps other people learn differently than you, and find examples as a way to soften the friction that context switching causes in a job? I don't understand the resistance to examples being a part of documentation (and not a bonus).
Re: Examples are the best documentation
#120Please don't follow this advice! The best thing about old school Python was that I could reliably pull up the documentation for a library and it would clearly list the arguments and return values for each function. Now when I look at the documentation for many JavaScript, and even Python, libraries it's just examples. That's great if I'm trying to just throw something together as quickly as possible, but not if I nee…
E.g. "Python rstrip" (without quotes) in DuckDuckGo does not lead me to the Python docs on page 1.