• Vilian@lemmy.ca
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    8 months ago

    and if you need an unnecessarily complex code for performance sake?

    • hstde@feddit.de
      link
      fedilink
      arrow-up
      14
      ·
      8 months ago

      There’s a comment for you to explain the why.

      Rule of thumb: code explains the how and what, comments explain the why.

    • magic_lobster_party@kbin.social
      link
      fedilink
      arrow-up
      5
      ·
      8 months ago

      Those cases are rare. Often the most basic solution is good enough.

      If you have to write complex code, then you should write a comment (write the name of the algorithm for example).