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

|
Sigh.public string ReadFile(string filename)
{
string contents = null;
try
{
contents = File.ReadAllText(filename);
}
catch
{
contents = File.ReadAllText(filename);
}
finally
{
contents = File.ReadAllText(filename);
}
return contents;
}Okay. Everybody happy now?
Software Zen: delete this;
|
|
|
|

|
Quitter - use recursion!
public string ReadFile(string filename)
{
try
{
return File.ReadAllText(filename);
}
catch
{
return ReadFile(filename);
}
}
Life is like a s**t sandwich; the more bread you have, the less s**t you eat.
|
|
|
|

|
brisingr@gryphon-pc$ cpmsg --process --msg "4433493" --forum "The Weird and The Wonderful" --code "Process"
ERROR: StackOverflowException was encountered.
brisingr@gryphon-pc$|
Bob Dole The internet is a great way to get on the net.
 2.0.82.7292 SP6a
|
|
|
|

|
Maybe we need a more flippant programming language, for those of us who think like this:
try
{
// something
}
ifatfirstyoudontsucceed
{
// try again
}
thirdtimelucky
{
// and again
}
giveup // synonym for catch
{
// error handling
}
finally
{
// tidying up
}
|
|
|
|

|
Bernhard Hiller wrote: three is the magic number
It sure is!
Monty Python :
First shalt thou take out the Holy Pin.
Then, shalt thou count to three, no more, no less.
Three shalt be the number thou shalt count, and the number of the counting shall be three.
Four shalt thou not count, nor either count thou two, excepting that thou then proceed to three.
Five is right out.
Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who, being naughty in my sight, shall snuff it."
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|

|
I like it. Another opportunity to bill the client.
|
|
|
|
|

|
When I was programming that, I thought: "It's in a catch block, then it can't throw an error!"
ProgramFOX
|
|
|
|

|
Mmmm... you seem determined to read that file, is it important?
|
|
|
|
 |
|
|
General
News
Suggestion
Question
Bug
Answer
Joke
Rant
Admin