• Knusper@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    I do think the unnumbered variant of such anonymous parameters is useful, if you’ve got a team of devs that knows not to misuse them.

    In particular, folks who are unexperienced will gladly make massive multi-line transformations, all in one step, and then continue blathering on about it or similar, as if everyone knew what they were talking about and there was no potential for ambiguity.

    This is also particularly annoying, because you rarely read code top-to-bottom. Ideally, you should be able to jump into the middle of any code and start reading, without having to figure out what the regional abbreviations or it mean.

  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    11 months ago

    The liberty to not name things that are obvious.

    and that’s yet another way to end up with hard to read code.

    Variables hold values that have meaning. Learn how to name things and you’ll write good code.

    edit: someone just wrote an article along these lines. The only thing I’d change is the cause-effect relationship between bad names and bad code. IME bad names lead to bad code, not usually the other way around. The reason is that by starting from good name choices, it’s much easier to have a well structured code. And not rarely, bad names lead to mangled up code that screams for a refactoring.

    • exussum@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      This makes me want to write a function for you to add to numbers where the variables are leftumber and rightnumber, instead of x and y.

      • Turun@feddit.de
        link
        fedilink
        arrow-up
        0
        ·
        1 year ago

        Implementing add (and other math operations) in rust for your types has the type signature self and rhs (right hand side).