Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Worst source code EVER

Worst source code EVER

Scheduled Pinned Locked Moved The Lounge
questioncareer
54 Posts 41 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Brian C HartB Brian C Hart

    Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

    Sincerely Yours, Brian Hart

    K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #15

    I did FoxPro for many years. FoxPro is NOT strongly typed and allows public variables. Most experienced developers never use them for obvious reasons. I worked on one very large app that had over a hundred public variables. In some of the modules would be private variables of the same name that simple copied the public value into it:

    PUBLIC SomeVar
    SomeVar = DATETIME()
    .
    .
    .

    then later elsewhere

    FUNCTION XYX()
    PRIVATE someVar
    someVar = SomeVar.

    IF x = 1
    someVar = 10
    ENDIF

    ENDFUNC

    Simple example, but there were hundreds of these public/private combinations all over the app, and you had no idea what was in a variable until you stepped through it or it crashed.

    Everything makes sense in someone's mind

    1 Reply Last reply
    0
    • Brian C HartB Brian C Hart

      Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

      Sincerely Yours, Brian Hart

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #16

      C++ class, one class, that had the following attributes. - 20,000+ lines of code - 200+ data members - 200+ methods - spanned at least 3 files not including .h file.

      1 Reply Last reply
      0
      • E ekolis

        A month or two ago I got to see this Java codebase that I was supposed to work on; whoever wrote it apparently was a fan of this incredibly awesome (NOT!) paradigm I like to call "Hashtable Oriented Programming"... Basically, all business-tier classes implement a BusinessObject interface, which contains four methods: loadFromDb, saveToDb, a third one I can't remember, and the infamous getHashtable... The classes themselves do indeed implement these methods... and nothing else - no bean-style getters or setters! That's right, a Loan object has the exact same structure as a Realtor object; the only difference is the convention of "which keys do we stick in the hashtable?" It's almost as if they were trying to implement some sort of dynamically typed language on top of Java... just with none of the advantages, and all of the disadvantages! Thankfully I've been transferred to another project, so I don't have to mess with that nonsense! edit: Now I remember what the third method was... it was isInDb! This method was implemented rather... erratically, one might say: several of the classes implemented it by executing "select count(*) from theTable" and comparing to zero; if the count was not zero, the object was "in" the database! And no, I doubt that there were all THAT many "singleton tables" in the DB!

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #17

        ekolis wrote:

        It's almost as if they were trying to implement some sort of dynamically typed language on top of Java

        Probably exactly that except they didn't know that was what they were doing. They thought they were 'generalizing' it and making it more 'maintainable'. I see designs like that quite often in database layers.

        1 Reply Last reply
        0
        • W wizardzz

          In over a year at my current job I have not come across a single line of documentation or comments. Thousands upon thousands of lines of code. 20+ projects.

          "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson My comedy.

          N Offline
          N Offline
          Nueman
          wrote on last edited by
          #18

          When I interviewed for my current job and I was pointedly and specifically asked about documentation I knew what I was in for. Sure enough, none of the apps my predecessor wrote were documented. He was too good to document.

          You keep using that word. I do not think it means what you think it means.

          1 Reply Last reply
          0
          • E ekolis

            A month or two ago I got to see this Java codebase that I was supposed to work on; whoever wrote it apparently was a fan of this incredibly awesome (NOT!) paradigm I like to call "Hashtable Oriented Programming"... Basically, all business-tier classes implement a BusinessObject interface, which contains four methods: loadFromDb, saveToDb, a third one I can't remember, and the infamous getHashtable... The classes themselves do indeed implement these methods... and nothing else - no bean-style getters or setters! That's right, a Loan object has the exact same structure as a Realtor object; the only difference is the convention of "which keys do we stick in the hashtable?" It's almost as if they were trying to implement some sort of dynamically typed language on top of Java... just with none of the advantages, and all of the disadvantages! Thankfully I've been transferred to another project, so I don't have to mess with that nonsense! edit: Now I remember what the third method was... it was isInDb! This method was implemented rather... erratically, one might say: several of the classes implemented it by executing "select count(*) from theTable" and comparing to zero; if the count was not zero, the object was "in" the database! And no, I doubt that there were all THAT many "singleton tables" in the DB!

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #19

            ekolis wrote:

            "which keys do we stick in the hashtable?"

            Sounds like a fan of Perl.

            1 Reply Last reply
            0
            • Brian C HartB Brian C Hart

              Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

              Sincerely Yours, Brian Hart

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #20

              Probably the VB.net I had to work on last year... but there was also the this C code I wrote back in '94...

              #define begin {
              #define end }
              #define then /**/
              #define mod %
              #define and &&
              #define or ||

              :-O

              J 1 Reply Last reply
              0
              • Brian C HartB Brian C Hart

                Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

                Sincerely Yours, Brian Hart

                R Offline
                R Offline
                Ravi Sant
                wrote on last edited by
                #21

                For me, Worst code I see everyday is Catch block with no statements

                // ♫ 99 little bugs in the code, // 99 bugs in the code // We fix a bug, compile it again // 101 little bugs in the code ♫

                J P 2 Replies Last reply
                0
                • Brian C HartB Brian C Hart

                  Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

                  Sincerely Yours, Brian Hart

                  P Offline
                  P Offline
                  pt1401
                  wrote on last edited by
                  #22

                  At the least the code written for the Obfustacted Perl Contest was intentionally awful. Here's an example :-

                  @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
                  @p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
                  ($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
                  close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print

                  Looks more like a dump of compiled code than source...

                  1 Reply Last reply
                  0
                  • Brian C HartB Brian C Hart

                    Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

                    Sincerely Yours, Brian Hart

                    J Offline
                    J Offline
                    Jorgen Sigvardsson
                    wrote on last edited by
                    #23

                    I was hired to port a case management system for intellectual properties (patents, trademarks, etc) to Java/EE. It was written in Power Basic (Sybase 3.5 GL language) by someone who learned programming in C64 basic. I have not seen such clutter before in my life. I found huge blocks of code that literally could've been removed, countless dependencies on global variables, ugly SQL (they often stored their queries in the database - WTF?). Such a mess. I still have nightmares. On several occasions, my design decisions were overridden by their management. One case involved user role management. I proposed the standard role/object/model that is well understood. They agreed, but refused to understand basic set theory. An empty set of access rights would mean "all access to everything" according to them. I responded that is a bad idea, and makes security administration overly complex, and potentially insecure. They would not understand (even after countless of negative use cases). I implemented their stupid ideas. Later on they did not want to pay for my work on the role management, because "it was implemented badly". WTF? They said I did not implement it according to their specifications. Guess what? The "specifications" was my original design! I told them I don't do business with liars, and we went to court. I got half in a settlement. If I had wanted 100% of what they owed, the case would've taken at least one more year. I don't want to spend time in court, I want to create, so I grabbed the 50% and vowed to myself not to fall into that trap again. I was screwed royally on that gig. Code wise and business wise. I have also encountered code for an installer driver that was spaghetti in several dimensions. Structure wise, and thread wise! The code had bugs that the original authors could not track down in 6 months. I spent two weeks with a colleague trying to track it down. I just gave up and kept bugging the management until I was approved to ditch the code, and rewrite it. It turned out that another division in the company had written a really good installer driver, so the story had a good ending!

                    -- Kein Mitleid Für Die Mehrheit

                    R 1 Reply Last reply
                    0
                    • R Ravi Sant

                      For me, Worst code I see everyday is Catch block with no statements

                      // ♫ 99 little bugs in the code, // 99 bugs in the code // We fix a bug, compile it again // 101 little bugs in the code ♫

                      J Offline
                      J Offline
                      Jorgen Sigvardsson
                      wrote on last edited by
                      #24

                      I think they are excellent. They weed out the pros from the wannabes. Just fire the wannabes, and hire new people. Continue until all empty catch blocks are gone!

                      -- Kein Mitleid Für Die Mehrheit

                      1 Reply Last reply
                      0
                      • P PIEBALDconsult

                        Probably the VB.net I had to work on last year... but there was also the this C code I wrote back in '94...

                        #define begin {
                        #define end }
                        #define then /**/
                        #define mod %
                        #define and &&
                        #define or ||

                        :-O

                        J Offline
                        J Offline
                        Jorgen Sigvardsson
                        wrote on last edited by
                        #25

                        I think I know what your first programming language is... :-D

                        -- Kein Mitleid Für Die Mehrheit

                        P 1 Reply Last reply
                        0
                        • Brian C HartB Brian C Hart

                          Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

                          Sincerely Yours, Brian Hart

                          G Offline
                          G Offline
                          Gary R Wheeler
                          wrote on last edited by
                          #26

                          When I first started my current job, I was hired as a contractor to help the guy currently on the project. Talking to him, he sounded fairly sharp, if a little vague at times. After I found something that looked like this:

                          #define ENDCAS1 case 23: \
                          DoThing();\
                          break;\
                          case 36:\
                          DoThing2();\
                          break;\
                          default:\
                          DoThing3();\

                          switch (operation)
                          {
                          case 1:
                          DoThis();
                          break;
                          case 14:
                          DoThat();
                          ENDCAS1
                          }

                          in his code, I knew better.

                          Software Zen: delete this;

                          1 Reply Last reply
                          0
                          • Brian C HartB Brian C Hart

                            Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

                            Sincerely Yours, Brian Hart

                            G Offline
                            G Offline
                            Ger Hayden
                            wrote on last edited by
                            #27

                            Code that forced Oracle tables to behave like ISAM files

                            Ger

                            V 1 Reply Last reply
                            0
                            • R Ravi Sant

                              For me, Worst code I see everyday is Catch block with no statements

                              // ♫ 99 little bugs in the code, // 99 bugs in the code // We fix a bug, compile it again // 101 little bugs in the code ♫

                              P Offline
                              P Offline
                              PIEBALDconsult
                              wrote on last edited by
                              #28

                              Oh, yeah, on the assignment I just started there are lots of those... :sigh: One in particular is around an access to a Dictionary -- in case the key doesn't exist I guess. Personally, I'd check with ContainsKey, but not the guy who wrote this.

                              1 Reply Last reply
                              0
                              • J Jorgen Sigvardsson

                                I think I know what your first programming language is... :-D

                                -- Kein Mitleid Für Die Mehrheit

                                P Offline
                                P Offline
                                PIEBALDconsult
                                wrote on last edited by
                                #29

                                The second time I took a course in C, the textbook was "C as a Second Language, For Native Speakers of Pascal", I still have it right here. (But BASICplus was my first programming language.)

                                1 Reply Last reply
                                0
                                • _ _beauw_

                                  "The data was imported daily from SAP" But wait... I thought SAP did everything. Aren't all of those annoying little side-apps with their interface and import requirements supposed to just go away after a successful SAP implementation? And shouldn't costly, difficult-to-manage programmers be a thing of the past? Or was I misled on these points?

                                  V Offline
                                  V Offline
                                  Vivi Chellappa
                                  wrote on last edited by
                                  #30

                                  SAP requires costly, difficult-to-manage programmers be available in very large numbers so that one may be sacrificed daily to appease the beast! The same thing goes for Oracle ERP too!

                                  B 1 Reply Last reply
                                  0
                                  • G Ger Hayden

                                    Code that forced Oracle tables to behave like ISAM files

                                    Ger

                                    V Offline
                                    V Offline
                                    Vivi Chellappa
                                    wrote on last edited by
                                    #31

                                    Oracle was implemented on IBM mainframes using VSAM! ;P

                                    1 Reply Last reply
                                    0
                                    • Brian C HartB Brian C Hart

                                      Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

                                      Sincerely Yours, Brian Hart

                                      W Offline
                                      W Offline
                                      was8309
                                      wrote on last edited by
                                      #32

                                      not even the code, but the name. A while after a nice old dude named Larry retired, I figured it was safe to delete a clist (old mainframe stuff) named 'Larry'. soon enough the phone was ringing off the hook - "what happened to the Larry command?!"

                                      1 Reply Last reply
                                      0
                                      • Brian C HartB Brian C Hart

                                        Okay, last day or so ago, I asked what your favorite programming job was. Now, what is the worst, nastiest, ugliest source code you ever saw and what made it so horribly bad? Not commented (heh heh yeah, as if) or one-letter (or zero-letter?) variable names? Written in a dead programming language that should be dead, but your client is still using it for some God-awful reason? The list goes on...so spew!

                                        Sincerely Yours, Brian Hart

                                        T Offline
                                        T Offline
                                        tuningd
                                        wrote on last edited by
                                        #33

                                        A MS Access app(lol) that a accountant wrote over some years. It looked a excel documents and another access database all over the network using mapped drives. It produced a huge excel document that all the executives used every day. Oh and the excel documents were created by our own programs which we had full access to the database so I have yet to understand why this was created.

                                        1 Reply Last reply
                                        0
                                        • N NormDroid

                                          ON ERROR RESUME Nothing more, nothing less...

                                          Software Kinetics Wear a hard hat it's under construction
                                          Metro RSS

                                          D Offline
                                          D Offline
                                          destynova
                                          wrote on last edited by
                                          #34

                                          And its more verbose but equally horrible Java cousin:

                                          try {
                                          mystery1();
                                          mystery2();
                                          mystery3();
                                          mystery4();
                                          theRestOfTheProgram();
                                          } catch(Exception e) {};

                                          I've been bitten by that a few times, testing something that is not behaving as it should, but not producing any error messages. What's the point of having exceptions, and just as importantly, a managed language with automatic line-numbered stack traces etc, if you're going to suppress all of that goodness? :omg:

                                          O 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups