15

After noticing 4 operations in a single line, I comment a pr stating the line is not simple to read as there are many operations which can be, especially in the eyes of a junior, hard to read.
I proceed to suggest a better solution.

Colleague: “what??? How is this not readable??? Is it [op1], [op2], [op3] or [op4]? 🤷‍♂️”

I kindly explain this person that it’s not about the single operations, but the fact they are all on a line. Inside an object assignment.

Colleague: “you should learn stuff! (4 links to websites giving that snippet of code”

Ah yes, the oldie: “but other people are jumping off a cliff, why don’t WE do it???”

Comments
  • 1
    I'm intrigued. Share the links? This sounds something like object unpacking.
  • 5
    @atheist I’d prefer not, in case he’s on the forum by chance…

    But basically:

    - creating an object

    And then on a single line:

    - object unpacking to assign a SINGLE value
    - ternary operation
    - creating an object with a single field (technically 2 objects, since it’s a ternary) so it can be unpacked in the parent object
    - parsing a value in the created (“child”) object

    E X T R E M E L Y R E A D A B L E
  • 1
    I get you. My username used to be the same as my email, I changed it when I was bitching about my work a lot.
  • 0
    @piratefox oh fuck. that sounds like a hard to parse line
  • 0
Add Comment