3 ms·
I am a professional developer, and I'll take the verbose, ugly, but readable code every time. Clever code that makes me work harder to understand what it does h
by zeta0134 3y ago
I am a professional developer, and I'll take the verbose, ugly, but readable code every time. Clever code that makes me work harder to understand what it does has a greater chance of being missed, blindly trusted, or just misunderstood, and that causes us untold numbers of headaches.
Writing clear, concise code is *hard.* Writing just clear code, conciseness be damned, is a perfectly fine middle ground.
- NewJazz 3y agoOK but if you have large amounts of unused code throughout the codebase, mistakes are more likely to be "missed, blindly trusted, or just misunderstood".
- teaearlgraycold 3y ago> but if you have large amounts of unused code throughout the codebase Delete it? Version control is your backup
- hyperman1 3y agoYou have to find it, first. I have a PHP codebase where symfony and doctrine are using strings to connect distant parts of the code. Just trying to find what calls what is hard. I am in the process of replacing as much strings with real calls and adding as much typing as possible, and have thrown away 1/3, but the code base fights back.
- jay_kyburz 3y agoI think when the OP says concise they mean using several lines to make some logic clear, rather than a tricky little one liners. (like many of the mistakes in the article)
- newZWhoDis 3y agoOne example of this I HATE is ruby’s obsession with return X unless [complex logic] I sometimes see this stacked inside other complex logic and it’s a nightmare sometimes to figure out the actual control flow.
- nayuki 3y agoWhich desugars to: if (!complex logic) return X;
- reportgunner 3y agoIf you put OR between two ANDs without a paren I think you have bigger issues than unused code.
- jay_kyburz 3y agoI agree. (!someBool == anotherBool) very bad code if you ask me.
- amatecha 3y agoyeah, it's reassuring that for most (all?) of these I'm like "I would never write that"... though I also lean towards very "simple" code that is not only blatantly clear but totally non-"clever". I'd rather the early-in-career dev we bring in 6-12mo later can read it and immediately parse it. Plus it's easier for ME 6-12mo later! hahah :)
- FranksTV 3y agoagreeWithPreviousCommentOnUselessCode()
- _a_a_a_ 3y agoI'm also a professional dev and I 100% agree with you. Clever code is a trap. Clever coders… Well, pretty much a disaster IME. KISS