Click here to Skip to main content

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.. Pinmemberjim lahey21-Sep-12 7:10 
GeneralRe: They grow up so fast.. PinmemberNaerling21-Sep-12 22:04 
GeneralRe: They grow up so fast.. Pinmemberzenwalker19859-Oct-12 18:07 
GeneralRe: They grow up so fast.. Pinmemberjim lahey9-Oct-12 21:49 
GeneralC# properties and type safety PinmemberJulien Villers19-Sep-12 22:31 
GeneralRe: C# properties and type safety PinmemberAndrei Straut19-Sep-12 22:44 
GeneralRe: C# properties and type safety PinmemberJulien Villers20-Sep-12 3:29 
GeneralRe: C# properties and type safety PinmemberEddy Vluggen20-Sep-12 5:45 
GeneralRe: C# properties and type safety PinmemberJulien Villers20-Sep-12 8:30 
GeneralRe: C# properties and type safety PinmemberBobJanova20-Sep-12 6:29 
GeneralRe: C# properties and type safety [modified] PinmemberCIDev20-Sep-12 3:57 
GeneralRe: C# properties and type safety PinmemberZac Greve20-Sep-12 5:35 
GeneralRe: C# properties and type safety PinmemberSimulationofSai29-Sep-12 13:42 
GeneralC# Exception handling 101 PinmemberJulien 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 PinmemberAndrei Straut19-Sep-12 22:48 
GeneralRe: C# Exception handling 101 PinmemberCIDev20-Sep-12 3:10 
GeneralRe: C# Exception handling 101 PinmemberNaerling21-Sep-12 22:01 
GeneralRe: C# Exception handling 101 PinmemberJulien Villers23-Sep-12 22:55 
GeneralRe: C# Exception handling 101 PinmemberNaerling24-Sep-12 8:09 
GeneralRe: C# Exception handling 101 PinmemberJonathan C Dickinson30-Sep-12 21:51 
GeneralRe: C# Exception handling 101 PinmemberJulien Villers30-Sep-12 22:23 
QuestionWhy? PinprotectorAspDotNetDev18-Sep-12 15:27 
AnswerRe: Why? PinmemberPIEBALDconsult18-Sep-12 18:29 
GeneralRe: Why? PinprotectorAspDotNetDev18-Sep-12 18:37 
AnswerRe: Why? PinmemberAndrei Straut19-Sep-12 1:42 
GeneralRe: Why? PinprotectorAspDotNetDev19-Sep-12 6:31 
AnswerRe: Why? PinmemberChris Meech19-Sep-12 2:18 
GeneralRe: Why? PinprotectorAspDotNetDev19-Sep-12 6:33 
AnswerRe: Why? PinprotectorPete O'Hanlon19-Sep-12 2:38 
GeneralRe: Why? PinprotectorAspDotNetDev19-Sep-12 6:34 
AnswerRe: Why? PinmemberSentenryu19-Sep-12 5:17 
AnswerRe: Why? PinmemberSentenryu19-Sep-12 6:43 
AnswerWe have a winner! PinprotectorAspDotNetDev19-Sep-12 7:11 
JokeThank god the else part is not the same! [modified] PinmemberVallarasuS12-Sep-12 22:55 
GeneralRe: Thank god the else part is not the same! PinmemberZac Greve13-Sep-12 16:42 
GeneralRe: Thank god the else part is not the same! PinmemberBernhard Hiller13-Sep-12 21:15 
GeneralRe: Thank god the else part is not the same! PinmemberCIDev19-Sep-12 7:30 
GeneralRe: Thank god the else part is not the same! PinprotectorPete O'Hanlon19-Sep-12 9:20 
RantWhat the hell is wrong with people today? PinmemberAndrei Straut12-Sep-12 21:59 
GeneralRe: What the hell is wrong with people today? PinmemberZac Greve14-Sep-12 2:53 
GeneralRe: What the hell is wrong with people today? PinmemberAndrei Straut14-Sep-12 11:22 
GeneralContact Us - here, have our email addresses Pinmemberenhzflep30-Aug-12 15:53 
GeneralRe: Contact Us - here, have our email addresses PinmemberZac Greve30-Aug-12 17:19 
JokeRe: Contact Us - here, have our email addresses PinmemberPeter_in_278030-Aug-12 17:20 
GeneralRe: Contact Us - here, have our email addresses (message sent to Lonmin) [modified] Pinmemberenhzflep30-Aug-12 23:46 
GeneralRe: Contact Us - here, have our email addresses (message sent to Lonmin) PinmemberSoMad31-Aug-12 11:21 
GeneralRe: Contact Us - here, have our email addresses (message sent to Lonmin) Pinmemberenhzflep3-Sep-12 15:20 
GeneralRe: Contact Us - here, have our email addresses PinmemberPIEBALDconsult30-Aug-12 18:54 
GeneralRe: Contact Us - here, have our email addresses PinmemberBernhard Hiller30-Aug-12 21:24 
GeneralRe: Contact Us - here, have our email addresses Pinmemberekolis31-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
Web02 | 2.8.141029.1 | Last Updated 30 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid