Click here to Skip to main content
15,887,434 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: Redundant Coding: The new paradigm! Pin
AspDotNetDev9-Sep-10 11:37
protectorAspDotNetDev9-Sep-10 11:37 
JokeRe: Redundant Coding: The new paradigm! Pin
Chris Meech10-Sep-10 1:15
Chris Meech10-Sep-10 1:15 
GeneralRe: Redundant Coding vs rewrite vs Joel Pin
pg--az11-Sep-10 22:17
pg--az11-Sep-10 22:17 
GeneralRe: Redundant Coding vs rewrite vs Joel Pin
Richard A. Dalton12-Sep-10 23:15
Richard A. Dalton12-Sep-10 23:15 
GeneralRe: Redundant Coding vs rewrite vs Asp.net-Crypto-Attack Pin
pg--az14-Sep-10 22:17
pg--az14-Sep-10 22:17 
GeneralRe: Redundant Coding: The new paradigm! Pin
patbob17-Sep-10 7:13
patbob17-Sep-10 7:13 
GeneralRe: Redundant Coding: The new paradigm! Pin
BrainiacV24-Sep-10 3:04
BrainiacV24-Sep-10 3:04 
GeneralConstructor reading Session Variables Pin
Richard A. Dalton8-Sep-10 0:48
Richard A. Dalton8-Sep-10 0:48 
Don't know if this qualifies as a coding horror, but it does give me the heebeegeebees.

Classes that have constructors which initialise the member variables of the class. So far so good.

Except the constructor gets the values it needs from Session Variables, rather than parameters passed in to the constructor.

I understand why it was done, one of the classes is being used to write data to a table that has 118 columns. Who wants to pass 118 parameters to a constructor?

But it still seems questionable to me. To put it simply you can instantiate the same class twice and end up with radically different states depending on how the Session Variables look at the time.

What say you? Coding Horror? Common Practice? Both?

In a strange twist, there is generally a function that is called that sets all the necessary session variables before the class is instantiated.

I don't see why the class couldn't be instantiated first and then have this method set properties on the class rather than setting session variables.
GeneralRe: Constructor reading Session Variables Pin
GibbleCH8-Sep-10 3:52
GibbleCH8-Sep-10 3:52 
GeneralRe: Constructor reading Session Variables Pin
Richard A. Dalton8-Sep-10 4:08
Richard A. Dalton8-Sep-10 4:08 
GeneralRe: Constructor reading Session Variables Pin
hammerstein058-Sep-10 6:39
hammerstein058-Sep-10 6:39 
GeneralRe: Constructor reading Session Variables Pin
Kunal Chowdhury «IN»11-Sep-10 22:03
professionalKunal Chowdhury «IN»11-Sep-10 22:03 
GeneralRe: Constructor reading Session Variables Pin
PIEBALDconsult8-Sep-10 4:05
mvePIEBALDconsult8-Sep-10 4:05 
GeneralRe: Constructor reading Session Variables Pin
Ian Shlasko8-Sep-10 4:51
Ian Shlasko8-Sep-10 4:51 
GeneralRe: Constructor reading Session Variables Pin
Richard A. Dalton8-Sep-10 5:23
Richard A. Dalton8-Sep-10 5:23 
GeneralRe: Constructor reading Session Variables Pin
CDP18029-Sep-10 0:55
CDP18029-Sep-10 0:55 
GeneralRe: Constructor reading Session Variables Pin
Andrew Rissing9-Sep-10 4:21
Andrew Rissing9-Sep-10 4:21 
GeneralRe: Constructor reading Session Variables Pin
Kunal Chowdhury «IN»11-Sep-10 22:02
professionalKunal Chowdhury «IN»11-Sep-10 22:02 
GeneralWhere is the exit? PinPopular
red_moon6-Sep-10 2:46
red_moon6-Sep-10 2:46 
GeneralRe: Where is the exit? Pin
DaveAuld6-Sep-10 3:16
professionalDaveAuld6-Sep-10 3:16 
GeneralRe: Where is the exit? Pin
red_moon6-Sep-10 6:42
red_moon6-Sep-10 6:42 
AnswerRe: Where is the exit? Pin
Kunal Chowdhury «IN»6-Sep-10 18:46
professionalKunal Chowdhury «IN»6-Sep-10 18:46 
GeneralRe: Where is the exit? Pin
DaveAuld7-Sep-10 23:47
professionalDaveAuld7-Sep-10 23:47 
GeneralRe: Where is the exit? Pin
Kunal Chowdhury «IN»7-Sep-10 23:50
professionalKunal Chowdhury «IN»7-Sep-10 23:50 
GeneralRe: Where is the exit? Pin
phil.o7-Sep-10 0:20
professionalphil.o7-Sep-10 0: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.