In Which We Discuss The Evil That Code Generators Do

So I help out a local nonprofit here and there. They’re very cool people and they do very cool work. Since web stuff is what I do, I’m also rebuilding their site to avoid the abomination that is Frames, and since I’m doing that, it occurred to Ms. Intrepid Managing Director to call me this morning when they couldn’t get their PayPal buttons to work right on their gala ticket sales page.

Apparently, PayPal has a very nice, friendly tool for creating these buttons. You hand the PayPal site the appropriate information, and it spits out a lump of code you stick into your HTML file and bammo! You’re done!

Well, you would be if Dreamweaver weren’t in the picture. Apparently, by default ol’ DW will change form variable names for you when you paste in code if it senses name duplication. Since each button is its own form in the PayPal paradigm, this meant that the meaningful variables (“cmd” and “encrypted”) occurred six times on the page — so each one we given a number suffix. This is utterly absurd, since each variable was in its own form, and therefore its own namespace; no collision was happening. PalPal’s script, to which the form posts, knew nothing of these new names, nor should it have. Consequently, the buttons didn’t work. So, as I said, Ms. Intrepid Managing Director called me, and I called PayPal.

The bright side of this is that PayPal’s tech person was extremely helpful, but the bad news is that the help she gave would have been almost useless to a non-programmer. Their tool assumes the user will cut and paste the code as if it were an incantation to be recited but not comprehended. That’s fine; I’ve done the same thing, and it’s very common on the web for things like buttons, logos, and the like. The problem is that DW decided to “help,” and in doing so created a situation from which the inexperienced cannot easily recover. I’m told that this behavior is an option that a user can disable, but that’s pretty cold comfort — I mean, under what circumstances would it be okay for any development tool to unilaterally change variable names for you?

Now: if you’re a pro, (1) this never would have happened to you because (2) you write HTML in a plain text editor to avoid the kinds of pitfalls that generated code creates. So we’re left with amateurs who are less able to troubleshoot their situation than geeks like us — so why, again, is DW doing this? Are they taking lessons from Redmond about destructive and absurd defaults?

Comments are closed.