The WET Cart

« Return to Article
  • brodie 2011-12-08 09:03
    Wow.... so, I am in no way an "expert" or "senior" programmer, but this is really bad. How can anyone working on commercial, production code not understand something as simple as loops?
  • sehe 2011-12-08 09:08
    brodie:
    Wow.... so, I am in no way an "expert" or "senior" programmer, but this is really bad. How can anyone working on commercial, production code not understand something as simple as loops?


    You forgot the FRIST!
  • Peter 2011-12-08 09:10
    So... and the cart logic was in Javascript? At least I hope it was just for presentation purposes... but somehow I don't think that's the case
  • sehe 2011-12-08 09:10
    brodie:
    Wow.... so, I am in no way an "expert" or "senior" programmer, but this is really bad. How can anyone working on commercial, production code not understand something as simple as loops?


    Also, who said he didn't understand loops? He knows about them. Strange loops too. Also, he consulted the documentation for his CPU architecture and he concluded that a loop would be bad for throughput due the increased branching.

    The data would be prefectched so everything is optimal.

    [Sic]
  • Lost 2011-12-08 09:11
    By only working on enterprisy software ?

    ooh, and thrid!!!
  • cguy 2011-12-08 09:17
    All about the loop unrolling. Efficent code!
  • Anketam 2011-12-08 09:18
    This reminds me of code I once wrote back in the 10th grade. However in that same year I discovered something called the while loop and then I quickly learned about for loops.
  • TheRon 2011-12-08 09:22
    Item value as float? WTF?
  • anonymous 2011-12-08 09:22
    sehe:
    brodie:
    Wow.... so, I am in no way an "expert" or "senior" programmer, but this is really bad. How can anyone working on commercial, production code not understand something as simple as loops?


    You forgot the FRIST!


    That's why he's not at a senior level.
  • Aris 2011-12-08 09:28
    +10 pts for writing business-logic and security code in client-side.

    I *hope* the code is doubled (making it really WET) in the asp/jsp/php part.
  • frits 2011-12-08 09:29
    What's all this nonsense about DRY? Each of those lines is clearly unique.
  • Zapp Brannigan 2011-12-08 09:31
    You need both loops and arrays. This explains why 4 out my 80 nieces and nephews were disappointed last Xmas.
  • Bill 2011-12-08 09:38
    Thirteenth comment!

    Fourteenth comment!

    Fifteenth comment!
  • DonaldK 2011-12-08 09:39
    The programmer was obviously paid by lines of code written.

    After 6 months at Amazon he never had to work again.
  • Larry 2011-12-08 09:40
    OK... this is finally my chance to learn something on TDWTF... and since my computer doesn't have google installed...

    What are "DRY principles"?

    * Do it yourself
    * Run Ycursively?
  • frits 2011-12-08 09:42
    Inb4 thread degenerates into a discussion about trolling...
  • DRY 2011-12-08 09:44
    "don't repeat yourself" is what he's going for.
  • Brendan 2011-12-08 09:48
    Larry:
    OK... this is finally my chance to learn something on TDWTF... and since my computer doesn't have google installed...

    What are "DRY principles"?


    Probably just an acronym a project manager made up, to make it easy to remember something instead of understanding it.
  • J. 2011-12-08 09:53
    ... The prices are in the form?
  • foo 2011-12-08 09:59
    Google:
    "don't repeat yourself" is what he's going for.
    FTFY
  • boog 2011-12-08 09:59
    Is anyone else bothered that the item names are form field names?

    It's just... It's just wrong... So wrong.
  • foo 2011-12-08 10:02
    frits:
    What's all this nonsense about DRY? Each of those lines is clearly unique.
    The braces lines are not. (Since this is a nit-picking forum, why haven't 10 others pointed this out already?)
  • LegacyCrono 2011-12-08 10:04
    Larry:
    OK... this is finally my chance to learn something on TDWTF... and since my computer doesn't have google installed...

    What are "DRY principles"?

    * Do it yourself
    * Run Ycursively?

    what.
  • Lex Luther 2011-12-08 10:06
    That's not the item names, that's the value. Based on the calculations, he has two fields- quantity and price.

    I need to find out what site this is and back up the truck.
  • boog 2011-12-08 10:06
    J.:
    ... The prices are in the form?
    Sure. How else will Javascript access the prices in order to compute the subtotal in the cart? It's only a problem if the site POSTs the WTF-computed subtotal (instead of computing it on the back end with the real prices). Which wouldn't surprise me.
  • boog 2011-12-08 10:07
    Lex Luther:
    That's not the item names, that's the value. Based on the calculations, he has two fields- quantity and price.

    I need to find out what site this is and back up the truck.
    Stitches, FirstAidKit, and Wristband aren't item names?
    I'm not talking about the values they store.
  • Nick 2011-12-08 10:11
    What website uses this? You'd get some really great discounts with a little bit of source dabbling...
  • StJohn 2011-12-08 10:13
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx
  • My Name Is Missing 2011-12-08 10:21
    A good job interview set of questions would be to take these examples minus the snarky commentary and see if the candidate realizes how stupid these things are.

    Of course the question is how did this person get the job who wrote this? I guess they already worked there and was given the job "since all programmers are the same".
  • foo 2011-12-08 10:23
    StJohn:
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx

    Seems Josiah put in a loop now. What a fool! Don't break what's working, amirite? (But at least he kept the original code, commented out, in case we want it back instead of his ivory tower fancy loops.)
  • boog 2011-12-08 10:25
    StJohn:
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx
    Wow. With the same form field names and everything. I thought they anonymized stuff around here.
  • Ken B. 2011-12-08 10:25
    LegacyCrono:
    Larry:
    OK... this is finally my chance to learn something on TDWTF... and since my computer doesn't have google installed...

    What are "DRY principles"?

    * Do it yourself
    * Run Ycursively?
    what.
    Google has a virus, so they uninstalled it. Didn't you know that?

    http://clientsfromhell.net/post/13880316592/
  • Ken B. 2011-12-08 10:30
    Anketam:
    This reminds me of code I once wrote back in the 10th grade. However in that same year I discovered something called the while loop and then I quickly learned about for loops.
    Ergo, this was written by a 9th grader.

    Nothing more to see here.
  • mikedjames 2011-12-08 10:42
    Is the other WTF is that you can buy e.g. -1.337 FirstAidKits ?
    (ParseFloat ...)
  • WTFStalker 2011-12-08 10:46
    Whew. At least the old code was replaced by some jquery. Too bad the old crufty stuff was just commented out. Perhaps it was just for our amusement.
  • PedanticCurmudgeon 2011-12-08 10:48
    Jack Strikes Back:
    Is there any chance that we might make these articles a daily occurrence?
    No, but if you go to the "Side Bar WTF", you'll see 2-3 WTFs per day on average, normally of better (or worse, if you prefer) quality than the front page articles.
  • Andrew 2011-12-08 10:54
    StJohn:
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx
    I think I just puked in my mouth a little bit.
  • airdrik 2011-12-08 10:59
    WTFStalker:
    Whew. At least the old code was replaced by some jquery. Too bad the old crufty stuff was just commented out. Perhaps it was just for our amusement.

    Or as a warning, kind of like mounting human sculls on posts.
    Warning: dangerous code lives in these parts!

    It's one thing if you temporarily leave commented code in your source that you intend to remove or uncomment later. Leaving it on the web pages for all the world to see is a whole 'nuther WTF on its own.

    P.S. I like how they had commented out some of the items that were part of the original list (using different commenting styles, no less), but were "removed" before they switched to jquery and commented out the whole blocks. "We might need to re-add those, and copy+paste is so much harder than removing some comment characters, and we might misspell something and everything will blow up."
  • Mister E. 2011-12-08 11:06
    StJohn:
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx

    Awww... That baby is saddened by the code.


  • Jack Strikes Back 2011-12-08 11:33
    Mister E.:
    StJohn:
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx

    Awww... That baby is saddened by this article.



    FTFY. BTW, when does the site change its name to "thewheneverthecrapifeellikeitwtf.com?"
  • Up Down 2011-12-08 11:51
    StJohn:
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx


    Yes, hello? I'd like to know why my order of .01 of everything didn't go through.
  • Some damn Yank 2011-12-08 11:59
    Larry:
    since my computer doesn't have google installed...
    Well, google is easy to install, you don't even need Administrator or Root access. It's a simple, two step process:
    1) Point your browser of choice to www.google.com
    2) Bookmark/Favorite the page

    (it would be a three step process except step 3) Profit! is for Google, not you)
  • Larry 2011-12-08 12:01
    Some damn Yank:
    Larry:
    since my computer doesn't have google installed...
    Well, google is easy to install, you don't even need Administrator or Root access. It's a simple, two step process:
    1) Point your browser of choice to www.google.com
    2) Bookmark/Favorite the page

    (it would be a three step process except step 3) Profit! is for Google, not you)
    What's a "browser"? And which end should I point with?
  • Fred 2011-12-08 12:04
    Larry:
    What's a "browser"? And which end should I point with?
    If you have a good sturdy pen on your desk, that can be a browser. Hold the sharp end pointing toward your chest, near your heart. Then run down the hall until you collide with the wall at the end.
  • c 2011-12-08 12:13
    Ken B.:
    Google has a virus, so they uninstalled it. Didn't you know that?

    http://clientsfromhell.net/post/13880316592/

    I thought some idiot had ignored all the warnings and typed "Google" into the search.
  • Maurits 2011-12-08 12:42
    76? What do they sell, gas or boys' bands?
  • Jay 2011-12-08 13:25
    Larry:
    ... and since my computer doesn't have google installed...


    I'd like to go get some food, but my car didn't come with grocery stores.
  • ThatCruftyGuyOverThere 2011-12-08 13:26
    It concerns me that you can checkout with negative quantities...

    What are the chances they will pay me what they owe me....

    caption: inhibeo - Inhibition now in gel form
  • Nag-geoff 2011-12-08 13:48
    brodie:
    Wow.... so, I am in no way an "expert" or "senior" programmer, but this is really bad. How can anyone working on commercial, production code not understand something as simple as loops?


    Loops on their own are pretty much useless. This code needs a total revamp before it can be taken up for testing. I pity the fools who are having to maintain this code. Sadly in the 1990's any fool who could type was qualified to be a computer programmer. Apple had a test where they showed three devices and if you correctly identified the computer, you got a job. In those days' nobody wanted to work with Apple, IBM being the employer of choice.
  • Nag-geoff 2011-12-08 13:49
    Such a legacy of problematic programming that violates good architectural and coding practices is called "technical debt," a metaphor that is gaining broader attention.

    Poor quality code, whether the result of business decisions to cut corners or weak programming skills, may be responsible for a computer system crash, a security breach, poor performance or data corruption, among other things.

    Repairing each line of code has a cost, or technical debt, that accumulates.
  • Nag-geoff 2011-12-08 13:50
    Every time a new piece of software is added to the code base, Baker said, an addition is made to its technical debt. Code is the principal, and software maintenance is the interest payment, "so the more code we have out there, the bigger our debt, hence the more maintenance, hence the more interest payments
  • Doozerboy 2011-12-08 14:40
    Just wondering why the web designers don't list PMH foundation as part of their portfolio....

    http://www.perth-web-design.net.au/website-design-portfolio/

    On the other hand, Sara.... Hell yeah.

    http://www.perth-web-design.net.au/about-perth-web-design/meet-the-perth-web-design-team/#Sara
  • David Mårtensson 2011-12-08 15:01
    Peter:
    So... and the cart logic was in Javascript? At least I hope it was just for presentation purposes... but somehow I don't think that's the case


    Writing the cart in JS is not a bad idea as long as you have the checkout serverside along with verifications.

    10 years ago I wrote one in JS myself mostly because the server we used to run on was a bit on the week side.

    Using a JS cart saved on calls to the server as only new pages and checkout ran on the server.

    We handled ~1000 simultaneous shoppers on that server which was an P2 or something like that ;)

    But id did have it's drawbacks of cause, like loosing the cart if you hit F5 (it was before I learned to handle cookies) but customers was satisfied anyway, out site was faster than most other carts :D
  • P 2011-12-08 15:19
    PedanticCurmudgeon:
    Jack Strikes Back:
    Is there any chance that we might make these articles a daily occurrence?
    No, but if you go to the "Side Bar WTF", you'll see 2-3 WTFs per day on average, normally of better (or worse, if you prefer) quality than the front page articles.


    Well. To be honest I would be happy it one day TDWTF run out of materials as there would be no more WTF code. Unfortunately it is unlikely to happen. TDWTF is some consolation however.
  • Nagesh 2011-12-08 15:29
    David Mårtensson:
    Peter:
    So... and the cart logic was in Javascript? At least I hope it was just for presentation purposes... but somehow I don't think that's the case


    Writing the cart in JS is not a bad idea as long as you have the checkout serverside along with verifications.

    10 years ago I wrote one in JS myself mostly because the server we used to run on was a bit on the week side.

    Using a JS cart saved on calls to the server as only new pages and checkout ran on the server.

    We handled ~1000 simultaneous shoppers on that server which was an P2 or something like that ;)

    But id did have it's drawbacks of cause, like loosing the cart if you hit F5 (it was before I learned to handle cookies) but customers was satisfied anyway, out site was faster than most other carts :D


    I don't believe for this story to be real. How did code pass QA and review?
  • Matt Westwood 2011-12-08 15:45
    Fred:
    Larry:
    What's a "browser"? And which end should I point with?
    If you have a good sturdy pen on your desk, that can be a browser. Hold the sharp end pointing toward your chest, near your heart. Then run down the hall until you collide with the wall at the end.


    I just tried that. It went right through to the other side and made an unsightly blue mark on the back of my shirt. I demand that you PayPal me the cost of a new shirt.
  • qbolec 2011-12-08 15:54
    Unless she expected negative amounts of items, this should be shortened to:

    item1 = parseFloat(document.form1.Stitches.value);
    item1price = parseFloat(document.form1.StitchesPrice.value);
    item2 = parseFloat(document.form1.FirstAidKit.value);
    item2price = parseFloat(document.form1.FirstAidKitPrice.value);
    item3 = parseFloat(document.form1.Wristband.value);
    item3price = parseFloat(document.form1.WristbandPrice.value);

    // ...

    item76 = parseFloat(document.form1.HushCD10.value);
    item76price = parseFloat(document.form1.HushCD10Price.value);

    var subtotal = 0;

    var item1total = item1 * item1price;
    subtotal = subtotal + item1total;
    var item2total = item2 * item2price;
    subtotal = subtotal + item2total;
    var item3total = item3 * item3price;
    subtotal = subtotal + item3total;

    // ...

    var item76total = item76 * item76price;
    subtotal = subtotal + item76total;
  • Waiting...... 2011-12-08 16:04
    Waiting for geoffery to explain what I've missed here....
  • Fred 2011-12-08 16:13
    Matt Westwood:
    Fred:
    Larry:
    What's a "browser"? And which end should I point with?
    If you have a good sturdy pen on your desk, that can be a browser. Hold the sharp end pointing toward your chest, near your heart. Then run down the hall until you collide with the wall at the end.


    I just tried that. It went right through to the other side and made an unsightly blue mark on the back of my shirt. I demand that you PayPal me the cost of a new shirt.
    No problem Matt. I don't have PayPal installed on my computer though, so post your bank website ID and password and I'll deposit the money direct. (Use white text so other people don't notice.) How much do you want? Be sure to allow for your time going to the store for a new shirt. I'm not a cheap bastard.
  • Devils Advocate 2011-12-08 16:21
    So they had other priorities (eg making the money they use to pay you) besides refactoring. If you need the code to be cleaner in order to be able to do your job, then refactor it yourself, outside paid hours.
  • Doozerboy 2011-12-08 16:32
    I seriously hope you're trolling
  • Matt Westwood <!-- 2011-12-08 16:35
    Fred:
    Matt Westwood:
    Fred:
    Larry:
    What's a "browser"? And which end should I point with?
    If you have a good sturdy pen on your desk, that can be a browser. Hold the sharp end pointing toward your chest, near your heart. Then run down the hall until you collide with the wall at the end.


    I just tried that. It went right through to the other side and made an unsightly blue mark on the back of my shirt. I demand that you PayPal me the cost of a new shirt.
    No problem Matt. I don't have PayPal installed on my computer though, so post your bank website ID and password and I'll deposit the money direct. (Use white text so other people don't notice.) How much do you want? Be sure to allow for your time going to the store for a new shirt. I'm not a cheap bastard.


    Bank name: WTF Bank, Inc.
    Bank account #: 12345
    Account password: Hunter2
    Deposit $20, please!
  • Jim 2011-12-08 16:40
    Doozerboy:
    I seriously hope you're trolling

    I'd be guessing someone calling themselves "Devil's Advocate" might...nevermind.

    Manuel: Wit Nit? What is Wit Nit?
  • valetudo 2011-12-08 16:41
    Brendan:
    Larry:
    OK... this is finally my chance to learn something on TDWTF... and since my computer doesn't have google installed...

    What are "DRY principles"?


    Probably just an acronym a project manager made up, to make it easy to remember something instead of understanding it.
    Amen!
  • ObiWayneKenobi 2011-12-08 16:54
    Hmm... in the article below this someone says that Alex has tragically passed away, yet this article was posted by Alex (or his account, at least). WTFs from beyond the grave?
  • Nag-geoff 2011-12-08 17:02
    ObiWayneKenobi:
    Hmm... in the article below this someone says that Alex has tragically passed away, yet this article was posted by Alex (or his account, at least). WTFs from beyond the grave?


    ObiWayneKenobi,
    I am convinced you're trolling. Here's a bite for you!
  • Simply Zunesis 2011-12-08 17:03
    Mister E.:
    Upon seeing this portrait, I'm filled with such mixed feelings. On the one hand, simple empathy for the child - I hope everything turned out alright!

    On the other, all the twisted, but amusing and arousing thoughts that crop up. What the kid's dead and that's hoe they frame the advertisement: "We wanted to care for this kid, but didn't have the money, so we ground him up and fed him to the other kids". Something about this inhumanity actually gives me this vague calm, as I no longer feel the need to care for anyone or anything. There's a whole 'nother world out there - a gateway to it is no larger than the eye of a needle and resides in the back of my mind.

    I imagine myself in a plain dirt field, a soft, cool breeze, at night, just me and the child. I take a rock and start by smashing it's limbs (the poor dear) and then move on to the more vital organs. At climax, I'm repeating smashing the reddish goo that is what's left of his face, screaming out the name my ex-wife and I had chosen for our expected, before the miscarriage and subsequent divorce. I guess she just couldn't stand the sight of me after my cold feet caused me to perform an improvised "procedure" on her one night. At the time, I wasn't sure if I was ready to be a mom.

    "Timmy! Timmy! Timmy! Why were you never born, Timmy!"

    Each time I bring down the stone, I become just a bit less human, until I have no more soul than the stone itself or the lifeless mass crushed into the dirt. Who am I now? Why do I go on living?

    "No! Timmy! Just stay Dead! Die! Die! Die! Timmy! Timmy, I'm sor-or-or-rry!"

    Two sides to me, feeding off of each other. The hateful one giving the human one something to regret and the human one providing the hateful one something to try to escape. I realize now that all logic is ultimately circular in this fashion. My motivation drives my actions and my actions allow me to sustain myself to feel my motivation. Love becomes hate, becomes death, becomes death, becomes death, becomes death...

    Even a perfect circle can only be traced for so long.

    "Fuck you, Timmy! Timmy! Timmy, I'll join so soon, I swear! We can be rotten piles of shit together!"
  • Matt Westwood 2011-12-08 17:09
    Fred:
    Matt Westwood:
    Fred:
    Larry:
    What's a "browser"? And which end should I point with?
    If you have a good sturdy pen on your desk, that can be a browser. Hold the sharp end pointing toward your chest, near your heart. Then run down the hall until you collide with the wall at the end.


    I just tried that. It went right through to the other side and made an unsightly blue mark on the back of my shirt. I demand that you PayPal me the cost of a new shirt.
    No problem Matt. I don't have PayPal installed on my computer though, so post your bank website ID and password and I'll deposit the money direct. (Use white text so other people don't notice.) How much do you want? Be sure to allow for your time going to the store for a new shirt. I'm not a cheap bastard.


    Okay, here you are:




    Can I have $2 please? There's one costing £1.50 in the charity shop next door to where I work that looks like it might fit.
  • Matt Westwood 2011-12-08 17:11
    Simply Zunesis:
    Mister E.:
    Upon seeing this portrait, I'm filled with such mixed feelings. On the one hand, simple empathy for the child - I hope everything turned out alright!

    On the other, all the twisted, but amusing and arousing thoughts that crop up. What the kid's dead and that's hoe they frame the advertisement: "We wanted to care for this kid, but didn't have the money, so we ground him up and fed him to the other kids". Something about this inhumanity actually gives me this vague calm, as I no longer feel the need to care for anyone or anything. There's a whole 'nother world out there - a gateway to it is no larger than the eye of a needle and resides in the back of my mind.

    I imagine myself in a plain dirt field, a soft, cool breeze, at night, just me and the child. I take a rock and start by smashing it's limbs (the poor dear) and then move on to the more vital organs. At climax, I'm repeating smashing the reddish goo that is what's left of his face, screaming out the name my ex-wife and I had chosen for our expected, before the miscarriage and subsequent divorce. I guess she just couldn't stand the sight of me after my cold feet caused me to perform an improvised "procedure" on her one night. At the time, I wasn't sure if I was ready to be a mom.

    "Timmy! Timmy! Timmy! Why were you never born, Timmy!"

    Each time I bring down the stone, I become just a bit less human, until I have no more soul than the stone itself or the lifeless mass crushed into the dirt. Who am I now? Why do I go on living?

    "No! Timmy! Just stay Dead! Die! Die! Die! Timmy! Timmy, I'm sor-or-or-rry!"

    Two sides to me, feeding off of each other. The hateful one giving the human one something to regret and the human one providing the hateful one something to try to escape. I realize now that all logic is ultimately circular in this fashion. My motivation drives my actions and my actions allow me to sustain myself to feel my motivation. Love becomes hate, becomes death, becomes death, becomes death, becomes death...

    Even a perfect circle can only be traced for so long.

    "Fuck you, Timmy! Timmy! Timmy, I'll join so soon, I swear! We can be rotten piles of shit together!"


    My first thought was: Poor kid. Some rotten bastard's shoved some plastic up its nose.
  • boog 2011-12-08 17:12
    frits:
    Inb4 thread degenerates into a discussion about trolling...
    And there you have it. Still, I'm surprised - it took more than 7 hours for anyone else to use the word "troll", even with your prediction. Seems like "troll" usually appears in the first 7 minutes.
  • veggen 2011-12-08 17:25
    If I ever feel like hearing about yet another guy copying & pasting stuff yet again, I'll make sure I visit the front page. Until then, I'll stick to the sidebar, where some original content can be found.
  • ¯\(°_o)/¯ I DUNNO LOL 2011-12-08 17:31
    Hmm... type a period. Um, yeah, why is it letting me enter a decimal point into a quantity field?

    Type a minus sign. Nope, it just allows [0-9.] in there. Hmm, copy a minus sign into the clipboard and right-click paste. Yep, now I can enter -99 quantity. Copy the -99 and paste into every field.

    Total amount: -168438.6 (obviously they haven't heard of fixed decimal places either), less six dollars shipping. And that's without hacking the price fields that it trusts the web browser to send back unmolsted.

    Brillant.
  • sagaciter 2011-12-08 17:34
    foo:
    StJohn:
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx

    Seems Josiah put in a loop now. What a fool! Don't break what's working, amirite? (But at least he kept the original code, commented out, in case we want it back instead of his ivory tower fancy loops.)
    Seems they ran out of HushCD9's
  • Luiz Felipe 2011-12-08 17:38
    I refuse to call this crap a "program" or "script". And i refuse to call the people that writed that crap as a programmer.
  • Luiz Felipe 2011-12-08 17:38
    I refuse to call this crap a "program" or "script". And i refuse to call the people that writed that crap as a programmer.
  • sMorier 2011-12-08 17:43
    Nag-geoff:
    brodie:
    Wow.... so, I am in no way an "expert" or "senior" programmer, but this is really bad. How can anyone working on commercial, production code not understand something as simple as loops?


    Loops on their own are pretty much useless. This code needs a total revamp before it can be taken up for testing. I pity the fools who are having to maintain this code. Sadly in the 1990's any fool who could type was qualified to be a computer programmer. Apple had a test where they showed three devices and if you correctly identified the computer, you got a job. In those days' nobody wanted to work with Apple, IBM being the employer of choice.
    Of course the trick was that all of the Apple devices were computers of some sort - even the pen and the mouse-pad
  • Simon 2011-12-08 17:43
    boog:
    J.:
    ... The prices are in the form?
    Sure. How else will Javascript access the prices in order to compute the subtotal in the cart? It's only a problem if the site POSTs the WTF-computed subtotal (instead of computing it on the back end with the real prices). Which wouldn't surprise me.


    Yup, nothing wrong with implementing the cart logic client-side - as long as when it comes time to send the order to the server, the server cares only about the items and quantities, not about prices.
  • Viler 2011-12-08 17:48
    Doozerboy:
    Just wondering why the web designers don't list PMH foundation as part of their portfolio....

    http://www.perth-web-design.net.au/website-design-portfolio/

    On the other hand, Sara.... Hell yeah.

    http://www.perth-web-design.net.au/about-perth-web-design/meet-the-perth-web-design-team/#Sara
    Mate - lucky the boss isn't up himself...Not sure whether there was any more room to put "Perth Web Design" in the description of himself...

    Must say, I don't know about "experience in Search Engine Optimisation" necessarily, but he'll be getting a bit of traffic to his site at the moment - he must be doing a good job...
  • Zombie Timmy 2011-12-08 17:51
    Simply Zunesis:
    Mister E.:
    Upon seeing this portrait, I'm filled with such mixed feelings. On the one hand, simple empathy for the child - I hope everything turned out alright!

    On the other, all the twisted, but amusing and arousing thoughts that crop up. What the kid's dead and that's hoe they frame the advertisement: "We wanted to care for this kid, but didn't have the money, so we ground him up and fed him to the other kids". Something about this inhumanity actually gives me this vague calm, as I no longer feel the need to care for anyone or anything. There's a whole 'nother world out there - a gateway to it is no larger than the eye of a needle and resides in the back of my mind.

    I imagine myself in a plain dirt field, a soft, cool breeze, at night, just me and the child. I take a rock and start by smashing it's limbs (the poor dear) and then move on to the more vital organs. At climax, I'm repeating smashing the reddish goo that is what's left of his face, screaming out the name my ex-wife and I had chosen for our expected, before the miscarriage and subsequent divorce. I guess she just couldn't stand the sight of me after my cold feet caused me to perform an improvised "procedure" on her one night. At the time, I wasn't sure if I was ready to be a mom.

    "Timmy! Timmy! Timmy! Why were you never born, Timmy!"

    Each time I bring down the stone, I become just a bit less human, until I have no more soul than the stone itself or the lifeless mass crushed into the dirt. Who am I now? Why do I go on living?

    "No! Timmy! Just stay Dead! Die! Die! Die! Timmy! Timmy, I'm sor-or-or-rry!"

    Two sides to me, feeding off of each other. The hateful one giving the human one something to regret and the human one providing the hateful one something to try to escape. I realize now that all logic is ultimately circular in this fashion. My motivation drives my actions and my actions allow me to sustain myself to feel my motivation. Love becomes hate, becomes death, becomes death, becomes death, becomes death...

    Even a perfect circle can only be traced for so long.

    "Fuck you, Timmy! Timmy! Timmy, I'll join so soon, I swear! We can be rotten piles of shit together!"
    He remembers me!!!
  • Control C, Control V 2011-12-08 17:53
    If I ever feel like hearing about yet another guy copying & pasting stuff yet again, I'll make sure I visit the front page. Until then, I'll stick to the sidebar, where some original content can be found.
  • Leif 2011-12-08 18:00
    I thought that a real Web shopping cart would keep the items in a database. But then you're of course vulnerable to SQL injection and all that shit.
  • foo 2011-12-08 19:27
    David Mårtensson:
    10 years ago I wrote one in JS myself mostly because the server we used to run on was a bit on the week side.
    Sure. I mean 2-3 days response time is acceptable, but a week is a bit much.
  • SG_01 2011-12-08 21:12
    Andrew:
    StJohn:
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx
    I think I just puked in my mouth a little bit.


    .... javascript: document.getElementsByName('PMHFSupporterPack')[0].onkeypress = null;
    .... Type in -5 in the field...

    Hey they'll send me $100 :D And apparently the shop form is totally happy with charging me -$100. (For the record: No I did not actually put in any details to try if they'd actually send me money through that)
  • Coyne 2011-12-08 23:52
    Zero understanding of arrays.
    Zero understanding of subroutines.
    Maintenance: Horrendous.
  • bob 2011-12-09 02:47
    Well the site was written by Australians, what do you expect?
  • QJo 2011-12-09 03:50
    bob:
    Well the site was written by Australians, what do you expect?


    Please show a little sensitivity. I live in a country from which many of the inhabitants of Australia trace their ancestry, and let me assure you, to have a legacy like that is no laughing matter.
  • a highly-placed source 2011-12-09 04:32
    StJohn:
    Is this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx


    FTFY.

    For added visibility, all the images link to js.popup of the same image. NB: Only work where smaller versions of things are somehow more visible than the thing itself.


    "href="javascript:OpenWindow('http://www pmhfoundation com/Shop/Shop%2BPhotos/Hush_Vol2.jpg',250,250)"><IMG border=0 src="Hush_Vol2.jpg" width=115 height=140></A></TD></TR>"
  • Watson 2011-12-09 05:43
    boog:
    StJohn:
    Could be this site

    PMH Foundation

    http://www.pmhfoundation.com/shop/default.aspx
    Wow. With the same form field names and everything. I thought they anonymized stuff around here.


    They did: the children's hospital form lists "DadsNutsGiftPack" as an item.
  • Jurgen 2011-12-09 06:21
    We've got the same on our project. But the correct terminology is not WET (Write Everything Twice), it's WETT-WETT-WETT (Write Everything Three Times).
  • MarkW 2011-12-09 06:58
    David Mårtensson:
    the server we used to run on was a bit on the week side.
    You have my sympathy. We had a server that was fortnight.
  • L. 2011-12-09 08:42
    David Mårtensson:
    Peter:
    So... and the cart logic was in Javascript? At least I hope it was just for presentation purposes... but somehow I don't think that's the case


    Writing the cart in JS is not a bad idea as long as you have the checkout serverside along with verifications.

    10 years ago I wrote one in JS myself mostly because the server we used to run on was a bit on the week side.

    Using a JS cart saved on calls to the server as only new pages and checkout ran on the server.

    We handled ~1000 simultaneous shoppers on that server which was an P2 or something like that ;)

    But id did have it's drawbacks of cause, like loosing the cart if you hit F5 (it was before I learned to handle cookies) but customers was satisfied anyway, out site was faster than most other carts :D


    /agree

    anyone thinking duplicating the checking on front-end / back-end is a bad idea ... is dumb.

    Just face it, if you actually think that designing a cart for maximum number of requests is smart .. you should shoot yourself right now.

    Yes, it's not fun or stylish to have part of the logic duplicated, but until you alter the laws of physics to make an extra request "not an issue", you are just dead wrong.

    Just ... for one second ... consider the reality we live in, where many people have over 100ms ping . you want to add 200+ms to your user experience (and server load) for every add to cart ?? - seriously. l2c nub
  • geoffrey 2011-12-09 09:40
    Even I can't defend this.
  • frits 2011-12-09 10:08
    QJo:
    bob:
    Well the site was written by Australians, what do you expect?


    Please show a little sensitivity. I live in a country from which many of the inhabitants of Australia trace their ancestry, and let me assure you, to have a legacy like that is no laughing matter.
    Yeah, but you guys didn't want them. You (legally) murdered kids and sent them packing for the crime of being poor.

    Unless you're saying you're from India...
  • tehR 2011-12-09 10:42
    LegacyCrono:
    Larry:
    OK... this is finally my chance to learn something on TDWTF... and since my computer doesn't have google installed...

    What are "DRY principles"?

    * Do it yourself
    * Run Ycursively?

    what.


    When you install the Internet on your computer you need to be sure to download all the software updates, one of which being The Google. He just needs to set his automatic updates.
  • Zekses 2011-12-09 10:55
    Javascript loops give lack of flexibility, more costly evolution, inhibit the use of the database acting as a service to applications and make it an inhibitor to evolution.
  • Nagesh 2011-12-09 11:56
    Zekses:
    Javascript loops give lack of flexibility, more costly evolution, inhibit the use of the database acting as a service to applications and make it an inhibitor to evolution.


    Have you use jquery? Just making some comment with no substence behind is sign of stupid.
  • NotNagesh 2011-12-09 12:33
    Nagesh:
    I don't believe for this story to be real. How did code pass QA and review?


    You must be new here.
  • Jay 2011-12-09 13:18
    Nagesh:
    I don't believe for this story to be real. How did code pass QA and review?


    I assume this is just trolling. If not, then if I'm ever accused of a crime, I want Nagesh to be the judge at my trial. "How could this man possibly have robbed a bank, when robbing banks is against the law? I just can't believe that someone would break a law that's clearly written on a piece of paper. Besides, he plainly told us that he didn't do it."
  • no laughing matter 2011-12-09 15:53
    Nagesh:
    I don't believe for this story to be real. How did code pass QA and review?

    ¯\(°_o)/¯ I DUNNO LOL:
    Hmm... type a period. Um, yeah, why is it letting me enter a decimal point into a quantity field?

    Type a minus sign. Nope, it just allows [0-9.] in there. Hmm, copy a minus sign into the clipboard and right-click paste. Yep, now I can enter -99 quantity. Copy the -99 and paste into every field.

    Total amount: -168438.6 (obviously they haven't heard of fixed decimal places either), less six dollars shipping. And that's without hacking the price fields that it trusts the web browser to send back unmolsted.

    Brillant.

    To me it seems they have found a cheap and effective way to outsource QA and review.

    Seems they are quite fundamentalist followers of the Worse-is-better-process!
  • no laughing matter 2011-12-09 16:03
    tehR:

    When you install the Internet on your computer you need to be sure to download all the software updates, one of which being The Google. He just needs to set his automatic updates.

    And make sure you have a recent drive installed with enough space on it:
  • Josiah 2011-12-09 22:53
    LOL! Nope its all in Javascript. Still is :( the design firm is trying to convince the client to bring their website into 2011.
  • Renderman82 2011-12-10 09:17
    So... it seems like the site is down. No custom error page as well...


    Server Error in '/' Application.

    Column 'id' does not belong to table Table.


    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Column 'id' does not belong to table Table.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:


    [ArgumentException: Column 'id' does not belong to table Table.]
    System.Data.DataRow.get_Item(String columnName) +120
    Photoplay.Site.SiteInfo..ctor(DataRow drow)
    Photoplay.Site.SiteUtility.GetSiteInfo()
    Photoplay.Site.SitesModule.Application_BeginRequest(Object source, EventArgs e)
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87

    Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407
  • Sole Reason For Visit 2011-12-10 13:06
    Larry:
    OK... this is finally my chance to learn something on TDWTF... and since my computer doesn't have google installed...

    What are "DRY principles"?

    * Do it yourself
    * Run Ycursively?


    Finally?

    OK, kid, let yourself rip.

    Bing is your friend.

    Also Dave Thomas and his motley crue of Pragmatic Programmers, but you'd actually have to read them on dead trees for that.
  • John Hensley 2011-12-10 16:33
    TRWTF is commenting out old code.
  • Keep on derpin' 2011-12-10 17:33
    Ken B.:
    LegacyCrono:
    Larry:
    OK... this is finally my chance to learn something on TDWTF... and since my computer doesn't have google installed...

    What are "DRY principles"?

    * Do it yourself
    * Run Ycursively?
    what.
    Google has a virus, so they uninstalled it. Didn't you know that?

    http://clientsfromhell.net/post/13880316592/
    Thanks, I just blew three hours reading stuff on that site. Here's one of the best ones:

    http://clientsfromhell.net/post/11446576194/client-i-dont-want-to-download-it-just-give-it
  • Howling mad 2011-12-13 11:57
    He was having performance issues and was trying to optimize out the branch from the loop, this is a normal coding practice
  • Jeremy 2011-12-13 17:05
    I wrote a program a lot like that in QBASIC. When I was 5.
  • Nagesh 2011-12-14 16:23
    Jeremy:
    I wrote a program a lot like that in QBASIC. When I was 5.


    Jeremy,
    How old are you now?
  • UnStandard 2012-02-15 17:26
    OK I'm surprised no one caught this - TRWTF is including jquery just to "tighten up" this code, addressing only this issue.

    While jquery can be handy, it most certainly is not required or appropriate for this.

    Looking at the code on the site, it appears that Josiah has included 274.34 KB of jquery code to "reduce" 31.9 KB of code to 1.69 KB (+274.34 KB of jquery code).

    This is exactly when you do not use a library.
  • malik 2013-10-17 03:52
    what a smart guy, he can handle 76 items in a cart at once :D !