• bob_wiley@lemmy.world
    link
    fedilink
    English
    arrow-up
    37
    arrow-down
    1
    ·
    1 year ago

    I worked with a guy who was a pretty decent programmer, but his background was really heavy in Linux engineering. His variable names were horrible. He named everything as if it was going to be some CLI command. Even that wasn’t the worst. At one point he had var1 - var17. Having to maintain that code has not been fun. If re-write it if I didn’t know it was going to go away.

    I tried talking to him about it many times while we were working together, but he just kept on doing what he was doing.

    • CookieOfFortune@lemmy.world
      link
      fedilink
      arrow-up
      31
      ·
      1 year ago

      That just sounds to me like he hasn’t worked on large code bases with multiple teams. No way it would be considered acceptable once you’re interesting with enough other people.

    • markstos@lemmy.world
      link
      fedilink
      English
      arrow-up
      24
      ·
      1 year ago

      Solution: Code Style Guidelines doc that the team agrees on. A checkbox in the PR template that affirms that code is compliant with the guidelines.

      This way it’s not personal, it’s a rule that everyone should follow as a shared standard.

      • bob_wiley@lemmy.world
        link
        fedilink
        English
        arrow-up
        12
        ·
        1 year ago

        I tried going the style guidelines route, but we didn’t have a good code review process to really enforce it. It basically would have ended up being me doing 100% of the reviews. At the time I was just happy to get them to actually use source control properly.

          • bob_wiley@lemmy.world
            link
            fedilink
            English
            arrow-up
            5
            ·
            1 year ago

            We’re getting there. Though I’m not sure what kind of rule in a CICD process could check to see if a variable name actually made sense. Using snake or camel case, sure, but how does it know if ‘dc_loc_5’ is good or not from the perspective of someone who needs to maintain the code?

        • ripcord@kbin.social
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          1 year ago

          This sadly sounds like one of the projects on my teamat the moment and it’s horrifying.

          One guy working on it, I’m really the only reviewer. Code is all stuff like this. Variables named j1 through j20, dozens and dozens of nearly identical functions with tons of brute force, copy-pasted code, etc. Works well enough but it’s just horrifying to try to read and review.

          Edit:. Just remembered, he had all these grouped functions passing (and sometimes returning) 60+ identical variables that didn’t need to be local because he refused to use class vars, etc.

          He’s gotten a lot better about this stuff in the last year though

          • whofearsthenight@lemm.ee
            link
            fedilink
            English
            arrow-up
            2
            ·
            edit-2
            1 year ago

            You know, as an amateur with massive impostor syndrome who’s probably going to be applying for jobs soon, this comment and those like it give me strength.

    • SokathHisEyesOpen@lemmy.ml
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I found a variable named “t” Friday. I figured I must be looking at the minified version, but nope! Someone just decided to name something “t”, I have no idea why.