• BB_C@programming.dev
    link
    fedilink
    arrow-up
    51
    arrow-down
    7
    ·
    edit-2
    6 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?

    • anti-idpol action@programming.dev
      link
      fedilink
      arrow-up
      19
      ·
      6 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
    link
    fedilink
    arrow-up
    36
    ·
    6 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.

  • Deebster@programming.dev
    link
    fedilink
    arrow-up
    35
    arrow-down
    1
    ·
    6 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.devOP
      link
      fedilink
      arrow-up
      14
      ·
      6 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
      link
      fedilink
      arrow-up
      7
      ·
      6 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.