Click here to Skip to main content
15,898,134 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: Wasted space Pin
V.15-Oct-09 0:34
professionalV.15-Oct-09 0:34 
GeneralRe: Wasted space Pin
dojohansen15-Oct-09 1:03
dojohansen15-Oct-09 1:03 
GeneralRe: Wasted space Pin
V.15-Oct-09 1:27
professionalV.15-Oct-09 1:27 
GeneralRe: Wasted space Pin
Jim (SS)15-Oct-09 5:14
Jim (SS)15-Oct-09 5:14 
GeneralRe: Wasted space Pin
dmjm-h2-Nov-09 13:18
dmjm-h2-Nov-09 13:18 
GeneralRe: Wasted space Pin
Jim (SS)3-Nov-09 4:04
Jim (SS)3-Nov-09 4:04 
GeneralRe: Wasted space Pin
Member 218499724-Nov-09 18:54
Member 218499724-Nov-09 18:54 
GeneralRe: Wasted space PinPopular
David Skelly8-Oct-09 22:44
David Skelly8-Oct-09 22:44 
I can think of one reason for making it a method call. Imagine you have this all through your code, all over the place:

<br />
appendField(value ? "y" : "n", lastField)<br />


Now, someone comes along and says, 'We've just sold this to the Germans. "y" and "n" don't mean anything to them, it should be "J" and "N"'. You have to trawl through all the code, find every occurence of this (and any variations where Joe The Contractor has decided to do it his own way because that's how he's always done it in the past) and change them all to accept either Y/N or J/N depending on whether it's in German or English. The method itself could be more compact, but I would probably follow the DRY principal and put this sort of thing in a reusable method if it is being used a lot.

I have to ask: what kind of software are you writing where the overhead of a method call is such a big performance hit? I don't know your software and it's always risky to pontificate about the "right" and "wrong" way to do things when you don't know the requirements.
GeneralRe: Wasted space Pin
PIEBALDconsult9-Oct-09 4:38
mvePIEBALDconsult9-Oct-09 4:38 
GeneralRe: Wasted space Pin
Jim (SS)9-Oct-09 5:31
Jim (SS)9-Oct-09 5:31 
GeneralRe: Wasted space Pin
PIEBALDconsult9-Oct-09 8:19
mvePIEBALDconsult9-Oct-09 8:19 
GeneralRe: Wasted space Pin
Jim (SS)9-Oct-09 8:25
Jim (SS)9-Oct-09 8:25 
GeneralRe: Wasted space Pin
Robert Surtees9-Oct-09 14:49
Robert Surtees9-Oct-09 14:49 
GeneralRe: Wasted space Pin
Jim (SS)12-Oct-09 6:09
Jim (SS)12-Oct-09 6:09 
GeneralRe: Wasted space Pin
David Skelly12-Oct-09 22:58
David Skelly12-Oct-09 22:58 
GeneralRe: Wasted space Pin
OriginalGriff9-Oct-09 22:19
mveOriginalGriff9-Oct-09 22:19 
GeneralRe: Wasted space Pin
David Skelly12-Oct-09 22:50
David Skelly12-Oct-09 22:50 
GeneralRe: Wasted space Pin
Jim (SS)13-Oct-09 5:34
Jim (SS)13-Oct-09 5:34 
GeneralRe: Wasted space Pin
supercat919-Oct-09 9:07
supercat919-Oct-09 9:07 
GeneralRe: Wasted space Pin
Dan Neely19-Oct-09 10:31
Dan Neely19-Oct-09 10:31 
GeneralRe: Wasted space Pin
David Skelly19-Oct-09 22:21
David Skelly19-Oct-09 22:21 
GeneralRe: Wasted space Pin
Richard MacCutchan19-Oct-09 10:50
mveRichard MacCutchan19-Oct-09 10:50 
GeneralRe: Wasted space Pin
OriginalGriff19-Oct-09 22:16
mveOriginalGriff19-Oct-09 22:16 
GeneralRe: Wasted space Pin
Richard MacCutchan19-Oct-09 23:56
mveRichard MacCutchan19-Oct-09 23:56 
GeneralRe: Wasted space Pin
David Skelly19-Oct-09 22:18
David Skelly19-Oct-09 22:18 

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.