3 ms·
>clever code isn't usually good code. Clarity trumps all other concerns. this is a good one to pick up early. Looking forward to my 20 in dev.
by SleepyMyroslav 4y ago
>clever code isn't usually good code. Clarity trumps all other concerns.
this is a good one to pick up early. Looking forward to my 20 in dev.
- withinboredom 4y agoI will write “clever” code to put constraints on the code. Clever code is hard to change and read, which is sometimes what you actually want. Sometimes you actually want anyone who wants to change a bit of complex logic to fully understand what they are changing before making that change. IOW, the cleverness is there for a reason.
- SleepyMyroslav 4y agoCode might be useful way after original constraints / platforms / compilers / requirements / reasons / etc are long gone. If you have a tradeoff between something today and clarity you might thank yourself later that you didn't went for it and kept code amenable to change. Or as with any tradeoff you can be right going for that cleverness. I have learned that I want to err on clarity side not on cleverness side but ymmv.
- withinboredom 4y agoYeah, I agree with that. Knowing when to break the rules and having reviewers agree with it is def a very rare thing. I think I’ve done this only a handful of times in the last 20 or so years.