17
My web dev mentor told me my code was 'too clever' and I thought he was nuts at first
I was building a React component with all these nested ternaries and abstracted helper functions because I thought it looked slick. He pulled me aside and said 'if you can't read this 6 months from now in 10 seconds, it's bad code.' I had to rewrite it with plain if statements and more descriptive variable names. Honestly it took me like 3 tries to stop trying to be fancy but now my PRs get merged way faster. Has anyone else had to unlearn bad habits from tutorials?
2 comments
Log in to join the discussion
Log In2 Comments
betty_barnes1d ago
My mentor made me rename my variables to full words instead of abbreviations and I was annoyed until I came back to a function I wrote last month and actually understood it in one glance. That was the moment I realized he was right about writing code for humans first.
3
hannah2401d ago
My friend Karen got chewed out by her senior dev for naming something "tmp2" and swore it made sense at the time. She came back to that same function like 3 weeks later and had zero clue what it was for lol.
5