10 ms·
I've been doing Go for a while now, and more and more I find myself just writing out really dumb looking code. Add a new line, write another short-lived variabl
by Cthulhu_ 7y ago
I've been doing Go for a while now, and more and more I find myself just writing out really dumb looking code. Add a new line, write another short-lived variable, treat the guy reading it - me - like he's a complete idiot. I don't work in a team at the moment, but what I do now is the groundwork for something that will likely be used for the next decade (UI work, back / front-end).
- z3t4 7y agoI also write the most dumb and simple code and if it works, then great, I don't touch it until it needs to be optimized or more likely: removed. Sometimes I don't really know what I'm doing, just getting all tests to pass. Then once it's working, when I know why it works, I will clean it up by removing unnecessary variables, double negations, and name the magic numbers, etc, and try to make it as simple as possible.
- mtrycz2 7y ago> really dumb looking code You cannot imagine how I'd value having really dumb looking code in my life. Yet here I am, swimming in a swap of cleverness that I can't refactor nor will ever be able to wrap my head around. I envy you.
- dgb23 7y agoBoth "dumb" and abstracted code can be hard to read and change. The most important part is consistency. It is generally easier to write dumb code that is consistent. It requires less mental energy and is often a very good starting point for refactoring into something more declarative and DRY. The pain comes from inconsistent code, often either based on wrong previous assumptions, premature optimization or time pressure.
- Dowwie 7y agoClear and concise isn't dumb. It's more readable and maintainable. The dumb code is the clever code that no one understands and requires weeks of effort to do, and to understand, no more than what the clear and concise code does.