• Miaou@jlai.lu
    link
    fedilink
    arrow-up
    39
    arrow-down
    4
    ·
    9 months ago

    The amount of people nitpicking about the brand of pseudocode or arguing the question is tricky reminds me of some coworkers, and not the good kind.

    If you belong to the above category, try to learn some new programming language / read about some algorithm descriptions (not implementation) and go out take some sun. The question is super intuitive if you’re not stuck to a single paradigm or language.

    • OR3X@lemm.ee
      link
      fedilink
      arrow-up
      15
      arrow-down
      1
      ·
      9 months ago

      Exactly. It’s pseudo code. It’s meant to be universally understandable, not language specific.

    • Socsa@sh.itjust.works
      link
      fedilink
      arrow-up
      9
      arrow-down
      6
      ·
      edit-2
      9 months ago

      So I teach coding to idiots. Confusing or poorly defined abstractions in pseudocode are bad. If you want people to infer useful information from pseudocode, and learn good practices from it, you need to treat it as if there a real underlying class structure written with good practices, or even better, make it comply to some actual language which does that. If you want to imply that this is a member of string, something like string.len_chars is way better imo because it captures the idea of a string being an array<char>. Then the next question can be about string.len_bytes (watch the wheels turn!). That naturally transitions nicely into object oriented paradigms of object containers/storage being at once a templated abstraction with a stride and depth, and also a physical thing in memory.

        • ikka@lemmy.sdf.org
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          9 months ago

          The first language I tried to learn as a kid was Batch scripting…

          (edit: and then some VBScript along the way! Eventually worked my way to C++ though)