Refactoring gets really bad reviews, but from where I’m sitting as a hobby programmer in relative ignorance it seems like it should be easier, because you could potentially reuse a lot of code. Can someone break it down for me?

I’m thinking of a situation where the code is ugly but still legible here. I completely understand that actual reverse engineering is harder than coding on a blank slate.

  • CanadaPlus@lemmy.sdf.orgOP
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    16 hours ago

    Legible code should not require “reverse engineering”, there should be comments linking to issues, use cases, an architecture overview, and so on. If you’re lacking those, start there, no matter which path you pick.

    Yeah, I just added that bit in to keep away the “ACKTUALLY if it’s written UNIVAC III assembly you have to rewrite it” answers. Technically correct, but not what I need.

    There’s no practical problem I’m immediately facing here, I just didn’t understand some of the opinions I was hearing and was curious. (All my hobby projects are either new software from scratch or adding features to existing code, right now)

    • jarfil@beehaw.org
      link
      fedilink
      arrow-up
      1
      ·
      5 hours ago

      Makes sense. As for the opinions, over time people end up cussing the same tools that were introduced to fix their previous problems, all tools can be misapplied 🤷