Click here to Skip to main content
11,433,170 members (63,498 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: #region Pin
tgrt11-Apr-14 4:58
membertgrt11-Apr-14 4:58 
GeneralRe: #region Pin
OriginalGriff11-Apr-14 6:41
protectorOriginalGriff11-Apr-14 6:41 
GeneralRe: #region Pin
Bernhard Hiller13-Apr-14 21:40
professionalBernhard Hiller13-Apr-14 21:40 
GeneralRe: #region Pin
OriginalGriff13-Apr-14 22:00
protectorOriginalGriff13-Apr-14 22:00 
GeneralRe: #region Pin
Brisingr Aerowing11-Apr-14 6:46
professionalBrisingr Aerowing11-Apr-14 6:46 
GeneralRe: #region Pin
Shameel21-Apr-14 1:57
memberShameel21-Apr-14 1:57 
GeneralRe: #region Pin
BobJanova11-Apr-14 7:51
memberBobJanova11-Apr-14 7:51 
GeneralRe: #region Pin
Richard Andrew x6411-Apr-14 9:29
professionalRichard Andrew x6411-Apr-14 9:29 
JokeRe: #region Pin
Sander Rossel24-Apr-14 8:33
memberSander Rossel24-Apr-14 8:33 
GeneralRe: #region Pin
Giuseppe Tollini24-May-14 2:05
memberGiuseppe Tollini24-May-14 2:05 
GeneralRe: #region Pin
Bernhard Hiller29-May-14 21:59
professionalBernhard Hiller29-May-14 21:59 
GeneralHow not to create an instance of a singleton Pin
Dennis_E11-Apr-14 0:59
professionalDennis_E11-Apr-14 0:59 
JokeRe: How not to create an instance of a singleton Pin
Nicholas Marty11-Apr-14 1:25
professionalNicholas Marty11-Apr-14 1:25 
GeneralRe: How not to create an instance of a singleton Pin
Marc Clifton11-Apr-14 2:40
protectorMarc Clifton11-Apr-14 2:40 
Which of course is used like this:

SingletonClass myVerySingletonClass = (new SingletonClass()).getInstance();

or even better:

SingletonClass anInstanceThatWeDontUse = new SingletoneClass();
SingletonClass useThisInstead = anInstanceThatWeDontUse.getInstance();

Good stuff! Laugh | :laugh:

On the other hand, I actually have written code similar to this, except I don't call it a singleton of course. Granted, it's smelly code.

Quiz: What might be the reason to provide a static method that returns an instance of the class, when you know that there will ever only be one instance?

Marc
GeneralRe: How not to create an instance of a singleton Pin
Nicholas Marty11-Apr-14 4:16
professionalNicholas Marty11-Apr-14 4:16 
GeneralRe: How not to create an instance of a singleton Pin
Marc Clifton11-Apr-14 5:52
protectorMarc Clifton11-Apr-14 5:52 
GeneralRe: How not to create an instance of a singleton Pin
Dennis_E24-Apr-14 2:16
professionalDennis_E24-Apr-14 2:16 
GeneralRe: How not to create an instance of a singleton Pin
Nicholas Marty24-Apr-14 4:20
professionalNicholas Marty24-Apr-14 4:20 
GeneralRe: How not to create an instance of a singleton Pin
BobJanova11-Apr-14 7:50
memberBobJanova11-Apr-14 7:50 
GeneralRe: How not to create an instance of a singleton Pin
Bernhard Hiller11-Apr-14 3:21
professionalBernhard Hiller11-Apr-14 3:21 
GeneralRe: How not to create an instance of a singleton Pin
OriginalGriff11-Apr-14 6:42
protectorOriginalGriff11-Apr-14 6:42 
GeneralRe: How not to create an instance of a singleton Pin
Jacek Gajek29-Apr-14 11:51
memberJacek Gajek29-Apr-14 11:51 
GeneralThere is nothing new under the sun... Pin
Duncan Edwards Jones9-Apr-14 8:22
professionalDuncan Edwards Jones9-Apr-14 8:22 
GeneralRe: There is nothing new under the sun... Pin
I.explore.code9-Apr-14 8:41
memberI.explore.code9-Apr-14 8:41 
GeneralRe: There is nothing new under the sun... Pin
Chris Maunder9-Apr-14 8:55
adminChris Maunder9-Apr-14 8:55 
GeneralRe: There is nothing new under the sun... Pin
Kornfeld Eliyahu Peter9-Apr-14 11:05
professionalKornfeld Eliyahu Peter9-Apr-14 11:05 
GeneralRe: There is nothing new under the sun... Pin
Rob Grainger11-Apr-14 0:30
memberRob Grainger11-Apr-14 0:30 
GeneralRe: There is nothing new under the sun... Pin
Duncan Edwards Jones11-Apr-14 0:49
professionalDuncan Edwards Jones11-Apr-14 0:49 
GeneralRe: There is nothing new under the sun... Pin
Sander Rossel24-Apr-14 8:42
memberSander Rossel24-Apr-14 8:42 
GeneralHow not to do transaction processing Pin
Rob Grainger9-Apr-14 7:12
memberRob Grainger9-Apr-14 7:12 
GeneralRe: How not to do transaction processing Pin
Duncan Edwards Jones9-Apr-14 8:13
professionalDuncan Edwards Jones9-Apr-14 8:13 
GeneralRe: How not to do transaction processing Pin
Rob Grainger10-Apr-14 5:12
memberRob Grainger10-Apr-14 5:12 
GeneralRe: How not to do transaction processing Pin
W Balboos11-Apr-14 2:14
memberW Balboos11-Apr-14 2:14 
GeneralRe: How not to do transaction processing Pin
clawton9-Apr-14 13:30
memberclawton9-Apr-14 13:30 
GeneralRe: How not to do transaction processing Pin
BobJanova10-Apr-14 0:39
memberBobJanova10-Apr-14 0:39 
GeneralRe: How not to do transaction processing Pin
Rob Grainger10-Apr-14 5:14
memberRob Grainger10-Apr-14 5:14 
RantI just can't take it no more! Pin
Super Lloyd9-Apr-14 1:10
memberSuper Lloyd9-Apr-14 1:10 
GeneralRe: I just can't take it no more! Pin
Duncan Edwards Jones9-Apr-14 1:20
professionalDuncan Edwards Jones9-Apr-14 1:20 
GeneralRe: I just can't take it no more! Pin
Sentenryu9-Apr-14 1:23
memberSentenryu9-Apr-14 1:23 
GeneralRe: I just can't take it no more! Pin
Duncan Edwards Jones9-Apr-14 1:42
professionalDuncan Edwards Jones9-Apr-14 1:42 
GeneralRe: I just can't take it no more! Pin
Sentenryu9-Apr-14 2:13
memberSentenryu9-Apr-14 2:13 
GeneralRe: I just can't take it no more! Pin
Duncan Edwards Jones9-Apr-14 2:21
professionalDuncan Edwards Jones9-Apr-14 2:21 
GeneralRe: I just can't take it no more! Pin
Super Lloyd9-Apr-14 16:11
memberSuper Lloyd9-Apr-14 16:11 
GeneralRe: I just can't take it no more! Pin
Sentenryu10-Apr-14 1:43
memberSentenryu10-Apr-14 1:43 
GeneralRe: I just can't take it no more! Pin
RyanDev9-Apr-14 2:24
mvpRyanDev9-Apr-14 2:24 
GeneralRe: I just can't take it no more! Pin
PIEBALDconsult9-Apr-14 4:15
memberPIEBALDconsult9-Apr-14 4:15 
GeneralRe: I just can't take it no more! Pin
Super Lloyd9-Apr-14 16:12
memberSuper Lloyd9-Apr-14 16:12 
GeneralRe: I just can't take it no more! Pin
V.11-Apr-14 1:00
professionalV.11-Apr-14 1:00 
GeneralRe: I just can't take it no more! Pin
Super Lloyd12-Apr-14 20:28
memberSuper Lloyd12-Apr-14 20:28 
GeneralRe: I just can't take it no more! Pin
Super Lloyd12-Apr-14 20:30
memberSuper Lloyd12-Apr-14 20:30 

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
Web04 | 2.8.150428.2 | Last Updated 5 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid