Click here to Skip to main content
15,910,234 members

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, embarrassing 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.

 
GeneralRe: Thanks for the trip down memory lane Pin
Kirk 1038982111-Feb-21 1:00
Kirk 1038982111-Feb-21 1:00 
GeneralRe: Thanks for the trip down memory lane Pin
Wayne Welpe11-Feb-21 2:17
Wayne Welpe11-Feb-21 2:17 
GeneralRe: Thanks for the trip down memory lane Pin
Gary R. Wheeler19-Mar-21 13:58
Gary R. Wheeler19-Mar-21 13:58 
GeneralRe: Thanks for the trip down memory lane Pin
RDM Jr1-Jan-22 5:20
RDM Jr1-Jan-22 5:20 
Generalad hoc Programming PinPopular
raddevus6-Jan-21 9:19
mvaraddevus6-Jan-21 9:19 
GeneralRe: ad hoc Programming Pin
  Forogar  6-Jan-21 9:26
professional  Forogar  6-Jan-21 9:26 
GeneralRe: ad hoc Programming PinPopular
Ryan Peden6-Jan-21 10:47
professionalRyan Peden6-Jan-21 10:47 
GeneralRe: ad hoc Programming Pin
raddevus6-Jan-21 10:54
mvaraddevus6-Jan-21 10:54 
GeneralRe: ad hoc Programming PinPopular
Ryan Peden6-Jan-21 11:04
professionalRyan Peden6-Jan-21 11:04 
GeneralRe: ad hoc Programming Pin
Jon McKee6-Jan-21 11:29
professionalJon McKee6-Jan-21 11:29 
GeneralRe: ad hoc Programming Pin
honey the codewitch6-Jan-21 14:45
mvahoney the codewitch6-Jan-21 14:45 
GeneralRe: ad hoc Programming Pin
Jon McKee6-Jan-21 14:48
professionalJon McKee6-Jan-21 14:48 
GeneralRe: ad hoc Programming Pin
honey the codewitch6-Jan-21 14:49
mvahoney the codewitch6-Jan-21 14:49 
GeneralRe: ad hoc Programming Pin
Jon McKee6-Jan-21 14:58
professionalJon McKee6-Jan-21 14:58 
GeneralRe: ad hoc Programming Pin
honey the codewitch6-Jan-21 15:54
mvahoney the codewitch6-Jan-21 15:54 
GeneralRe: ad hoc Programming Pin
GuyThiebaut10-Feb-21 21:07
professionalGuyThiebaut10-Feb-21 21:07 
GeneralRe: ad hoc Programming Pin
Jon McKee11-Feb-21 0:17
professionalJon McKee11-Feb-21 0:17 
I agree on the last two points, but I can't say I agree on the first.
C#
var x = retrieveValue();
What type is x? You could use intellisense in most IDEs to see but that takes time. It also has another subtle but potentially nefarious problem: it shows the actual type but not the type you need. In situations where you require a super/base type but receive a sub/derived type, you may be fooled into thinking that the code expects the sub/derived type if you aren't familiar with the architecture (e.g. maintainers, new contributors). There are a slew of problems that could come from this.

Personally I feel like that last point is largely irrelevant despite being potentially serious since the greater issue is that you've willingly become less expressive purely to save a couple keystrokes. That's just my 2 cents though. I know some projects that liberally use var and have kept the issues under control even if I'd argue the time spent on control outweighs the keystrokes saved.

Also in all fairness my argument blurs the read/write line a bit, but maintenance inevitably requires modifying/writing code.
GeneralRe: ad hoc Programming Pin
Rob Grainger16-Mar-21 5:49
Rob Grainger16-Mar-21 5:49 
GeneralRe: ad hoc Programming Pin
Jon McKee16-Mar-21 10:30
professionalJon McKee16-Mar-21 10:30 
GeneralRe: ad hoc Programming Pin
Richard Deeming6-Jan-21 23:40
mveRichard Deeming6-Jan-21 23:40 
GeneralRe: ad hoc Programming Pin
Marc Clifton6-Jan-21 11:45
mvaMarc Clifton6-Jan-21 11:45 
GeneralRe: ad hoc Programming Pin
Chris Maunder5-Feb-21 14:01
cofounderChris Maunder5-Feb-21 14:01 
GeneralRe: ad hoc Programming Pin
GuyThiebaut10-Feb-21 21:06
professionalGuyThiebaut10-Feb-21 21:06 
GeneralMore clueless Web App designers? PinPopular
PIEBALDconsult2-Jan-21 13:05
mvePIEBALDconsult2-Jan-21 13:05 
GeneralRe: More clueless Web App designers? Pin
raddevus6-Jan-21 8:57
mvaraddevus6-Jan-21 8:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.