overwatering.org

blog

about

The modern web is an amazing piece of technology. It is a platform for connecting people and technology in a way few imagined. This would never have happened by attempting to design it all up-front. As an industry, we have really started to care about the design of applications: from the implementation to the user’s experience. This is genuinely great, and I’m proud to use this tech to build apps. I’m also excited at the efforts of really smart people to improve this world. But as I’ve mentioned, I think the current stack is an abomination. Especially for people who are not programmers, and never will be.

To build a modern web application, you will need four pieces of technology. For the user interface in the browser: HTML, CSS and JavaScript. On the server, one of the back-end languages: choose from Java, C#, Ruby, JavaScript, Clojure, Python, Go, or many, many others. Typically you’ll have some sort of data store as well, but not always.

For the absolute simplest application you could build you need four separate languages. Four. Sure, you could use JavaScript on the back-end as well, but Node.js is so different from in-browser JS that you may as well be learning a new language. So, four. Four languages to learn. Before you can even start to build anything. Without even considering how you’ll get this running in someone’s browser.

HTML is mostly pretty good. It’s a reasonably straight-forward way of describing the structure of your user interface. It’s designed to focus on meaning, and be entirely declarative. There is something of a bizarre modern obsession with continuing to make HTML easy for humans to write, over making it easy for computers to read, but that’s minor. It’s biggest failing is that it’s not self-extensible: in HTML I can’t create a new HTML element, define how this is produced from other HTML elements and then go ahead and use my new element. In a normal programming language this is the sort of abstraction that you’d get from a function.

JavaScript is at least a programming language. When you squint at it just right, it even seems to be a good one. Therein lies the problem: any language that requires you only use the good parts is always going to be hostile to new users. Some would argue that it’ll also be hostile to experienced users as well. How do you know what the good parts are? What if people disagree? In the case of JavaScript, The bad parts are especially bad. Scoping is weird; the this reference changes meaning; object creation is confused. Having bad parts is not surprising: JavaScript was implemented in six days and then rushed out the door before it was complete. However, it is the single ubiquitous language. JavaScript runs everywhere (that matters.) Unfortunately, that browser environment is itself pretty confused.

There are efforts to fix the problems. Many languages are being built either to entirely replace JavaScript, to augment it with better features, or to improve the syntax: CoffeeScript, Dart, TypeScript and SoundScript. I’m sure there are many others. The issue here is that these languages are improving along the same philosophy as back-end languages: to make professional programmers more effective. This is great and a worthwhile aim. It is no help to those who are not programmers, however.

CSS is the worst of the lot. The underlying model is confused, so confused that it took over a decade for browser implementations to converge. But the language itself is horrifically lacking in basic features: there’s no abstraction, no expressions, no variables. Everything must be pre-computed before it can be inserted into CSS, and CSS itself has no way to avoid repetition. Of course, there’s a plethora of languages to make writing CSS easier: SASS and Less are probably the most popular.

Like the JavaScript replacements, these languages can’t be used without first knowing CSS. Using SASS, for example, might make an experienced designer much more productive but it does not reduce the number of things a new programmer would have to learn.

My background is in R&D and using computer science to build complex products. I only made my way into web applications and web design through the course of my career. Given my background, I know that the computer screen is just a field of pixels of almost infinite possible colours, that the maths to produce beautiful graphics is very well understood and highly optimizable, and that modern graphics hardware is amazing in its power. Over the years I’ve frequently been shown beautiful web designs with “Look at this beautiful web page we built!” While they have been beautiful, my reaction has always been “so what?” It’s readable, usable and even pretty but it’s not art, so what do I care — graphics are a solved problem. Eventually I figured it out: there was a missing “despite CSS.”

And these three horrible languages have radically different syntaxes that you’ll need to learn. And there’s no easy way to embed one within any of the others. And for anything but the most trivial of apps you’ll need at least three different files. And that’s going to make it hard to share with anyone else. And you’ll inevitably find something goes wrong when you try to host what you’ve built on the web where someone other than yourself can see it.

And all this without even talking about getting it to work with any kind of back-end.

There must be a better way.