I'm glad to find someone else giving "readability" feedback in code reviews!
In 5 years, I've gone from a "how concisely/cleverly can I write this?" approach to coding, to a "how well can someone with no context read what I've written?" approach. And it I've experienced nothing but good things from making that shift.
Trouble maker and Problem solver ⚙️🔧
Loves simplicity, hates bullshit 💩.
Productivity obsessed, avid learner 🖥🚀
Sport and outdoor freak 🧗⛰
Metalhead 🎸🤘 Father of 2 👨👩👦👦
Opinions are my own
often "readability" it is just a matter of habit. I remember when I moved to Javascript at the beginning I found very hard reading the Arrow functions
consider this
function multiplyByTwo(a) {
return a*2;
}
versus :
const multiplyByTwo = a => a*2
Back then I would argue that the more verbose way was more understandable, right now i prefer the concise version.
It contains only what matters, no clutter.
But I completely agree that ( unless when there are performance issues or other reasons ) it is much better to write small (tiny) methods that can be compose together rather than a big one with lots of stuff in it.
Just think about a single for loop which filters and sorts and concatenate and manipulate data vs 4 different functions all concatenated. sure it's one iteration vs 4 but code is more readable and more unittestable.
And as you said reducing the cognitive load, and the amount of context you need to have to understand a piece of code is the most important thing.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm glad to find someone else giving "readability" feedback in code reviews!
In 5 years, I've gone from a "how concisely/cleverly can I write this?" approach to coding, to a "how well can someone with no context read what I've written?" approach. And it I've experienced nothing but good things from making that shift.
often "readability" it is just a matter of habit. I remember when I moved to Javascript at the beginning I found very hard reading the Arrow functions
consider this
versus :
Back then I would argue that the more verbose way was more understandable, right now i prefer the concise version.
But I completely agree that ( unless when there are performance issues or other reasons ) it is much better to write small (tiny) methods that can be compose together rather than a big one with lots of stuff in it.
Just think about a single for loop which filters and sorts and concatenate and manipulate data vs 4 different functions all concatenated. sure it's one iteration vs 4 but code is more readable and more unittestable.
And as you said reducing the cognitive load, and the amount of context you need to have to understand a piece of code is the most important thing.