Tuesday, July 19, 2022

Perspectives on web development

When we look at what web development was like at the turn of the first decade of the twenty first century, it had a number of problems. These problems influenced my decision to pick up Clojure at the time. I have identified these problems primarily as lying in the ackwardness of interfacing between HTML, CSS, JavaScript, and PHP. I have identified two ways by which modern JavaScript developers have solved this problem:
  • NodeJS: this solved the distinction between JavaScript and PHP.
  • JSX: this solved the ackwardness of the distinction between JavaScript and HTML.
It was inevitable that with the very real problems and limitations of full web stack development at the time, that JavaScript developers would eventually solve them. I think that especially with the introduction of NodeJS and JSX they solved them pretty well. With these new technologies, modern JavaScript is potentially an enjoyable experience.

NodeJS
In the old days JavaScript was just a browser scripting language. It had no means of server side development, so the use of a server-side language like PHP wasn't simply a choice it was a neccessity. The introduction of NodeJS changed all that, because now it meant you could use JavaScript on the server, and so server-side JavaScript really took off. This made full-stack web development a much more pleasant experience because then you could use JavaScript on both the client side and the server side.

JSX
JavaScript was originally used only to script web pages in the browser, but even then the vanilla JavaScript language that comes installed in most browsers is not a particularly nice way of manipulating HTML. HTML seems like a foreign technology to vanilla JavaScript. The new JSX technology solved this problem. With JSX you can freely combine HTML and JavaScript in the same file, and this is further extended greatly by React.

Modern full stack development with JavaScript
The problem of the distinction between various text-based languages like JavaScript, PHP, HTML, and CSS has basically been solved by the modern JavaScript web development stack. With NodeJS you can use JavaScript on both the client and the server sides, and with JSX you can unify HTML, JavaScript, and even CSS. With NodeJS on the server side and JSX and React on the client side, we have a better approach to full stack web development then before.

Full stack development with Clojure
The situation with full stack web development with Clojure is similar. You can unify client and server sides using Clojure and ClojureScript. Further, we can unify Clojure and HTML using Hiccup, and you can embed CSS in Clojure using Garden and similar technologies. This provides a unified development experience much like modern JavaScript. As both Clojure and modern JavaScript provide unified developer experiences, neither one is better at web development then the other.

The advantage of Clojure comes from being a modern Lisp for the JVM. The JVM is the best engineered piece of software in the world. It has the best tiered just in time compiler architecture with the C1 and C2 compilers. Its instruction set architecture is best architecture for hosting languages. It has the best set of programming languages. It comes equipped with the best set of libraries. Java interop is the biggest advantage of Clojure.

No comments:

Post a Comment