Click here to Skip to main content
15,886,963 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: Tales from the Crypt Pin
Jon McKee16-Jan-17 9:17
professionalJon McKee16-Jan-17 9:17 
GeneralRe: Tales from the Crypt Pin
Foothill12-Jan-17 11:35
professionalFoothill12-Jan-17 11:35 
GeneralRe: Tales from the Crypt Pin
Wastedtalent13-Jan-17 3:36
professionalWastedtalent13-Jan-17 3:36 
GeneralRe: Tales from the Crypt Pin
Gerry Schmitz16-Jan-17 8:29
mveGerry Schmitz16-Jan-17 8:29 
GeneralRe: Tales from the Crypt Pin
KarstenK26-Jan-17 0:57
mveKarstenK26-Jan-17 0:57 
GeneralRe: Tales from the Crypt Pin
cjb11012-Feb-17 21:09
cjb11012-Feb-17 21:09 
GeneralRe: Tales from the Crypt Pin
Marc Clifton13-Feb-17 5:24
mvaMarc Clifton13-Feb-17 5:24 
GeneralLet's call him J. S. Crypt Pin
Marc Clifton11-Jan-17 2:43
mvaMarc Clifton11-Jan-17 2:43 
...because his code (yes, I know it's a "he") and style reminds me of stuff I've seen in Javascript and other script languages.
public void Foo()
        {
            var SomeList = new ArrayList();
            SomeList = getSomeList();

            if (SomeList.Count != 0)
            {
                foreach (string Item in SomeList)
                {
                    var S = Item.Split(',');
                    var S0 = s[0];
                    var S1 = s[1];
                    var S2 = s[2];
                    var S3 = s[3];
                ...
                }
           }
     }

     private static ArrayList getSomeList()
     {
        var List = new ArrayList();
        ...
        List.Add(N1 + "," + N2 + "," + N3 + "," + N3);
        ...
        return List;
     }

Variable names have for the most part been changed to protect the innocent.

Things that got me laughing, cringing, and crying:
  1. Useless initialization of SomeList
  2. Well, if the count is 0, the foreach won't execute
  3. Obviously never heard of out variables, or even returning a struct/class with the parsed data. Instead, he creates a concatenated string, then parses it back out! And not exactly internationalized, the chaos that would occur if one or more of the numbers was 1234,56
  4. Why a static method? It's referenced once, in the above call.
And this is just the beginning!

(I do believe this code was written in the .NET 2.0 days before generics -- I have other clues to that -- but that's no excuse.)

Marc
V.A.P.O.R.ware - Visual Assisted Programming / Organizational Representation

Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny

Artificial intelligence is the only remedy for natural stupidity. - CDP1802

GeneralRe: Let's call him J. S. Crypt Pin
Richard Deeming11-Jan-17 3:01
mveRichard Deeming11-Jan-17 3:01 
GeneralRe: Let's call him J. S. Crypt Pin
Marc Clifton11-Jan-17 3:54
mvaMarc Clifton11-Jan-17 3:54 
GeneralRe: Let's call him J. S. Crypt Pin
F-ES Sitecore11-Jan-17 4:14
professionalF-ES Sitecore11-Jan-17 4:14 
GeneralRe: Let's call him J. S. Crypt Pin
megaadam11-Jan-17 3:28
professionalmegaadam11-Jan-17 3:28 
GeneralRe: Let's call him J. S. Crypt Pin
Kornfeld Eliyahu Peter11-Jan-17 3:29
professionalKornfeld Eliyahu Peter11-Jan-17 3:29 
GeneralRe: Let's call him J. S. Crypt Pin
Jörgen Andersson11-Jan-17 3:46
professionalJörgen Andersson11-Jan-17 3:46 
GeneralRe: Let's call him J. S. Crypt Pin
Marc Clifton11-Jan-17 3:52
mvaMarc Clifton11-Jan-17 3:52 
GeneralRe: Let's call him J. S. Crypt Pin
den2k8811-Jan-17 4:10
professionalden2k8811-Jan-17 4:10 
GeneralRe: Let's call him J. S. Crypt Pin
Jörgen Andersson11-Jan-17 4:29
professionalJörgen Andersson11-Jan-17 4:29 
GeneralRe: Let's call him J. S. Crypt Pin
Paulo Zemek11-Jan-17 6:03
mvaPaulo Zemek11-Jan-17 6:03 
GeneralRe: Let's call him J. S. Crypt Pin
Jon McKee11-Jan-17 6:14
professionalJon McKee11-Jan-17 6:14 
GeneralRe: Let's call him J. S. Crypt Pin
Paulo Zemek11-Jan-17 10:57
mvaPaulo Zemek11-Jan-17 10:57 
GeneralRe: Let's call him J. S. Crypt Pin
Marc Clifton14-Jan-17 10:39
mvaMarc Clifton14-Jan-17 10:39 
GeneralRe: Let's call him J. S. Crypt Pin
Paulo Zemek14-Jan-17 11:14
mvaPaulo Zemek14-Jan-17 11:14 
GeneralRe: Let's call him J. S. Crypt Pin
mbb0111-Jan-17 22:47
mbb0111-Jan-17 22:47 
GeneralRe: Let's call him J. S. Crypt Pin
Mike Marynowski12-Jan-17 1:15
professionalMike Marynowski12-Jan-17 1:15 
GeneralRe: Let's call him J. S. Crypt Pin
PIEBALDconsult12-Jan-17 2:44
mvePIEBALDconsult12-Jan-17 2:44 

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.