Click here to Skip to main content
15,880,651 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: Take care of your TEMP folder! Pin
Bernhard Hiller2-Jun-13 22:56
Bernhard Hiller2-Jun-13 22:56 
GeneralRe: Take care of your TEMP folder! Pin
BobJanova3-Jun-13 0:05
BobJanova3-Jun-13 0:05 
GeneralRe: Take care of your TEMP folder! Pin
Richard Deeming3-Jun-13 2:09
mveRichard Deeming3-Jun-13 2:09 
GeneralMessage Closed Pin
31-May-13 9:10
professionalkburman631-May-13 9:10 
GeneralMessage Closed Pin
31-May-13 10:33
professionalDaveAuld31-May-13 10:33 
GeneralRe: Why do users click randomly and rapidly when an application hangs? Pin
kburman631-May-13 10:36
professionalkburman631-May-13 10:36 
GeneralRe: Why do users click randomly and rapidly when an application hangs? Pin
kburman631-May-13 10:45
professionalkburman631-May-13 10:45 
NewsCatches win matches... they say Pin
tumbledDown2earth30-May-13 4:54
tumbledDown2earth30-May-13 4:54 
Found this in a would be production code today ...


C#
public bool InitializeApp()
{
    // Log

    bool bStatus = false;
    try
    {
        // step 2 :
        try
        {
            DoStep2();
        }
        catch (Exception ex)
        {
            // Log ex
        }

        // step 3 :
        try
        {
            DoStep3();
        }
        catch (Exception ex)
        {
            // Log ex
        }

        // step 4 :
        try
        {
            DoStep4();
        }
        catch (Exception ex)
        {
            // Log ex
        }

        // step 5 :
        try
        {
            DoStep5();
        }
        catch (Exception ex)
        {
            // Log ex
        }

        // step 6 :
        try
        {
            DoStep6();
        }
        catch (Exception ex)
        {
            // Log ex
        }
    }
    catch (Exception eError)
    {
        // Log -- God knows how can some code get in here -- unless a Log exception throws
    }

    return bStatus;
}


Goes without saying that every DoStep method has a try-catchEverything block with log

If I am still missing the point .. its the nested try-catch I am pointing to

Laugh | :laugh:

modified 30-May-13 23:02pm.

GeneralRe: Catches win matches... they say Pin
PIEBALDconsult30-May-13 5:39
mvePIEBALDconsult30-May-13 5:39 
GeneralRe: Catches win matches... they say Pin
Rob Grainger31-May-13 2:58
Rob Grainger31-May-13 2:58 
GeneralRe: Catches win matches... they say PinPopular
PIEBALDconsult31-May-13 4:06
mvePIEBALDconsult31-May-13 4:06 
GeneralRe: Catches win matches... they say Pin
Lutosław4-Jun-13 22:39
Lutosław4-Jun-13 22:39 
GeneralRe: Catches win matches... they say Pin
lewax0030-May-13 5:45
lewax0030-May-13 5:45 
GeneralRe: Catches win matches... they say Pin
AlphaDeltaTheta30-May-13 17:10
AlphaDeltaTheta30-May-13 17:10 
GeneralRe: Catches win matches... they say Pin
Bernhard Hiller30-May-13 21:45
Bernhard Hiller30-May-13 21:45 
GeneralRe: Catches win matches... they say Pin
tumbledDown2earth30-May-13 22:55
tumbledDown2earth30-May-13 22:55 
GeneralRe: Catches win matches... they say Pin
Gaston Verelst20-Jun-13 3:19
Gaston Verelst20-Jun-13 3:19 
GeneralRe: Catches win matches... they say Pin
jbojarczuk20-Jun-13 14:13
jbojarczuk20-Jun-13 14:13 
GeneralC#'s sneaky typedef PinPopular
harold aptroot26-May-13 0:42
harold aptroot26-May-13 0:42 
GeneralRe: C#'s sneaky typedef PinPopular
OriginalGriff26-May-13 1:09
mveOriginalGriff26-May-13 1:09 
GeneralRe: C#'s sneaky typedef Pin
StM0n26-May-13 2:12
StM0n26-May-13 2:12 
GeneralRe: C#'s sneaky typedef Pin
Oshtri Deka26-May-13 21:36
professionalOshtri Deka26-May-13 21:36 
GeneralRe: C#'s sneaky typedef Pin
Gary Wheeler27-May-13 1:21
Gary Wheeler27-May-13 1:21 
GeneralRe: C#'s sneaky typedef Pin
Brisingr Aerowing26-May-13 3:13
professionalBrisingr Aerowing26-May-13 3:13 
QuestionRe: C#'s sneaky typedef Pin
Super Lloyd26-May-13 3:52
Super Lloyd26-May-13 3:52 

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.