3 ms·
I don't think people tend to write this kind of code, per se. Rather, it "evolves". It starts as: return foo == null ? error_handler(bar) : foo; And someo
by Peaker 13y ago
I don't think people tend to write this kind of code, per se.
Rather, it "evolves".
It starts as:
return foo == null ? error_handler(bar) : foo;
And someone realizes error_handler actually does nothing, so replaces all calls with null, mechanically.
- werner34 13y agoExactly. The same is probably true for this one here: public bool ShowOptional() { bool bolReturn = false; return bolReturn; } There should be descriptions why the code snippets are supposed to be interesting, your and my example just look like legacy code to me.
- ctdonath 13y agoThis is often the case. When implementing something complex, a train of thought may require writing code then reducing it down to a degenerate form once certain conditions are confirmed/discovered; often the degenerate form is left as a placeholder in case something need be added back in ... alas, the final cleanup stage may not arrive and some oddities may be left behind to confuse future maintainers. Cleverness can, from some angles, look stupid. Or maybe it's just stupid. Sometimes you just can't tell the difference.