• xJREB@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      6 months ago

      As a software engineering researcher, I strongly agree. SE research has studied code comprehension for more than 40 years, but for that amount of time, we know surprisingly little about what makes really high-quality code. We are decent in saying what makes very bad code, though, but beyond extreme cases, it’s hard to come to fairly general statements.

        • xJREB@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          6 months ago

          A few bad things in code for which we have fairly consistent evidence:

          • high nesting depth
          • meaningless or single-letter variable names
          • lots of code duplication
          • very inconsistent formatting
          • very complicated Boolean conditions with AND and OR
          • functions with a lot of parameters
    • sparkle@lemm.ee
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      edit-2
      6 months ago

      we become programmers because we lack creativity. my brain short circuits when i have to come up with something other than “foo”, “bar”, or maybe even “baz”

      • holgersson@lemm.ee
        link
        fedilink
        arrow-up
        5
        ·
        6 months ago

        Programming is quite literally creative problem solving, so I doubt that programmers lack creativity.

        • sparkle@lemm.ee
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          6 months ago

          Problem solving, of course, but creative writing, composition, and art… not my cup of tea.

      • Passerby6497@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        6 months ago

        I have the opposite problem, my variables are sometimes too descriptive. I even annoy myself at times with VariableThatDoesThisOneThing and VariableThatDoesDifferentThing just because I want to be able to come back later and not wonder what I was smoking.