• who@feddit.org
    link
    fedilink
    English
    arrow-up
    39
    ·
    edit-2
    13 hours ago

    There are only two hard things in Computer Science: cache invalidation and naming things.

    — Widely attributed to Phil Karlton

    There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors.

    — Leon Bambrick 2010-01-01

    • queerlilhayseed@piefed.blahaj.zone
      link
      fedilink
      English
      arrow-up
      6
      ·
      10 hours ago

      Human-human interface configuration falls under networking issues. And naming things, now that I think about it.

      And occasionally off-by-one issues :(

    • Susaga@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      7
      ·
      15 hours ago

      It’s possible your coworkers are the ones dealing with those issues, and you just never notice.

  • humanspiral@lemmy.ca
    link
    fedilink
    arrow-up
    2
    ·
    10 hours ago

    0 based indexing of course, so what’s the joke? oh, mixing up count and max index is a hardship you get over after a couple of years, but it comes back sometimes.

    • RustySharp@programming.dev
      link
      fedilink
      arrow-up
      1
      ·
      2 hours ago

      The more you move through the networking stack, the more you start seeing OB1 error potentials.

      Many protocols have packet ids starting from (and wrapping back to) 1. Modbus registers start from 1, but stored in memory offset 0.

      Packet lengths can either include or exclude the length itself. E.g. packet length 200 in a protocol could either mean the length is followed by 200 bytes of data; or 1 byte containing the length + 199 data; or even 4 bytes length + 196 data (off by four!)

      It’s a wild world out there.

    • queerlilhayseed@piefed.blahaj.zone
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 hours ago

      Off-by-one errors are real errors. A common mistake rookie developers make (or used to make, anyway) is forgetting that arrays are zero-indexed when creating an array, then seeing the value that should be in array[n-1] when they read array[n].

      Another common off-by-one error is double counting: Some accumulators don’t do all their processing in the same function, and occasionally one thing will be checked for inclusion twice, causing the accumulator to have one more element than it should.