The Weird and The Wonderful

The Weird and The Wonderful forum is a place to post Coding Horrors,
Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrasing mistakes, horrid
workarounds and developers just not quite getting it. And then somedays we come across - or write -
the truly sublime.

Post your Best, your worst, and your most interesting. But please - no
programming questions . This forum is purely for amusement and discussions on code snippets. All
actual programming questions will be removed.

Yeah, that would slow things down. Using a to do list would help to remember to clean up such things. It is like a comment, but looks like //TODO: Remove this after testing. Then you can see the to so list in Visual Studio

No you need to leave some delay in for a development holiday. When Boss Man says the app is too slow, tell him you'll have a look, spend two days faffing, reduce the wait by 20% and tell him you've optimised the code. Simples.

The first is nasty. Embedding one ternary expression in a second or an if results in hard to read code. I'd say it's a tossup between the second and putting the ternary in a temp. Mostly that comes down to if the temp has any intrinsic meaning on its own (regardless of if it's used in a second place).

Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius

Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt

Maybe it's just my brain but the ternary expression is clearer for me That being the case I'd never write it this way in code. Complex conditions would most likely be moved into variables like someone has answered already, i.e.: