• brygphilomena@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    9 days ago

    I disagree. Rewriting is a core component of maintaining a code base. It’s the evolution of code. Not rewriting and hooking in some janky way is much worse. No one can see all the possible needs of code the first time they write it. Or even the tenth. Updating the code by rewriting sections is the healthier way to use everything you learned since the first time you wrote it to keep it clean and improve it.

    • pinball_wizard@lemmy.zip
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      8 days ago

      Exactly. Elegant code requires domain expertise, which no one has on during the first attempt.

      Strident attempts at elegance during the first domain-expertise-free try tend to just result in different kinds of shitty code.

      Of course, experienced programmers can obviously achieve lower shittiness, from day one.

      But truly elegant code requires exploring the domain, and learning what works there.

      Shitty or barely-good-enough code often walks so that elegant code can someday replace it.

    • Tja@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      9 days ago

      Well, if rewriting is maintaining, everybody can write maintenable code.

      Did it become a mess? Rewrite time!

      For me the art is writing it so you don’t need to rewrite and you don’t need a janky temporary permanent workaround if requirements change. Clean interfaces, SOLID, plug-ins, etc. Can’t do it myself, but the legendary 10x devs usually do.

      • red_tomato@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        9 days ago

        The most maintainable code is built to be replaced with minimal impact.

        How much of the program will must be replaced if you remove one module? If you need to replace the entire program, then your program is not maintainable. Too much is heavily dependent on this module.