Spot the WTF's game



  • This is some code (slightly modified to protect the guilty) I've stumbled across today...

    How many WTF's can you spot?

    HINT: in the aspx page there are 20 dropdownlist controls hard coded that get dynamically populated and not all dropdownlist controls get used.

     




    Protected WithEvents dropdownlist1 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlist2 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlist3 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlist10 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlist9 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlist8 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlist7 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlist6 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlist5 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents dropdownlist4 As System.Web.UI.WebControls.DropDownList

    <snip>

    For I = 1 To 15
            ddl = New DropDownList
            ddl = CType( Me.FindControl("dropdownlist" & CStr(I)), DropDownList)
        ddl.Items.FindByText(ddl.SelectedItem.Text).Selected = False
    next



    1. Each dropdownlist requires its own line of code for declaration, when an array could do the same in one line. WTF?
    2. The declaration of the dropdownlist's starts with one, two, three and then backwards from 10. WTF?
    3. Fifteen new instances of DropDownList are created and immediately discarded. WTF?
    4. The author makes at least 5 calls to methods/properties to clear the current selection on each dropdownlist, when maybe 1 call could be enough. WTF?



  • Oh, I see one! It's in the article's title. Or are we actually trying to spot a game belonging to a WTF?



  • [list=1]
    [*]asp.net was deliberately designed to impress managers, not programmers. Because managers decide which tools the programmers have to use, this was a wise decision from m$ (emphasis on the '$' in m$). m$ WTF.

    [*]It's impressive for managers to drag web controls from the toolbox into the designer and then to show the automatically generated code behind. "Wow, it would have taken hours for our programmers to write this complicated code!". They tend to ignore the bad sign incarnating itself in the dull faces of some programmers watching and thinking about "hard coded". Well, doesn't drag&drop look somehow "soft" and "elegant"? Manager WTF, provoked by above m$ WTF.

    [*]Most .net books follow the spirit of asp.net and provide toy examples, easily programmable by drag&drop and copy&paste. What should the publishers do instead? Managers often decide which books get handed out to the programmers. Publisher WTF, provoked by the manager WTF, provoked by the m$ WTF.

    [*]After drag&dropping the controls (as learned in the asp.net training course) they're declared individually with WithEvents. There is no way to loop trough them without using reflection (which is usually not taught in asp.net training courses). So the programmer had to use that ugly CType-FindControl combination (which looks still nicer to me than programming by copy&paste and search&replace, the usual asp.net way). Training course WTF, provoked by the publisher WTF, provoked by the manager WTF, provoked by the m$ WTF.

    [*]The code doesn't show where the dynamical loading of all controls is declared, I suppose it's in the Page_Load. asp.net requires that [i]any[/i] control [i]possibly[/i] active in the result page needs to be populated in Page_Load (before e.g. button events are processed), even if it gets deactivated later on. An after-effect of the attempt to make programming a dynamic web page look like programming a desktop GUI. m$ WTF.
    [/list]

    Summary: I'm unsure whether I see one or two WTFs. Of course, asp.net actually is a WTF, but it's a very canny answer to the corporate world WTF: I once attended a sociological lecture at the university where they declared the 90ies as the decade where the management has taken command in the corporate IT world. I tend to assert that this is the [i]real[/i] WTF, and the m$ WTF is only an after-effect.



  • Best roundup ever. I feel cheated by those people trying to have me produce, what I call, quick&dirty hacks for a loong time.

    Last year, in the year-end meeting, where my boss is supposed to tell me how great (or not so great) my work was this year, he told me that he was indeed very happy with me. He said that I even improved with the one big issue he had with me: that I wasn't being so insistent on quality anymore. Let me spell it out for you: I DID NOT like that statement. It DID NOT feel like a compliment. I turned in my resignation shortly after that.
     



  • @TehFreek said:

    Oh, I see one! It's in the article's title. Or are we actually trying to spot a game belonging to a WTF?

    Haha, I was going to mention that...



    I get annoyed every time I see my local department store and the "CD's" they're selling.



  • @TheRider said:

    He said that I even improved with the one big issue he had with me: that I wasn't being so insistent on quality anymore.

    People (managers) are increasingly getting too comfortable with commodity programmers. They simply want to churn out software in whatever state it is. I wonder if the same happens in other industries.



  • @TheRider said:

    He said that I even improved with the one big issue he had with me: that I wasn't being so insistent on quality anymore.

    ...

    I turned in my resignation shortly after that.
     

    I think that was the right choice to make.
     



  • @Daniel15 said:

    @TehFreek said:
    Oh, I see one! It's in the article's title. Or are we actually trying to spot a game belonging to a WTF?

    Haha, I was going to mention that...



    I get annoyed every time I see my local department store and the "CD's" they're selling.

     

    Hey, grammar nazis.  People use an apostrophes to indicate the plural when the noun is a letter or an acronym.  That's actually how it's supposed to be.  Turn in your dictionary, thesaurus, and secret decoder ring immediately.



  • @Atrophy said:

    @Daniel15 said:

    @TehFreek said:
    Oh, I see one! It's in the article's title. Or are we actually trying to spot a game belonging to a WTF?

    Haha, I was going to mention that...



    I get annoyed every time I see my local department store and the "CD's" they're selling.

     

    Hey, grammar nazis.  People use an apostrophes to indicate the plural when the noun is a letter or an acronym.  That's actually how it's supposed to be.  Turn in your dictionary, thesaurus, and secret decoder ring immediately.


  • Discourse touched me in a no-no place

    @Atrophy said:

    Hey, grammar nazis.  People use an apostrophes to indicate the plural when the noun is a letter or an acronym.  That's actually how it's supposed to be.  Turn in your dictionary, thesaurus, and secret decoder ring immediately.

    You should not need to pluralise acronyms. The word being substituted for the letter already contains the plural form of the word.

    Distributed Denials of Service = DDoS, not DDsoS, DDoSs, DDoS's or whatever.

    Requests for Comments = RFC, not RsFCs, RsFC's R'sFC's etc.

    Same with "What the Fucks" or "Worse than Failures." Or whatever it stands for this month.

    That said, I shall now eagerly await a list of singular words which start with a different letter when pluralised, along with an example of an acronym containing said word...



  • @H|B said:

    @TheRider said:

    He said that I even improved with the one big issue he had with me: that I wasn't being so insistent on quality anymore.

    People (managers) are increasingly getting too comfortable with commodity programmers. They simply want to churn out software in whatever state it is. I wonder if the same happens in other industries.

    In other industries, most consumers are qualified and willing to judge whether the product is or is not a useless piece of junk. In the software industry, users just accept it.



  • @Atrophy said:

    @Daniel15 said:

    @TehFreek said:
    Oh, I see one! It's in the article's title. Or are we actually trying to spot a game belonging to a WTF?

    Haha, I was going to mention that...



    I get annoyed every time I see my local department store and the "CD's" they're selling.

     

    Hey, grammar nazis.  People use an apostrophes to indicate the plural when the noun is a letter or an acronym.  That's actually how it's supposed to be.  Turn in your dictionary, thesaurus, and secret decoder ring immediately.

    Both are actually valid (all three if you count the previous post). I learned one way in school, then I became an editor (I promise, it's my job title. I really need to get that changed...) and was taught the other way. Turns out that, depending on which set of guidelines you use, it can be valid to use an apostrophe when pluralizing an acronym.



  • @tarnold said:

    [list=1]
    [*]asp.net was deliberately designed to impress managers, not programmers. Because managers decide which tools the programmers have to use, this was a wise decision from m$ (emphasis on the '$' in m$). m$ WTF.

    [*]It's impressive for managers to drag web controls from the toolbox into the designer and then to show the automatically generated code behind. "Wow, it would have taken hours for our programmers to write this complicated code!". They tend to ignore the bad sign incarnating itself in the dull faces of some programmers watching and thinking about "hard coded". Well, doesn't drag&drop look somehow "soft" and "elegant"? Manager WTF, provoked by above m$ WTF.

    [*]Most .net books follow the spirit of asp.net and provide toy examples, easily programmable by drag&drop and copy&paste. What should the publishers do instead? Managers often decide which books get handed out to the programmers. Publisher WTF, provoked by the manager WTF, provoked by the m$ WTF.

    [*]After drag&dropping the controls (as learned in the asp.net training course) they're declared individually with WithEvents. There is no way to loop trough them without using reflection (which is usually not taught in asp.net training courses). So the programmer had to use that ugly CType-FindControl combination (which looks still nicer to me than programming by copy&paste and search&replace, the usual asp.net way). Training course WTF, provoked by the publisher WTF, provoked by the manager WTF, provoked by the m$ WTF.

    [*]The code doesn't show where the dynamical loading of all controls is declared, I suppose it's in the Page_Load. asp.net requires that [i]any[/i] control [i]possibly[/i] active in the result page needs to be populated in Page_Load (before e.g. button events are processed), even if it gets deactivated later on. An after-effect of the attempt to make programming a dynamic web page look like programming a desktop GUI. m$ WTF.
    [/list]

    Summary: I'm unsure whether I see one or two WTFs. Of course, asp.net actually is a WTF, but it's a very canny answer to the corporate world WTF: I once attended a sociological lecture at the university where they declared the 90ies as the decade where the management has taken command in the corporate IT world. I tend to assert that this is the [i]real[/i] WTF, and the m$ WTF is only an after-effect.

     Oh dear that post is full of exciting ranting crazy
     



  • @PJH said:

    You should not need to pluralise acronyms. The word being substituted for the letter already contains the plural form of the word.

    This is precisely the reason you DO need to pluralize acronyms - to eliminate ambiguity.



  • next is lowercase. WTF !!



  • @PJH said:

    @Atrophy said:

    Hey, grammar nazis.  People use an apostrophes to indicate the plural when the noun is a letter or an acronym.  That's actually how it's supposed to be.  Turn in your dictionary, thesaurus, and secret decoder ring immediately.

    You should not need to pluralise acronyms. The word being substituted for the letter already contains the plural form of the word.

    Distributed Denials of Service = DDoS, not DDsoS, DDoSs, DDoS's or whatever.

    Requests for Comments = RFC, not RsFCs, RsFC's R'sFC's etc.

    Same with "What the Fucks" or "Worse than Failures." Or whatever it stands for this month.

    That said, I shall now eagerly await a list of singular words which start with a different letter when pluralised, along with an example of an acronym containing said word...

    So you're saying that "I have a pile of CD" is correct?



  • 20 controls, 10 declared, 15 used in a loop

    Why are we setting ddl to a new object every loop iteration? That makes the GC do unnecessary work? Wouldn't "nothing" be more appropriate aka null?

    (As for the reflection quip, you could do that, or loop through all the controls on the page, recursively. It'd suck, too.)

    This goes through every dropdown list on the page, finds the selected item, and sets selected to false, thereby "unselecting" it.  Which we would assume does nothing.

    WHAT THE EVERLOVING F... 

     

     



  • "I have a pile of Compact Disks"



  • So shouldn't it be "R's FC" and "DD's oS"?

    I avoid the issue. I say "RFC documents" and "DDoS attacks".



  • Boy has this gone off track.

     To keep it going:

     

    http://www.soyouwanna.com/site/syws/wrerrors/wrerrors3.html

    http://owl.english.purdue.edu/handouts/grammar/g_apost.html 

     
    I'm afraid there's evidence both ways on this one.  You could argue either way.  But I would personally agree with the one from Purdue, stating

    "Apostrophes are NOT used for possessive pronouns or for noun plurals,
    including acronyms."
     



  • "I have a pile of Compact Discs"

     

    Corrected that for you. 



  • @CDarklock said:

    So shouldn't it be "R's FC" and "DD's oS"?

    I avoid the issue. I say "RFC documents" and "DDoS attacks".

    ....

    ATM machines

    PIN numbers

    ....

    </snarky mode> 



  • @Random832 said:

    @PJH said:

    You should not need to pluralise acronyms. The word being substituted for the letter already contains the plural form of the word.

    This is precisely the reason you DO need to pluralize acronyms - to eliminate ambiguity.

    Stop molesting the sheeps. 



  • @asuffield said:

    sheeps 

    twitch 



  • <FORM name="buttonsForm">It's a surprisingly common way of (trying) to do things among beginners. They have a set of elements and they need to store the values of those elements so they think "mhh all I have to do is create new variables dynamically, one per element".

    So you end with questions on forums which goes like this :
    Title: How to dynamically create variable Name?
    Content: I'd like to create variables dynamically but the code below doesn't work
    "for i = 1 to 10
    dim monString & i as string
    next i"

    Of course the right way to solve the problem is to use an array or a list.
    The sad thing is that most of the time the people answering tell the poor guy to use code generator, the preprocessor, reflection or some other nonsense instead of explaining that it's not how you're supposed to do things. It's really scary.
    <INPUT type="hidden" name="startIndex"/><INPUT type="hidden" name="endIndex"/></FORM>



  • <code_bashing>
      1.  Assumed undeclared variables (option explicit / strict not set?)
      2.  Setting ddl to New DropDownList then re-setting it to the results of Me.FindControl
      3.  Possible NullReferenceException in two places.  ("ddl.Items" when ddl can be null / "ddl.SelectedItem.Text" when SelectedItem can be null)
      4.  Using ddl.Items.FindByText(ddl.SelectedItem.Text) instead of ddl.SelectedItem
    </code_bashing>

    <constructive_input>

    I'm not sure of the VB.Net equivalent, but in C# you could do this:

    DropDownList[] ddls = new DropDownList[] { 
      dropdownlist1, dropdownlist2, dropdownlist3, dropdownlist4, dropdownlist5, 
      dropdownlist6, dropdownlist7, dropdownlist8, dropdownlist9, dropdownlist10, 
      dropdownlist11, dropdownlist12, dropdownlist13, dropdownlist14, dropdownlist15
    };
    

    foreach(DropDownList ddl in ddls)
    {
    if (ddl != null)
    ddl.ClearSelection();
    }

    </constructive_input>


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.