61
submitted 3 weeks ago by [email protected] to c/[email protected]

I've encountered this many times where I simply don't understand the context and use of an API based of the API documentation unless I can find an example that already utilizes it in a working project. The first thing that comes to mind is Py Torch. I've tried to figure out how some API features work, or what they are doing in model loader code related to checkpoint caching but failed to contextualize. What harebrain details are obviously missing from someone who asks such a silly question?

you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 2 points 3 weeks ago* (last edited 3 weeks ago)

Here's a tip on good documentation: try to write the documentation first. Use it as your planning process, to spec out exactly what you're going to build. Show the code to people (on GitHub or on a mailing list or on lemmy or whatever), get feedback, change the documentation to clarify any misunderstandings and/or add any good ideas people suggest.

Only after the docs are in a good state, then start writing the code.

And any time you (or someone else) finds the documentation doesn't match the code you wrote... that should usually be treated as a bug in the code. Don't change the documentation, change the code to make them line up.

[-] [email protected] 3 points 3 weeks ago

Don’t change the documentation, change the code to make them line up.

Unless the documentation is wrong

[-] [email protected] 2 points 2 weeks ago* (last edited 2 weeks ago)
[-] [email protected] 1 points 2 weeks ago

Sure - but in the real world that mostly only happens when the documentation is an afterthought.

this post was submitted on 24 Jun 2024
61 points (94.2% liked)

Programming

16304 readers
349 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS