Pseudoprogramming

What are I going to gripe about today? How about: “programmers who think they are going to make other peoples lives easier by letting them program in a new language that is less complex.”

OK, the motives are good: “Programming is complex. Many people are intimidated. Let’s make something that they will be less afraid of, and still accomplish the job.” Pumped up with virtue, they launch into making a “simpler language”.

Simpler than what? Complete programming languages: Java, C++, C#, VB, PERL, Smalltalk, COBOL, LISP, and yes even FORTRAN. You have a lot of languages to choose from. Any programmer worth their salt knows a handfull. These are “complete” languages. They stand on their own. You can make complete programs from them. After you get the hang of a few of them, you find that you can program just about any program in any one of them. Sure, they have differences. There is no question that different languages are better (or worse) at different tasks. But for the most part, the algorithms behind most tasks will be pretty much the same. There is a certain universality to programming that comes from taking a problem, breaking it into a sequence of distinct steps, that manipulate values stored in addressible locations.

I have my favorite languages. My favorite languages have changed over time. The language that I find easiest to use for almost any purpose tends to be the one I am most familiar with. I do mostly Java right now. A few years ago it was PERL, adn before that C++. Before that Java, and before that C++, and few other languages I am trying to forget. See I have switched back and forth a few times. And what I have found that any one of these langauges can do the job. The only thing that is complex is using multiple languages at once.

Learning and keeping in mind one syntax is comfortable, but switching back and forth between multiple langauges on a daily basis is more complex, more tiring, more accident prone, and just plain more difficult. It is impossible to do everything in one language. You have to know HTML to generate web pages, and maybe even JavaScript. You have to know BAT files or shell scripts to automate simple things, and maybe MAKE or ANT scripts. There is a clear tendency for people to avoid learning new languages for special purposes. Learning a new language is hard work. Mixing languages at the same time is hard work. It is far easier to keep everything in one language if you could.

Scripting languages: there is also a place for scripting languages. Sometimes these are complete enought to make whole programs, but usually they are used to string together blocks that are composed in a complete language. Again they are necessary, but keeping the number to a minimum simplifies the world.

PseudoLanguages: so what am I griping about? Languages invented by programmers precisely because they are “easier” to use. Usually these pseudo languages are not that well thought out. They tend to be fad-ish. Non-programmers tend to balk at the amount of punctuation that they see in a piece of code, so these simplified languages often try to use less punctuation. Often they try to use English language words on the assumption that a familiar word, even if used in an incongrous way, will be easier. There is often an attempt to make it like a natural language, but in fact even though some sentence look a little like an English sentence, there are many many English sentences which make no sense in that langauge.

Another recent fad is to use XML as the basic syntax. XML is a strong and important syntax for representing data of all forms. It certainly can be used to form a programming language. Ant and XSLT do this, and they are fine. But don’t think that that just because a language is based on XML that it is easier to use.

But my pet peeve this week is JSP tag libraries. JSP files are hideous enough. You have HTML framework, with Java embedded within it, and the parsing rules change within the JAva sections such that the resulting file is neither wholly HTML nor Java. I certainly understand why someone would want to make this better. But inventing tags is not the answer. Now you have a third language. The syntax of a tag is neither HTML, nor is it Java syntax. The dream I suppose was to eliminate the need for Java, but it fails to do so, so now you have three constructs mixed together. Again the motive was that people who do not know Java could construct JSP pages. Dream on. There is nobody making JSP pages who does not also know Java. Just because you can make commands using angle brackets does not mean that it is “easier” to use. There is no indiciation that this new tag language reduces the amount that you have to learn. You still have to construct loops. You still need variables. In my experience, adding a tag library to a JSP only makes it more complex, which is harder to use. Like most pseudo languages there are special cases that are easier to program, and these are used as examples, but because tag library is not a complete language, it can not be used on its own to write a complete program, as soon as the example gets more complex than the simple cases, the argument falls apart.

That is my gripe for the day. If you are going to use JSP pages, and since you have to know Java anyway, you are far better off just sticking to the Java for everything. Fewer languages means easier programming. It is that simple. Psuedolangauges only make the job more difficult, no matter how misguided the motive is.

Leave a comment