by a2tech · 7y ago · 0 comments
I think the real problem here is people always have preferred tools for jobs. The author obviously spends more time with JavaScript and finds that to be clearer and easier to write. I spend more time with bash and for me, it’s very clear. It doesn’t make it ‘inscrutable’
You might argue that this is an acceptable trade-off to make to in order to gain terseness and ease of typing. But this is different than saying it's just matter of tool familiarity.
I find the bit of bootstrapping I need to make sense of shorter length operators and options pays off when writing and or reading later.
The JS example is closer to english or pseudo-code, which makes it inherently more readable. It is not as terse, but it is also not esoteric like the bash script. Someone who doesn't know bash or JS will probably be able to understand the JS version more quickly.
I had to deal with this the other day. I approved a PR, with a comment that 5-7 lines of the logic were unreadable and convoluted. I left a more concise way to write the code as a suggestion.
When I saw the merged code in master a few days later, I noticed that the convoluted logic was still there. When I asked them about it, they just said "well, to me, it's readable, so I decided to keep it".
¯\_(ツ)_/¯
Lesson for me: Don't approve PRs if I don't feel good about the quality of the code being committed.
Lesson for my coworker: If someone strongly disagrees with you, get a second opinion, don't just merge your code into master.