Mutual Understanding June 5, 2018

In the previous article I asked why it is that when we speak to computers we use a kind of "baby talk" that makes it easy for them but very hard for us. We've had personal computers for over 40 years now and their power has grown immensely, but we still twist our minds into knots to describe things to them rather than expect them to understand our language. It's often claimed by the software industry that there's no alternative, but there are reasons to be suspicious of this claim.

Surely the existence of SQL gives the lie to the claim that computers don't and can't understand human language. Here we have a scripting system that is readily understood by people of all kinds; not just programmers but anyone who needs to store and retrieve data for whatever purpose. So what's special about SQL that sets it apart from C, Java and the rest?

Well, firstly SQL is highly domain-specific. Everything in the language relates to databases; it doesn't try to do graphics, music, web pages or navigation. So although it's not a large language, every term it contains is related to the domain it covers.

Secondly, SQL makes somewhat less use of symbols than other computer languages, in proportion to the overall character count, at least. The higher the density of symbols the more difficulty people have in quickly absorbing the meaning of a sentence.

And SQL sentences tend to look like English sentences, providing a further aid to understanding.

Now I cannot cite a definite proof for this, but I am fairly convinced that major software disasters are relatively rare in the world of SQL. Where things go badly wrong they tend to do so in other areas of a project. If I am right it's because of one thing; that the ownership of the code has not been delegated. The owner of the code is a database user, not a programmer. The project may well have employed a programmer to build the database code but the individual SQL commands still remain accessible to the owner. There's a saying that "given enough eyeballs, all bugs are shallow". The more that people outside the programming team are able to monitor development the less the likelihood that serious mistakes will happen.

Whether or not my crazy theory has any basis in fact, it's worth asking if the principles of SQL might be applied to other domains. Because in general they aren't. SQL is an example of a computer program that understands English-like statements if they are carefully written in a standard syntax and use known keywords.

What if we could do the same for other domains? Take web pages, for example. One of the fundamental uses of the React framework is to describe web pages, building them on the fly in the browser instead of loading them from the server. There are two ways to do this; one involves constructing JSX (XML that looks very much like HTML) and passing it through a JSX precompiler running in the browser to convert it regular JavaScript, which is then run along with the rest of the JavaScript code that deals with event handling and other things. The other way is to dispense with JSX and just write the functions that build the DOM objects.

But whichever route is taken it still looks like JavaScript, with or without extra blobs of XML. This is not something that most web designers can handle comfortably. Let alone the thousands of amateur and semi-professional WordPress users building their own websites.

None of the other available frameworks get any closer to handling a project expressed in plain English, the test being that it makes sense to a non-programmer when read out loud. That's a particular challenge but I won't settle for any less. After all, I can speak to my phone and perform a variety of useful tasks, so don't tell me it's not possible to write computer software that can process a constrained version of natural language.

I'm not trying to say that traditional computer languages should be thrown out and replaced with natural language. There are some things so complex they cannot be expressed easily in a spoken form and require a formal implementation such as modern computer languages offer. SQL itself has to be written in something, after all. But if a problem can be talked about and explored in natural human language then we should do our best to maintain that advantage all the way through to the code we provide to the computer.

Categories: Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *