• million@lemmy.world
    link
    fedilink
    English
    arrow-up
    162
    arrow-down
    1
    ·
    edit-2
    1 year ago

    Refactoring is something that should be constantly done in a code base, for every story. As soon as people get scared about changing things the codebase is on the road to being legacy.

    • NoXzema@lemmynsfw.com
      link
      fedilink
      English
      arrow-up
      43
      ·
      1 year ago

      Been with a lot of codebases that had no unit tests at all and everyone was afraid to change anything because the QA process could take weeks to months.

      The result is you have a codebase that ages like milk.

    • brettvitaz@programming.dev
      link
      fedilink
      arrow-up
      28
      arrow-down
      1
      ·
      edit-2
      1 year ago

      Only if the code base is well tested.

      Edit: always add tests when you change code that doesn’t have tests.

      • mark@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        1 year ago

        And also try to make tests that don’t have to change if you refactor in future (although there are some exceptions)

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

            Standing up at the wrong time is how you end up on the list to get laid off. Most calls I have at work are like group therapy sessions, as everyone has ideas of what they believe is correct, but they know if they keep pressing with management or take the time to do what is right, it won’t go well for them.

            A good manager likes to be told they’re wrong and how things should be done, but those are few and far between.

            • intelati@programming.dev
              link
              fedilink
              arrow-up
              1
              ·
              1 year ago

              Most calls I have at work are like group therapy sessions, as everyone has ideas of what they believe is correct, but they know if they keep pressing with management or take the time to do what is right, it won’t go well for them.

              This is coming from a guy who lasted a year and a half in the office. Sounds like it’s a systematic issue…

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

                It is. I’ve lasted almost 18 years. Things come in waves of good and bad. We’re currently in some bad times.

      • FlumPHP@programming.dev
        link
        fedilink
        arrow-up
        8
        ·
        1 year ago

        Today I removed code from a codebase that was added in 2021 and never ever used. Sadly, some people are as content to litter in their repo as they are in the woods.

      • nous@programming.dev
        link
        fedilink
        English
        arrow-up
        8
        ·
        1 year ago

        Why do you need time to refactor? It is just part of the work you need to do and should be accounted for when doing any other work. IMO a big mistake people make is thinking refactoring is some separate thing they need permission to do. You don’t, if you need to make a change in some area refactor it first to make it easier to accept your change, then add your change then refactor to clean up. This is not three separate tasks, just three steps in one task. You should be given enough time to do the whole task, not just part of it.

        • myersguy@lemmy.simpl.website
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          I guess I need to refactor for readability. What you just explained is the entire point of the comment I posted. Refactoring is part of the job. Don’t give your manager a choice on whether or not it needs done.

    • hascat@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Yes please. Many times when I add a feature I end up refactoring some of the code first to better accommodate it.

    • russ@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      We used to call this ‘Code is Cheap’ at my last job - you’re spot on about the value of it