• Jim@programming.dev
    link
    fedilink
    English
    arrow-up
    6
    ·
    1 day ago

    This is a classic piece, and I love the contradictions in the text. It encapsulates my feelings on good software and code that it almost becomes an art than a science.

  • FlorianSimon@sh.itjust.works
    link
    fedilink
    arrow-up
    7
    ·
    1 day ago

    I’d go easy with the recommendation to couple components loosely. If you make things that belong together loosely coupled, you’ve created obfuscation, and added complexity to your codebase. Loose coupling makes sense, but not everywhere.

  • Lysergid@lemmy.ml
    link
    fedilink
    arrow-up
    14
    ·
    2 days ago

    TLDR;

    My current project has mostly easy to delete code and not easy to extend. Why? Coz shit was copy-pasted 50 times. It’s not fun to work in this project.

    • Kache@lemm.ee
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      1 day ago

      I don’t understand, if you’ve got easy to delete copy-pasted code, then delete it. It’ll be a nice and cathartic exercise.

      But sounds like what you’re really talking about is code that isn’t easy to delete.

      • Lysergid@lemmy.ml
        link
        fedilink
        arrow-up
        2
        ·
        13 hours ago

        I don’t understand too. Are you suggesting me to drop bunch of features in the product?

        • samus7070@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          8 hours ago

          I think the responder means that duplicate code is usually easy to refactor into single methods. Typically I see copy pasted code that is changed just a little bit. However much of a duplicated function can be broken into smaller functions and the redundant code removed in favor of calling into the functions. Often what is left then becomes easier to reason about and refactor accordingly. I love the PRs that I make which delete more code than I add but still manage to add functionality. It doesn’t happen often but it’s fun when it does.

          • Lysergid@lemmy.ml
            link
            fedilink
            arrow-up
            1
            ·
            3 hours ago

            Right, but my initial comment was about article’s statement being wrong. Refactoring in the way you described will make code harder to delete which is bad according to the article.

    • yournameplease@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 day ago

      Same thing on my project. Thousands of lines across a few dozen files copied 100+ times. At that point there’s almost no going back with everything diverging so long ago.

  • drspod@lemmy.ml
    link
    fedilink
    arrow-up
    18
    arrow-down
    2
    ·
    edit-2
    2 days ago

    “Every line of code is written without reason, maintained out of weakness, and deleted by chance” Jean-Paul Sartre’s Programming in ANSI C

    Is this a joke or an AI hallucination? I’m pretty sure Sartre never wrote about programming in ANSI C.

    There is a book called “Programming in ANSI C” by E. Balagurusamy

    I can only find other references to this quote from sites that are linking this article.

    The article actually does date back to 2016 so it’s not AI generated.

    • drspod@lemmy.ml
      link
      fedilink
      arrow-up
      33
      ·
      2 days ago

      I should have tried a bit harder to search, the original quote by Sartre is:

      “Every existing thing is born without reason, prolongs itself out of weakness, and dies by chance.”