• 1hitsong@lemmy.ml
    link
    fedilink
    arrow-up
    14
    ·
    1 month ago

    I’ve been rallying against clever code for years!

    Sure, it makes you have less lines for your l33t code solutions, but in the real world, it sacrifices the maintainability of code that others will eventually work on.

    Between a clever 1 line fix and maintainable 10 line fix, I’ll choose the 10 line every time.

    • curbstickle@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      5
      arrow-down
      1
      ·
      1 month ago

      As an extensive commenter, I completely agree.

      I need to know wtf I was doing, making it convoluted to save a few lines is pointless.

    • BradleyUffner@lemmy.world
      link
      fedilink
      English
      arrow-up
      8
      ·
      1 month ago

      A code smell isn’t supposed to be automatically bad. A smell is an indication that something might be wrong. Sometimes using a smelly pattern is legitimately the only way to do something.

    • pcouy@lemmy.pierre-couy.frOP
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 month ago

      Apart from the fact that, as another commenter said, “smells” are not “rules”, I think most of these points come down to developing good habits, and ultimately save a lot of time in the long run by initially spending some time thinking about maintainability and preventing/limiting technical debt accumulation.