Click here to Skip to main content
12,763,299 members (37,203 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, 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.

 
GeneralAh the joys of working in a team Pin
Argonia21-Jan-14 2:49
memberArgonia21-Jan-14 2:49 
GeneralRe: Ah the joys of working in a team Pin
JMK8921-Jan-14 3:03
professionalJMK8921-Jan-14 3:03 
GeneralRe: Ah the joys of working in a team Pin
Argonia21-Jan-14 3:14
memberArgonia21-Jan-14 3:14 
GeneralRe: Ah the joys of working in a team Pin
Freak3022-Jan-14 2:25
memberFreak3022-Jan-14 2:25 
GeneralRe: Ah the joys of working in a team Pin
Ravi Bhavnani21-Jan-14 3:37
professionalRavi Bhavnani21-Jan-14 3:37 
GeneralRe: Ah the joys of working in a team Pin
Shameel21-Jan-14 4:23
memberShameel21-Jan-14 4:23 
GeneralRe: Ah the joys of working in a team Pin
Ravi Bhavnani21-Jan-14 5:58
professionalRavi Bhavnani21-Jan-14 5:58 
GeneralAnother gem from the VB6 code I'm "porting" Pin
Rob Grainger17-Jan-14 0:25
memberRob Grainger17-Jan-14 0:25 
In one function, the following is used to call SomeFunc (names changed to protect the guilty):

If UCase(SomeFunc("" & int_var, bool_var)) = "YES" Then
    F.chkBox.Value = 1
Else 
    F.chkBox.Value = 0
End If


(with two more calls to the same function further down).

Where F is a form variable (because frm would be too hard to type)
Looking at the definition...

Private Function SomeFunc(Result As Long, Optional cond As Boolean) As String
    If cond = True Then
        Select Case (Result)
            Case Is < 3
                SomeFunc = "No"
            Case Is > 2
                SomeFunc = "Yes"
        End Select
        
    Else
        Select Case (Result)
            Case 1
                SomeFunc = "No"
            Case Is >= 2
                SomeFunc = "Yes"
        End Select
    End If
End Function


Why use a Boolean when a string comparison, case conversion and check for null string will do?
Why is that Boolean argument optional, when it is always supplied?

(before someone says, predictably, that the real WTF is VB, I'd like to point out I've seen code just as horrible in most languages.
The real real WTF is that people who produce such garbage are still employed.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.

GeneralRe: Another gem from the VB6 code I'm "porting" Pin
NormDroid17-Jan-14 0:51
professionalNormDroid17-Jan-14 0:51 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Rob Grainger17-Jan-14 1:01
memberRob Grainger17-Jan-14 1:01 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Chris Quinn17-Jan-14 4:11
memberChris Quinn17-Jan-14 4:11 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Rob Grainger17-Jan-14 4:16
memberRob Grainger17-Jan-14 4:16 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Richard Deeming17-Jan-14 2:33
professionalRichard Deeming17-Jan-14 2:33 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Rob Grainger17-Jan-14 4:10
memberRob Grainger17-Jan-14 4:10 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Richard Deeming17-Jan-14 4:35
professionalRichard Deeming17-Jan-14 4:35 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Ron Beyer17-Jan-14 5:48
mvpRon Beyer17-Jan-14 5:48 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Freak3020-Jan-14 0:41
memberFreak3020-Jan-14 0:41 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Sentenryu20-Jan-14 5:00
memberSentenryu20-Jan-14 5:00 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Marc Clifton21-Jan-14 3:12
protectorMarc Clifton21-Jan-14 3:12 
GeneralA backslash in C++ Pin
Tsuda Kageyu14-Jan-14 21:56
memberTsuda Kageyu14-Jan-14 21:56 
GeneralRe: A backslash in C++ Pin
Duncan Edwards Jones14-Jan-14 22:02
memberDuncan Edwards Jones14-Jan-14 22:02 
GeneralRe: A backslash in C++ Pin
Bernhard Hiller14-Jan-14 22:04
professionalBernhard Hiller14-Jan-14 22:04 
GeneralRe: A backslash in C++ Pin
Tsuda Kageyu14-Jan-14 22:13
memberTsuda Kageyu14-Jan-14 22:13 
GeneralRe: A backslash in C++ Pin
Bernhard Hiller14-Jan-14 22:44
professionalBernhard Hiller14-Jan-14 22:44 
GeneralRe: A backslash in C++ Pin
Nicholas Marty15-Jan-14 1:43
professionalNicholas Marty15-Jan-14 1:43 

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.


Advertise | Privacy | Mobile
Web01 | 2.8.170217.1 | Last Updated 27 Feb 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid