Click here to Skip to main content
11,711,537 members (80,575 online)

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.

 
GeneralRe: They grow up so fast.. Pin
jim lahey21-Sep-12 7:10
memberjim lahey21-Sep-12 7:10 
GeneralRe: They grow up so fast.. Pin
Naerling21-Sep-12 22:04
memberNaerling21-Sep-12 22:04 
GeneralRe: They grow up so fast.. Pin
zenwalker19859-Oct-12 18:07
memberzenwalker19859-Oct-12 18:07 
GeneralRe: They grow up so fast.. Pin
jim lahey9-Oct-12 21:49
memberjim lahey9-Oct-12 21:49 
GeneralC# properties and type safety Pin
Julien Villers19-Sep-12 22:31
memberJulien Villers19-Sep-12 22:31 
GeneralRe: C# properties and type safety Pin
Andrei Straut19-Sep-12 22:44
memberAndrei Straut19-Sep-12 22:44 
GeneralRe: C# properties and type safety Pin
Julien Villers20-Sep-12 3:29
memberJulien Villers20-Sep-12 3:29 
GeneralRe: C# properties and type safety Pin
Eddy Vluggen20-Sep-12 5:45
memberEddy Vluggen20-Sep-12 5:45 
GeneralRe: C# properties and type safety Pin
Julien Villers20-Sep-12 8:30
memberJulien Villers20-Sep-12 8:30 
GeneralRe: C# properties and type safety Pin
BobJanova20-Sep-12 6:29
memberBobJanova20-Sep-12 6:29 
GeneralRe: C# properties and type safety Pin
CIDev20-Sep-12 3:57
memberCIDev20-Sep-12 3:57 
GeneralRe: C# properties and type safety Pin
Zac Greve20-Sep-12 5:35
memberZac Greve20-Sep-12 5:35 
GeneralRe: C# properties and type safety Pin
SimulationofSai29-Sep-12 13:42
memberSimulationofSai29-Sep-12 13:42 
GeneralC# Exception handling 101 Pin
Julien Villers19-Sep-12 22:26
memberJulien Villers19-Sep-12 22:26 
Here's a 'nice' pattern I saw in some code I've inherited...

catch (Exception ex)
{
	if (ex is ExceptionSpecialType)
		throw new SomeException()
		{
			CustomData = (ex as ExceptionSpecialType).SomeThing.ToXmlString()
		};
	else
	{
		// <-- Some specific handling removed here -->
		throw new SomeException()
		{
			CustomData = new CustomError(ex).ToXmlString()
		};
	}
}

Oh, and yes, my predecessor loved using 'if (X is T) (X as T).M();'.
'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

GeneralRe: C# Exception handling 101 Pin
Andrei Straut19-Sep-12 22:48
memberAndrei Straut19-Sep-12 22:48 
GeneralRe: C# Exception handling 101 Pin
CIDev20-Sep-12 3:10
memberCIDev20-Sep-12 3:10 
GeneralRe: C# Exception handling 101 Pin
Naerling21-Sep-12 22:01
memberNaerling21-Sep-12 22:01 
GeneralRe: C# Exception handling 101 Pin
Julien Villers23-Sep-12 22:55
memberJulien Villers23-Sep-12 22:55 
GeneralRe: C# Exception handling 101 Pin
Naerling24-Sep-12 8:09
memberNaerling24-Sep-12 8:09 
GeneralRe: C# Exception handling 101 Pin
Jonathan C Dickinson30-Sep-12 21:51
memberJonathan C Dickinson30-Sep-12 21:51 
GeneralRe: C# Exception handling 101 Pin
Julien Villers30-Sep-12 22:23
memberJulien Villers30-Sep-12 22:23 
QuestionWhy? Pin
AspDotNetDev18-Sep-12 15:27
protectorAspDotNetDev18-Sep-12 15:27 
AnswerRe: Why? Pin
PIEBALDconsult18-Sep-12 18:29
memberPIEBALDconsult18-Sep-12 18:29 
GeneralRe: Why? Pin
AspDotNetDev18-Sep-12 18:37
protectorAspDotNetDev18-Sep-12 18:37 
AnswerRe: Why? Pin
Andrei Straut19-Sep-12 1:42
memberAndrei Straut19-Sep-12 1:42 
GeneralRe: Why? Pin
AspDotNetDev19-Sep-12 6:31
protectorAspDotNetDev19-Sep-12 6:31 
AnswerRe: Why? Pin
Chris Meech19-Sep-12 2:18
memberChris Meech19-Sep-12 2:18 
GeneralRe: Why? Pin
AspDotNetDev19-Sep-12 6:33
protectorAspDotNetDev19-Sep-12 6:33 
AnswerRe: Why? Pin
Pete O'Hanlon19-Sep-12 2:38
protectorPete O'Hanlon19-Sep-12 2:38 
GeneralRe: Why? Pin
AspDotNetDev19-Sep-12 6:34
protectorAspDotNetDev19-Sep-12 6:34 
AnswerRe: Why? Pin
Sentenryu19-Sep-12 5:17
memberSentenryu19-Sep-12 5:17 
AnswerRe: Why? Pin
Sentenryu19-Sep-12 6:43
memberSentenryu19-Sep-12 6:43 
AnswerWe have a winner! Pin
AspDotNetDev19-Sep-12 7:11
protectorAspDotNetDev19-Sep-12 7:11 
JokeThank god the else part is not the same! Pin
VallarasuS12-Sep-12 22:55
memberVallarasuS12-Sep-12 22:55 
GeneralRe: Thank god the else part is not the same! Pin
Zac Greve13-Sep-12 16:42
memberZac Greve13-Sep-12 16:42 
GeneralRe: Thank god the else part is not the same! Pin
Bernhard Hiller13-Sep-12 21:15
memberBernhard Hiller13-Sep-12 21:15 
GeneralRe: Thank god the else part is not the same! Pin
CIDev19-Sep-12 7:30
memberCIDev19-Sep-12 7:30 
GeneralRe: Thank god the else part is not the same! Pin
Pete O'Hanlon19-Sep-12 9:20
protectorPete O'Hanlon19-Sep-12 9:20 
RantWhat the hell is wrong with people today? Pin
Andrei Straut12-Sep-12 21:59
memberAndrei Straut12-Sep-12 21:59 
GeneralRe: What the hell is wrong with people today? Pin
Zac Greve14-Sep-12 2:53
memberZac Greve14-Sep-12 2:53 
GeneralRe: What the hell is wrong with people today? Pin
Andrei Straut14-Sep-12 11:22
memberAndrei Straut14-Sep-12 11:22 
GeneralContact Us - here, have our email addresses Pin
enhzflep30-Aug-12 15:53
memberenhzflep30-Aug-12 15:53 
GeneralRe: Contact Us - here, have our email addresses Pin
Zac Greve30-Aug-12 17:19
memberZac Greve30-Aug-12 17:19 
JokeRe: Contact Us - here, have our email addresses Pin
Peter_in_278030-Aug-12 17:20
memberPeter_in_278030-Aug-12 17:20 
GeneralRe: Contact Us - here, have our email addresses (message sent to Lonmin) Pin
enhzflep30-Aug-12 23:46
memberenhzflep30-Aug-12 23:46 
GeneralRe: Contact Us - here, have our email addresses (message sent to Lonmin) Pin
SoMad31-Aug-12 11:21
memberSoMad31-Aug-12 11:21 
GeneralRe: Contact Us - here, have our email addresses (message sent to Lonmin) Pin
enhzflep3-Sep-12 15:20
memberenhzflep3-Sep-12 15:20 
GeneralRe: Contact Us - here, have our email addresses Pin
PIEBALDconsult30-Aug-12 18:54
memberPIEBALDconsult30-Aug-12 18:54 
GeneralRe: Contact Us - here, have our email addresses Pin
Bernhard Hiller30-Aug-12 21:24
memberBernhard Hiller30-Aug-12 21:24 
GeneralRe: Contact Us - here, have our email addresses Pin
ekolis31-Aug-12 11:14
memberekolis31-Aug-12 11:14 

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

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


Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 1 Sep 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid