44
top 16 comments
sorted by: hot top controversial new old
[-] BB_C@programming.dev 51 points 2 months ago* (last edited 2 months ago)

Examples ARE usage documentation.

What value is this blog supposed to be adding exactly?
The fact that top-level and API descriptive explanations are important?
The fact that some projects don't have complete documentation?
To whom exactly would this be considered new information?

[-] pkill@programming.dev 20 points 2 months ago

This. I can't count HOW MANY FUCKING TIMES I had to either look up the source code or search GitHub for code using a function from a given library because the documentation was so laconic and/or disjointed.

[-] sugar_in_your_tea@sh.itjust.works 40 points 2 months ago

The only thing worse than a bad example is documentation like this:

fn do_thing(...)

Does thing.

It adds nothing, other than letting you know they were there and decided not to actually provide something useful.

[-] Nereuxofficial@programming.dev 7 points 2 months ago

Yeah that just wastes both people's time

[-] Deebster@programming.dev 40 points 2 months ago

My absolute favourite is when the examples say something like "production code should not be written like this, this is just for clarity" with no indication of what's wrong with the code.

Is it just normal Rust stuff like there's unwraps everywhere and it's one big file? Does the example have security or performance problems? Is the example unidiomatic or over-verbose or is it ignoring features real-world code would use? EXPLAIN YOURSELF!

[-] Nereuxofficial@programming.dev 14 points 2 months ago

Yeah that's the fun part!

Maybe there are also some security implications of the code?

Because the thing is: That code is probably gonna end up in production somewhere

[-] noddy@beehaw.org 7 points 2 months ago

I personally prefer the straight forward everything in one file examples. The worst examples are those that come with its own ad hoc example framework I first need to understand before I can understand the example.

[-] crispy_kilt@feddit.de 2 points 2 months ago

It's probably to encourage people to underdtsnd the example properly then write their own code. Too many people copy/paste examples without understanding them completely.

[-] anlumo@feddit.de 12 points 2 months ago

clap and bevy are big offenders there. It's really hard to learn how to use them due to this.

[-] tatterdemalion@programming.dev 5 points 2 months ago

Are you kidding me? Clap has some of the best documentation of any crate.

[-] anlumo@feddit.de 1 points 2 months ago

I just checked again, and apparently they finally added some documentation since I last checked. The section about the macro stuff just used to say “look at the examples”.

[-] tatterdemalion@programming.dev 1 points 2 months ago

Ah that explains it.

[-] SatouKazuma@lemmy.world 2 points 2 months ago

It sucks that there aren't (in my limited experience) a ton of engines out there with good documentation (at least that are built in Rust). I've started trying to build my own engine, but the complexity and time required are certainly a bit of a barrier, especially for the game I'm working on. (N.B. - The game is nowhere close to being in any sort of state to be shown, so please don't ask 😆)

[-] anlumo@feddit.de 2 points 2 months ago

My experience has been that good documentation is mostly something done if somebody gets paid for the work. People working on stuff in their spare time just don't care enough to document their project.

[-] SatouKazuma@lemmy.world 1 points 2 months ago

That, or they don't care enough to pick it back up if they ever drop it. Nothing hurts worse than forgetting what you're trying to do because you don't even comment your code.

[-] crispy_kilt@feddit.de 5 points 2 months ago

Uhm. Yes they are.

this post was submitted on 03 May 2024
44 points (81.4% liked)

Rust

5452 readers
19 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS