• 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!

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Code review - hilarious code snippets"

Collapse

  • fullyautomatix
    replied
    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.

    Leave a comment:


  • moorfield
    replied
    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.

    Leave a comment:


  • bobspud
    replied
    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.

    Leave a comment:


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

    Leave a comment:


  • eek
    replied
    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).

    Leave a comment:


  • mudskipper
    replied
    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.

    Leave a comment:


  • doodab
    replied
    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.

    Leave a comment:


  • eek
    replied
    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

    Leave a comment:


  • suityou01
    replied
    Originally posted by doodab View Post
    You were, unfortunately, the only person discusssing such things.

    Don't you have some security holes to leave gaping?
    Oooh and you keep biting. Love it.

    Leave a comment:


  • doodab
    replied
    Originally posted by suityou01 View Post
    Oh don't get me wrong I still think Doodab is a cowboy coder. Anyone that discusses implementing try catch blocks that don't handle exceptions on an internet forum is asking for that.
    You were, unfortunately, the only person discusssing such things.

    Don't you have some security holes to leave gaping?

    Leave a comment:


  • suityou01
    replied
    Oh don't get me wrong I still think Doodab is a cowboy coder. Anyone that discusses implementing try catch blocks that don't handle exceptions on an internet forum is asking for that.

    Leave a comment:


  • eek
    replied
    Originally posted by jmo21 View Post
    I can't believe you all believe Suity's "trolling" claims!
    We don't but it gives us another reason to attack him. So the mob is happy.

    Leave a comment:


  • jmo21
    replied
    Originally posted by suityou01 View Post
    Totally and has been for a while, I was just having too much fun trolling.

    One has to dish it back out once in a while.

    I can't believe you all believe Suity's "trolling" claims!

    Leave a comment:


  • eek
    replied
    Originally posted by doodab View Post
    Well it was certainly a masterclass in playing dumb. For a while there you had me convinced you were as thick as pig tulip.
    I thought people just took that as read nowadays.

    Leave a comment:


  • doodab
    replied
    Originally posted by suityou01 View Post
    Totally and has been for a while, I was just having too much fun trolling.

    One has to dish it back out once in a while.

    Well it was certainly a masterclass in playing dumb. For a while there you had me convinced you were as thick as pig tulip.

    Leave a comment:

Working...
X