12
Hot take: someone told me my code was "too clever" and it stung but they were right
I was using list comprehensions inside lambda functions for a beginner project and a guy in my study group said I was making it harder to debug. After the 3rd time I couldn't figure out my own code from last week, I rewrote it as simple for loops and it actually works now. Has anyone else had to dumb down their code to make it better?
3 comments
Log in to join the discussion
Log In3 Comments
gibson.elizabeth1mo ago
Have you ever read about the concept of "code smell" in programming books? I came across a thing called the "principle of least astonishment" where your code should basically do what someone would expect. @xena_brown50 nailed it about the 2am thing, I swear that's when all my "clever" choices come back to haunt me. Keeping it simple is just being kind to your future self.
5
cameron5382mo ago
Honestly, that's a rough lesson but it sounds like you came out of it with way cleaner code. Tbh I've been there where you think you're being smart and future you just ends up confused and frustrated. Ngl sometimes boring code is the best code.
4
xena_brown502mo ago
Ain't that the truth, clever code is just showing off till you gotta fix it at 2am.
3