The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

More outsourced madness

Last post 02-13-2008 10:26 AM by Lysis. 34 replies.
Page 1 of 1 (35 items)
Sort Posts: Previous Next
  • 02-12-2008 1:20 PM

    More outsourced madness

    My company hired an outsourced "enhancement" team to add some ajax stuff to a few pages. Stuff that my team could have done, but didn't have the time/bandwidth.

    Its some of the worst code  I've ever seen.

     Behold:

      if(document.getElementById('tdZipButton')!=null)
                        {
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace('id="zipCode_btnAjaxContinue"','id="zipCode_btnAjaxContinue" onclick="return CheckZipClick()"')
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace("id='zipCode_btnAjaxContinue'","id='zipCode_btnAjaxContinue' onclick='return CheckZipClick()'")                      
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace('ID="zipCode_btnAjaxContinue"','ID="zipCode_btnAjaxContinue" onclick="return CheckZipClick()"')
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace("ID='zipCode_btnAjaxContinue'","ID='zipCode_btnAjaxContinue' onclick='return CheckZipClick()'")                      
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace("id=zipCode_btnAjaxContinue","id='zipCode_btnAjaxContinue' onclick='return CheckZipClick()'")
                        }

     Theres about 10 WTF's right there. Imagine seeing 300-400 lines like this.

  • 02-12-2008 1:26 PM In reply to

    Re: More outsourced madness

    The Real WTF(tm) is that they could have simply written

    if(document.getElementById('tdZipButton'))

  • 02-12-2008 1:28 PM In reply to

    Re: More outsourced madness

    How about not having to use GetElementById everytime they reference the element.

     Why are they using the parent Elements innerHTML property and replace method to change attributes on a child element. What horrible break in logic would make anyone think thats a good idea.

    Also, the child element DOES have a unique ID!

     

  • 02-12-2008 1:29 PM In reply to

    Re: More outsourced madness

    Jonathan Holland:

    My company hired an outsourced "enhancement" team to add some ajax stuff to a few pages. Stuff that my team could have done, but didn't have the time/bandwidth.

    Its some of the worst code  I've ever seen.

     Behold:

      if(document.getElementById('tdZipButton')!=null)
                        {
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace('id="zipCode_btnAjaxContinue"','id="zipCode_btnAjaxContinue" onclick="return CheckZipClick()"')
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace("id='zipCode_btnAjaxContinue'","id='zipCode_btnAjaxContinue' onclick='return CheckZipClick()'")                      
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace('ID="zipCode_btnAjaxContinue"','ID="zipCode_btnAjaxContinue" onclick="return CheckZipClick()"')
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace("ID='zipCode_btnAjaxContinue'","ID='zipCode_btnAjaxContinue' onclick='return CheckZipClick()'")                      
                            document.getElementById('tdZipButton').innerHTML=document.getElementById('tdZipButton').innerHTML.replace("id=zipCode_btnAjaxContinue","id='zipCode_btnAjaxContinue' onclick='return CheckZipClick()'")
                        }

     Theres about 10 WTF's right there. Imagine seeing 300-400 lines like this.

     

     

    What do you expect from a bunch of sand people?  Have you seen them attempt simple html?  I don't think they know what a close html tag is.  

    http://www.thebestpageintheuniverse.com
    Filed under:
  • 02-12-2008 1:41 PM In reply to

    Re: More outsourced madness

    No need to be racist. I've worked with some excellent indian programmers. The good ones come here. The crappy ones tend to stay there.

    Here is my fix:

     var zipCodebtnAjaxContinue = document.getElementById('zipCode_btnAjaxContinue');
                       
                        if (zipCodebtnAjaxContinue)
                        {
                            zipCodebtnAjaxContinue.onClick = CheckZipClick();
                        }

  • 02-12-2008 2:01 PM In reply to

    • DOA
    • Top 75 Contributor
    • Joined on 06-26-2007
    • Posts 382

    Re: More outsourced madness

    Lysis:
    What do you expect from a bunch of sand people?  Have you seen them attempt simple html?  I don't think they know what a close html tag is.

    Sand people? You do realise there are more than one places outside your little part of the world, right? It's not all sand populated with people that write bad code and hate you. I know that's all you see on the news, but somehow they have neglected to tell you that there are a few billion people out there going about their business. Hell, a lot of them are far more competent developers than you or me.

    I've studied with indian people during my Comp Sci degree and I can guarantee you they can do far more than close a HTML document

  • 02-12-2008 2:02 PM In reply to

    Re: More outsourced madness

    Jonathan Holland:

    Here is my fix:

     var zipCodebtnAjaxContinue = document.getElementById('zipCode_btnAjaxContinue');
                       
                        if (zipCodebtnAjaxContinue)
                        {
                            zipCodebtnAjaxContinue.onClick = CheckZipClick();
                        }

    TRWTF

  • 02-12-2008 2:16 PM In reply to

    Re: More outsourced madness

    DOA:

    Lysis:
    What do you expect from a bunch of sand people?  Have you seen them attempt simple html?  I don't think they know what a close html tag is.

    Sand people? You do realise there are more than one places outside your little part of the world, right? It's not all sand populated with people that write bad code and hate you. I know that's all you see on the news, but somehow they have neglected to tell you that there are a few billion people out there going about their business. Hell, a lot of them are far more competent developers than you or me.

    I've studied with indian people during my Comp Sci degree and I can guarantee you they can do far more than close a HTML document

     

     

    I'm sure there will be plenty of people who will tell me about the few Injuns they know who are really goood good coderz!!!!1!!!  We all know that stereotype comes from truth.  Using your scenario, you do realize that outside of those few Injuns you have interacted with that there are millions of crappy coding dirty ones out there too that fit my description of them.

    http://www.thebestpageintheuniverse.com
    Filed under:
  • 02-12-2008 2:22 PM In reply to

    Re: More outsourced madness

    Lysis:

    I'm sure there will be plenty of people who will tell me about the few Injuns they know who are really goood good coderz!!!!1!!!  We all know that stereotype comes from truth.  Using your scenario, you do realize that outside of those few Injuns you have interacted with that there are millions of crappy coding dirty ones out there too that fit my description of them.

     

     Perhaps, but I have the ability to not be a total douchbag about it.

     

  • 02-12-2008 2:39 PM In reply to

    Re: More outsourced madness

    Jonathan Holland:

    No need to be racist. I've worked with some excellent indian programmers. The good ones come here. The crappy ones tend to stay there.

    Here is my fix:

     var zipCodebtnAjaxContinue = document.getElementById('zipCode_btnAjaxContinue');
                       
                        if (zipCodebtnAjaxContinue)
                        {
                            zipCodebtnAjaxContinue.onClick = CheckZipClick();
                        }

    Might want to remove the parentheses after CheckZipClick there. If I'm not mistaken, your current solution assigns the result of the evaluation of the function CheckZipClick to the onClick event handler, rather than the function itself.

  • 02-12-2008 2:48 PM In reply to

    Re: More outsourced madness

    Yeah, actually I typed that into this editor here. The actual code fix I used replaced CheckZipClick with an anonymous function closure.

     ie:

     

    zipCodebtnAjaxContinue.onclick = function () 

    {

    // Do the zipcode stuff. 

    } ;

  • 02-12-2008 3:11 PM In reply to

    Re: More outsourced madness

    Lysis:
    I'm sure there will be plenty of people who will tell me about the few Injuns they know who are really goood good coderz!!!!1!!!  We all know that stereotype comes from truth.  Using your scenario, you do realize that outside of those few Injuns you have interacted with that there are millions of crappy coding dirty ones out there too that fit my description of them.
    And while you and the people you know might be "really goood good coderz", for every one of those there are a ton of crappy coding dirty Americans and Europeans as well. You might as well respond to every other thread on this board with. "What do you expect from a bunch of crackers?"

    Grow up

  • 02-12-2008 3:14 PM In reply to

    Re: More outsourced madness

    SuperousOxide:
    You might as well respond to every other thread on this board with. "What do you expect from a bunch of crackers?"
     

    That is pretty likely to happen now. Thanks for giving him the suggestion.

  • 02-12-2008 3:22 PM In reply to

    Re: More outsourced madness

    MasterPlanSoftware:

    SuperousOxide:
    You might as well respond to every other thread on this board with. "What do you expect from a bunch of crackers?"
     

    That is pretty likely to happen now. Thanks for giving him the suggestion.

     

     

    SuperiousOxidous has a great idea! 

    http://www.thebestpageintheuniverse.com
    Filed under:
  • 02-12-2008 3:25 PM In reply to

    Re: More outsourced madness

    SuperousOxide:
    for every one of those there are a ton of crappy coding dirty Americans and Europeans as well.
     

      I like to refer to those people you describe as "black people." 

    http://www.thebestpageintheuniverse.com
    Filed under:
  • 02-12-2008 3:26 PM In reply to

    Re: More outsourced madness

    Lysis:

    MasterPlanSoftware:

    SuperousOxide:
    You might as well respond to every other thread on this board with. "What do you expect from a bunch of crackers?"
     

    That is pretty likely to happen now. Thanks for giving him the suggestion.

    SuperiousOxidous has a great idea! 

     

    And the point of your existence is what, exactly?

    I guess I'm back.

    Please continue to spam the addresses below.

    PLEASE SPAM:
    jtobin@ohioinstituteofhealthcareers.edu
    jtobin@ohiobusinesscollege.edu
  • 02-12-2008 3:29 PM In reply to

    Re: More outsourced madness

    belgariontheking:

    Lysis:

    MasterPlanSoftware:

    SuperousOxide:
    You might as well respond to every other thread on this board with. "What do you expect from a bunch of crackers?"
     

    That is pretty likely to happen now. Thanks for giving him the suggestion.

    SuperiousOxidous has a great idea! 

     

    And the point of your existence is what, exactly?

     

     

    The same reason you post here? 

    http://www.thebestpageintheuniverse.com
    Filed under:
  • 02-12-2008 3:45 PM In reply to

    Re: More outsourced madness

     TunnelRat? Is that you?

  • 02-12-2008 4:42 PM In reply to

    Re: More outsourced madness

    Jonathan Holland:
    replace method to change attributes on a child element.
     

    IE's particularly borked and refuses to let you change or set attributes on elements, usually at random. Doing x.setAttribute('attribute', 'value') works for some, but fails for others, while doing "x[attribute] = 'value'" works/doesn't work for yet another set. Sometimes it's just easier to rebuild the tag using innerHTML, even if it isn't "best practices". 

    -- Never play leapfrog with a unicorn
  • 02-12-2008 5:01 PM In reply to

    Re: More outsourced madness

     setAttribute('click',somefunction);

     or 

    element.onclick = somefunction;

     Works just fine in IE.

    There is no excuse for this. 

  • 02-12-2008 5:17 PM In reply to

    Re: More outsourced madness

    Lysis:

    What do you expect from a bunch of sand people?  Have you seen them attempt simple html?  I don't think they know what a close html tag is.  

     

    <IgnoreBlatantRasicm> 

    Sand people?  I didn't know people outsourced to Tusken Raiders nowadays!

    </IgnoreBlatantRacism> 

    The Daily WTF Forums. You will never find a more wretched hive of scum and villainy.
  • 02-12-2008 5:22 PM In reply to

    Re: More outsourced madness

    You are living up to your name wise Jedi.

     Personally, when I think of India, I think of humidity, monsoon rains, and jungles...I don't think of deserts.

     Lysis, perhaps both a Political Correctness class and a Geography class should be required?

  • 02-12-2008 7:10 PM In reply to

    Re: More outsourced madness

    ObiWayneKenobi:
    Sand people?  I didn't know people outsourced to Tusken Raiders nowadays!
    But just picture an Indian standing up in his cubicle, holding his keyboard above his head and doing that grunt.
  • 02-12-2008 7:18 PM In reply to

    • joe17301
    • Not Ranked
    • Joined on 02-01-2008
    • South Korea
    • Posts 13

    Re: More outsourced madness

    Jonathan Holland:

    You are living up to your name wise Jedi.

     Personally, when I think of India, I think of humidity, monsoon rains, and jungles...I don't think of deserts.

     Lysis, perhaps both a Political Correctness class and a Geography class should be required?

     

     I think a severe thrashing with the clue stick would be more to the point. That, or being mauled by a bear. Him/her/it and all his/her/its "grate coader" friends.

    "Since this post has no replies no children will be deleted"
  • 02-12-2008 9:47 PM In reply to