Thursday, August 26, 2010

An adventure in real world programming with 5 languages


I wanted to build a tool which I can use on my mobile (Android, HTC Desire); not finding a path to compile Haskell to anything executable on the mobile, I decided to follow advice from Building iPhone Apps with HTML, CSS, and JavaScript to build a web application using Haskell to construct the web server with Yesod .

What I did not expect was the number of un-coordinated and slightly different languages I had to learn. The project included a total of 5 different computer languages:
- Haskell, for programming the application,
- CouchDB (fortunately accessible from Haskell),
- javascript, to code the building of the index in couchDB,
- HTML, to describe the structure of the output,
- CSS, to describe the appearance of the web page.
Modern computer languages are quite similar, but differ in small ways: how do they deal with white space and what is white space? how to insert a comment? how to 'escape' a character, which has a particular meaning?

In the process I was reading documentation, and could not, for example, find an advanced, well structured description how to use HTML and CSS; the specification is readable, but does not indicate how the various features, which seemingly are producing the same effects, are best used, to avoid their quirks. Not only had I to learn the languages, but also to find specialized editors and tools for debugging (e.g. a Firefox extension to see what HTML and CSS arrived at the browser) - each tool with its own set of 'small differences'.

I succeeded, but two questions remain, one existential, one social:
- is it possible, to build a web application in a single language (specifically: in Haskell)?
- why do the 'real programmers' accept this sorry state of the world?

The first question leads to a testable hypothesis, which I hope to report about soon; the second reminds me of an observation of a social science researcher (I do not remember who it was), who pointed out that social institutions oscillate to a middle ground of complexity. If they are so simple that everybody can understand them, ingenuous people make them more complex; if they are so complex that nobody can use them any more, efforts to simplify are made. I guess, social systems need complexity to differentiate between amateurs and experts; complexity assures income to experts. This seems not only to apply to the legal system, with layers and tax advisers, but also to programmers?

No comments:

Post a Comment