webonastick.com

Why IHTML is the worst programming language ever.

This was originally posted in some form on the Something Awful Forums many moons ago.

I was told a long time ago that IHTML is one of the first Web scripting languages that used tags which look similar to HTML tags, and it's since had numerous features hacked onto it. You simply cannot write maintainable code in this piece of crap. While working at n + 1, I had the "fortune" of working on some existing sites that used IHTML from a company called DigiCove. DigiCove actually prefered this platform for developing clients' web sites. I speculate that IHTML is probably responsible for drying up DigiCove's business.

I suppose you want specific reasons why I would rather drive rusty nails into my testicles than ever write code in IHTML again.

1. Regular variables, cookies, and HTML form data use the same namespace. I have only seen this retardedness in really old versions of PHP. register_globals has been off by default in PHP for years, and is going to be removed from PHP 6, and that's for a reason.

2. IHTML's official documentation says that if you want to extract the filename from a pathname (i.e., the remaining contents of the string after the last slash character), you would use the ISTRREV function to reverse the string, chop off everything after the first slash, and ISTRREV the string again.

I am about to make a statement that I have never made before about a programming language other than INTERCAL. Even C requires fewer lines of code.

3. The function you might use to convert strings containing special HTML characters (" ' & < >) into their respective HTML entities (&quot; &#39; &amp; &lt; &gt;) so you can display them, put them in attribute values, and whatnot, is called IHTMLDECODE. And it does not encode all of those characters. This is basic functionality that is necessary for writing secure web applications that don't break because the user supplied the "wrong" data, people.

4. Let's say you wanted to take a string variable and compute its length. In IHTML you might say something like <ISTRLEN SRC=":strvar">. If your :strvar contains any " characters, you have to use another delimiter. I believe you can use ' (apostrophe) and ` (backtick). If your text contains ALL of those delimiteres you're just plain screwed. Maybe I'm just being paranoid here, but having a certain character in a textfield should NOT trigger a goddamn bug. I've spent many hours tracking down problems resulting from this exact issue.

5. Here is an example of what nested IF statements look like.

	<IIF COND="..." ALIAS="if1">
	  <IIF COND="..." ALIAS="if2">
	  </IIF ALIAS="if2">
	</IIF ALIAS="if1">
	

Yes, that's right. IHTML cannot determine which opening tag each closing tag matches on its own. You have to add those ALIAS things so the parser will know which </IIF> tag matches each <IIF> tag. This might actually arguably good if you're at the end of a long IIF statement and you need to quickly find which opening IIF tag matches a closing IIF tag. However, IF statements in any language that take up more than a screenful or two are a sign of bad code.

I'm not making this crap up.

If for some reason you must use a programming language where everything looks like HTML tags, then you're still insane, but get a copy of ColdFusion. It has proper HTML escaping functions; and it's actively developed, maintained, and supported. While ColdFusion still sucks, it sucks less than IHTML.