• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Code review - hilarious code snippets

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Originally posted by suityou01 View Post
    Oooh and you keep biting. Love it.
    Isn't it a shame that suggesting someone is banned is a banning offence.

    Just saying like
    merely at clientco for the entertainment

    Comment


      Originally posted by eek View Post
      Isn't it a shame that suggesting someone is banned is a banning offence.

      Just saying like
      I think he's been punished enough. If you can call it punishment without sounding like Glenn Hoddle.
      While you're waiting, read the free novel we sent you. It's a Spanish story about a guy named 'Manual.'

      Comment


        Originally posted by fullyautomatix View Post
        I am currently doing a code review of my fellow developers in a web project written in .NET. Some of the code I have found need to go in some code hall of fame or something.

        1) A senior developer has written a asp.net page and in that entire page the only control is a label control. I was surprised because in the web app that page was a big form with lots of data. I felt like I was looking at the wrong file. Anyway I open up the code behind and this moron has written lines and lines of code concatenating HTML strings and then finally set that string to the label control as text.

        2) Moron developer has put a checkbox list on the page and someone has told him to make it mandatory. He has tried to apply a required field validator to that list but has got an error. Not being able to google an alternative to this limitation, he has used his lateral thinking brains and has put in a div with display set to none and in this div he has put a text box and a required field validator to this text box. On user clicking the checkbox, using javascript he sets a value to the text box. User checks checkbox, value gets set to "invisible" textbox, user does not check any checkbox , the "invisible" textbox is empty and fires required field validation.

        3) Moron developer has to fill a drop downlist. The business layer has given him a List<generic entity>. Instead of doing a direct databind he has looped through the list and added items to the drop down list. All this is done in page load. Goon has not bothered to check for post back. So on every post back the items in the dropdown keep getting doubled. So clever guy has added a line of code on top the clear the items first before adding items. ( a comment has been added to describe this "bug" )

        I can go on and on but really I am at my wits end.
        Thanks - fixed it now.

        Comment


          Originally posted by fullyautomatix View Post
          I am currently doing a code review of my fellow developers in a web project written in .NET. Some of the code I have found need to go in some code hall of fame or something.

          1) A senior developer has written a asp.net page and in that entire page the only control is a label control. I was surprised because in the web app that page was a big form with lots of data. I felt like I was looking at the wrong file. Anyway I open up the code behind and this moron has written lines and lines of code concatenating HTML strings and then finally set that string to the label control as text.

          I can go on and on but really I am at my wits end.
          Fixed this one its now a Literal. (In a serious mode I actually used a literal once. I saw 500 lines of appalling bad classic asp vbscript created a vb.net user control added the literal and left the code to it).
          merely at clientco for the entertainment

          Comment


            I saw a C# IDisposable implementation today thats sole purpose was to set a string field on the object to null. Nice try.

            Comment


              Originally posted by CheeseSlice View Post
              Try being in infrastructure. Then you'd find that even the supposedly good developers write tulip abstract code.

              I'm often finding software that is meant to be for a distributed server environment being written as if it all runs off one server. Lets take middleware....Why exactly would the server in the application tier be able to find a file dropped onto the C: drive by the SQL server? And why must your tulipty code have hard-coded URIs to talk to 'localhost' when you're trying to talk to a web service in a completely different network?

              Stoopid devs
              Glad it's not just me

              Best one I had recently was a twunt that built a dynamic login page with a link (yes it was hardcoded) back to his laptop ip address in India. So the code gets to the live server (well tested there boys )and promptly hangs every new login page. For two minutes. Then he runs off to the customer to tell them what a crock of tulipe the servers are...

              Took two days to find the issue because they didn't put logging code into the app. While I was uncovering that I made sure the security team found out that the bastards also hardcoded oracle passwords in the apps instead of using the service bus connection pool

              Same crew also submitted an ant deploy script that started off by droping all the deployed applications from the web logic server before deploying the new code. Unfortunately that meant all the code from three different suppliers.

              Comment


                Having worked in IBs for many years I often come across

                Bond jamesBond = new Bond() etc. etc.

                probably all written by the same obviously hilarious fwit.

                Comment


                  Just when I thought I had seen the worst kind of feckwittery in coding I come across a gem.

                  Developer has to access a value stored as an attribute in web.config. Instead of googling the best way to do this he has actually written a web.config parser. The parser reads the web.config into memory and there are lines of lines of code to do a lot of string parsing to access that value. It seems that the same attribute is present elsewhere in the web.config but its commented out. So tons of code to remove commented out portions.
                  Vote Corbyn ! Save this country !

                  Comment

                  Working...
                  X