• Prime Mover (unregistered)

    Brillant idea! Think I'll do that frist chance I get.

  • Edd (unregistered)

    hope it works with my form where the email is called item_5

  • I dunno LOL ¯\(°_o)/¯ (unregistered)

    Just leave your name, address, and ctl00$ctl00$ctl00$ContentPlaceHolderDefault$cp_content$ctl02$RenderForm_1$rpFieldsets$ctl00$rpFields$ctl04$126d33a3_9f7f_4583_8c94_5820d58fc030 and I'll get right back to you!

  • King (unregistered)

    "WorkPhone" is checked twice, WITH SAME SPELLING!

  • Sole Purpose Of Visit (unregistered)

    Question 12: Why?

  • Sole Purpose Of Visit (unregistered) in reply to King

    Well, ,obviously. It probably has an NBSP buried in one of the two cases.

  • Dude (unregistered)

    It just.... keeps.... going...

  • Hans (unregistered)

    At least it is formatted nicely!

  • Robert Morson (google) in reply to Hans

    I imagine that formatting was added by the submitter or TRWTF. The original is probably all on long line.

  • my name is missing (unregistered)

    This code needs to also use a database, a blockchain, some AI, non-fungible tokens and a social network and it will be just as useful.

  • RLB (unregistered)

    And I'd bet that TRWTF is a crappy, unconfigurable Enterprise Web App Framework (tm) which makes this the only solution that works.

  • Duston (unregistered)

    'Default$Content$FormViewer$FieldsRepeater$ctl04$ctl00$ViewTextBox' is also named twice. Good thing they've got that so well covered.

  • Brian (unregistered) in reply to Sole Purpose Of Visit
    Question 12: Why?

    Simple - they did this for one customer, and it worked great. But then another customer wanted it, and their fields were different, and somebody made the decision to stick in a quick-n-dirty hack rather than refactor the whole thing to be customizable. And thus was a precedent set.

  • Sole Purpose Of Visit (unregistered) in reply to Brian

    I should have made my question clearer. It also applies to Questions 7, 51, 59, 35, 67 and 43. As per the OP.

    I'm almost impressed by the fact that this ingenious craptraption almost handles I18N, though.

  • (nodebb)

    Fucking yikes

  • The Mole (unregistered)

    You are not being totally fair, it doesn't always check the field name, sometimes it also uses the url and frmId to make the decision:

              || (llelementphone=='input_4' && (llformalyzerURL.indexOf('contact-us') != -1) && llfrmid==16794)
              || (llelementphone=='input_3' && (llformalyzerURL.indexOf('try-and-buy') != -1) && llfrmid==16794)
    

    I think I'm hoping that frmid is actually a customer id, not none unique supposedly unique form identifier. Either way it is even worse than it looks from the first 20 lines..

  • Ollie Jones (unregistered)

    Archeologists trying to reconstruct the history of server-side web frameworks will use this as a Rosetta Stone ... well, maybe as Rosetta Tissue Paper.

  • (nodebb)

    They covered ALL their bases.

    Or did they?

  • WTFGuy (unregistered)

    I'm going to bet this code is generated by a tool that screenscrapes the forms to learn what the element IDs are. Holy circular stupidity WTFMan!

  • (nodebb)

    TRWTF is their code review process: NINE lines are duplicated -- and all but three of them are within a dozen lines of each other.

  • DQ (unregistered)

    I think TRWTF is people actually counting the number of duplicates in this code...

  • ZZartin (unregistered)

    But hey at least they used line breaks, assuming those weren't added just for posting it here.....

  • WTFGuy (unregistered)

    @ZZartin

    The fact it was so well formatted was part of the reason I figured it was bot-generated code, not cut-and-pasted code.

  • (nodebb)

    Lets climb the ladder

            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
            || 
    

    to perfect code. The larger the ladder, the more perfect the code. (many duplicates included to help the ladder grow).

  • (nodebb) in reply to King

    Two txtPhone as well

  • dereferenced null pointer (unregistered)

    When I was in Uni we did soem functional Programming in some weird teaching dialect of Racket (Dr. Racket or something); I got points subtracted on the part of the question "recognise and abstract partial problems" (original was in german); For not making x^2 its own function. They literally subtracted me a point for making a whole new function instead of simply writing x*x (In an area calculation, no way we'd have a different exponent)

    So yeah premature abstraction sadly was a requirement to get full marks on that course.

  • (nodebb)

    It's a pity that I use ctl00$ctl00$templateMainContent$homeBanners$HomeBannerList$ctrLeads$txt_5_1 as the first line of the address on my form, not the phone number; that's ctl00$ctl00$templateMainContent$homeBanners$HomeBannerList$ctrLeads$txt_5_54

  • (nodebb) in reply to PJH

    Well, your users are just going to have to remember that the first line of their address needs to be formatted like a phone number.

  • jay (unregistered)

    I once came across a program that checked the query string for a field named either "cid" or "customer_id", and took either one. And I thought, Why? Why? The only links to this page (that we care about) are in pages that we wrote. When you were writing the code and found that you were passing in a query string parameter with a different name, instead of changing the target to accept either name, why didn't you just change the source to use the same name? I found one place that was using the long name, and changed it to the short name. But I was afraid to remove the check for both names for fear that there's someplace lurking out there that I didn't find, like somebody wrote query_string="customer_" & "id".

  • jay (unregistered) in reply to Bananafish

    "TRWTF is their code review process: NINE lines are duplicated -- and all but three of them are within a dozen lines of each other."

    Well, duh. Some of these names are used in two callers, so of course they have to check for them twice ...

  • Barf4Eva (unregistered)

    A Form of Refuse

  • (nodebb) in reply to jay

    And I thought, Why? Why? The only links to this page (that we care about) are in pages that we wrote.

    There are also links which people pasted into their emails, links which people bookmarked, links indexed by google, and links from archives and other links which your (current or potential) customers may come across, which would provide a better experience if they continued to work.

    So if your old system used customer_id, and your new system uses cid, it makes sense to check for customer_id and stuff that into the cid before continuing.

  • Lorens (unregistered) in reply to my name is missing

    my name is missing wrote:

    This code needs to also use a database, a blockchain, some AI, non-fungible tokens and a social network and it will be just as useful.

    It would also be shorter.

  • eric bloedow (unregistered)

    this reminds me of something...some system would try to load ALL flies in the ENTIRE network into a PC EVERY time ANY employee pressed ANY key on their keyboards! this would not be so bad for a small company with 20 users, but for a big one with 200 users...EVERYTHING LAGGED TERRIBLY.

Leave a comment on “A Form of Reuse”

Log In or post as a guest

Replying to comment #:

« Return to Article