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.

  • sunbeam60@lemmy.one
    link
    fedilink
    arrow-up
    1
    ·
    1 day ago

    How long is a piece of string?

    Rebuilding always takes a lot longer than you think. Refactoring always takes a lot longer than you think. I’ve been involved in failures and successes doing either.

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

      In a way you’re right - someone else already mentioned the uncommon-but-plausible situation where the original edge cases are no longer possible and don’t need to be handled. Most engineering has “fat tails”, where the rare exceptions are actually pretty common. The thing is, “it depends” doesn’t convey very much. Do you have some examples you could add, maybe?

      • sunbeam60@lemmy.one
        link
        fedilink
        arrow-up
        2
        ·
        3 hours ago

        Unfortunately the work I’ve been involved in is all in a commercial setting and I don’t think it would behoove me to talk too much about it. One was a major replatforming of an enormous, global education platform. That succeeded but took 6 years, not 3. I’ve gone through major engine changes in various game studios; one of which was built from scratch, one which was kept up to date and had original GameCube code in it by the time we gave up on it and I’m in the middle of one right now, building a new platform for another education platform and refactoring a large VR platform. I wish I could detect a pattern of success - the only association I can find is with “patience”.