Click here to Skip to main content
15,888,254 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: 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 
GeneralRe: More clueless Web App designers? Pin
Nelek8-Jan-21 2:59
protectorNelek8-Jan-21 2:59 
GeneralObjective-J Pin
Brisingr Aerowing18-Dec-20 18:46
professionalBrisingr Aerowing18-Dec-20 18:46 
GeneralRe: Objective-J Pin
Ryan Peden6-Jan-21 10:56
professionalRyan Peden6-Jan-21 10:56 
General.Net Framework vs .Net 5 Core PinPopular
#realJSOP10-Dec-20 6:03
mve#realJSOP10-Dec-20 6:03 
GeneralRe: .Net Framework vs .Net 5 Core Pin
Slacker00710-Dec-20 6:39
professionalSlacker00710-Dec-20 6:39 
GeneralRe: .Net Framework vs .Net 5 Core Pin
#realJSOP10-Dec-20 8:19
mve#realJSOP10-Dec-20 8:19 
GeneralRe: .Net Framework vs .Net 5 Core Pin
Slacker00710-Dec-20 9:06
professionalSlacker00710-Dec-20 9:06 
GeneralRe: .Net Framework vs .Net 5 Core Pin
#realJSOP11-Dec-20 1:09
mve#realJSOP11-Dec-20 1:09 
GeneralRe: .Net Framework vs .Net 5 Core Pin
Slacker00711-Dec-20 3:20
professionalSlacker00711-Dec-20 3:20 

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.