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?

5 points

Because usually if you end up at the API reference in that situation it’s a code / project smell that other stuff is going wrong.

If I want to use a library to do something, you should be able to search for what you want to do + language / framework, find the library’s docs, follow the install instructions and then look through the highest level API / instructions and then just go from there.

If you find yourself confused at unhelpful API references that just means that they have badly written top level API docs, badly written intros, or quite probably just badly written APIs.

permalink
report
reply
55 points

API documentation isn’t a tutorial, it’s there to tell you what the arguments are, what it does and what to expect as the output and just generally, what’s available.

I actually have the opposite problem as you: it infuriates me when a project’s documentation is purely a bunch of examples and then you have to guess if you want to do anything out of the simple tutorial’s paved path. Tell me everything that’s available so I can piece together something for what I need, I don’t want that info on chapter 12 of the example of building a web store. I’ve been coding for nearly two decades now, I’m not going to follow a shopping cart tutorial just in the off chance that’s how you tell how the framework defines many to many relationships.

I believe an ideal world has both covered: you need full API documentation that’s straight to the point, so experienced people know about all the options and functions available, but also a bunch of examples and a tutorial for those that are new and need to get started and generally learning how to use the library.

Your case is probably a bit atypical as PyTorch and AI stuff in general is inherently pretty complex. It likely assumes you know your calculus and linear algebra and stuff like that so that’d make the API docs extra dense.

permalink
report
reply
8 points

Agree. I find “get started” usually is the best way to give an example of “entry point” to API. After that API documentation should get anyone covered for most of the cases. If API is big then it probably has primary and secondary set of features. Secondary then can be covered as tutorials.

permalink
report
parent
reply
72 points

Why is the documentation incomplete?

Asks every programmer since the dawn of time.

permalink
report
reply
25 points

Pretty busy at the moment, I’ll get back to this later when I have sone free time.

permalink
report
parent
reply
4 points
*

I often use grep.app to look for example. It’s fulltext search for code on GitHub, and just get information about the parameters and output by looking at the library’s code.

permalink
report
reply
13 points

When someone writes API docs, should they assume the reader knows nothing or can they assume the is already experienced?

It takes a lot of effort to write documentation towards newbies, at the cost of making it more difficult for already experienced to find the answer they need.

permalink
report
reply
2 points

Write multiple versions of docs for different audiences

permalink
report
parent
reply
2 points

Which doubles the maintenance work to keep docs in sync

permalink
report
parent
reply
6 points

No way they will ever be in sync.

permalink
report
parent
reply
5 points

Docs should be written for someone experienced in programming but inexperienced with the API. If it is about a niche subject (for example VR).

Whenever an explanation contains something about that niche subject, you don’t need to explain everything, but maybe provide a link towards another place (for example wikipedia) that explains it.

permalink
report
parent
reply
5 points
*

Usually API docs are tucked away inside a “developer dashboard” or whatever they decided to call it. So I think you can assume at least moderate API and web development knowlege and programming skills.

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

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 !webdev@programming.dev



Community stats

  • 3.1K

    Monthly active users

  • 893

    Posts

  • 7.7K

    Comments