20
A senior dev told me my code was "too clever" - here's what I changed
Last month my lead pulled me aside after a code review and said my solutions were confusing the junior devs. I was writing these fancy one-liners with nested ternaries and arrow functions that looked cool but made no sense to anyone else. I started splitting things into smaller functions with clear names, even if it meant more lines of code. Now my team actually understands what I wrote without me having to explain it every time. Has anyone else been told to dumb down their code and fought it at first?
2 comments
Log in to join the discussion
Log In2 Comments
singh.harper13d ago
Two months later they rewrote my simple functions back into one-liners.
6
jessem5913d ago
Well hold on now... I gotta disagree with you there. One-liners have their place, especially when you're dealing with a codebase that's got a ton of boilerplate. I've seen teams where every function is fifty lines of simple steps and it's a nightmare to scroll through. A well-written one-liner can actually be easier to read because it shows you the whole picture at once. Those refactors usually come from someone who's tired of jumping between a dozen files just to see what a simple filter or map is doing. I've had my own code rewritten too and yeah it stings, but sometimes they're right about keeping things concise. If the one-liner is readable and passes tests, why waste space on a bunch of single-use variables?
2