Isomorphic JavaScript myth

Isomorphic JavaScript is the idea of writing JavaScript that can run on the server just as well as in the browser, thus your otherwise frontend-only single page app (SPA), which only makes HTML appear after some post-load requests and execution, can also render the same HTML server-side (which is how things used to work) and give something to search engines to understand. AngularJS required hacks using PhantomJS to achieve this, by running a headless browser on your server.

In theory, a full stack web developer then only needs to know one language - JavaScript. In practice, knowing how to string together jQuery selectors does not prepare one for writing EcmaScript 6 JS code running on Node.js. You need to learn the patterns for dealing with every I/O operation being async. There's no DOM, and no window object. There are a number of newer APIs which modern browsers support (e.g. Crypto) which don't exist in the Node environment. Node is its own separate runtime environment as well as dev ecosystem with modules and chained dependencies. The syntax of the language is just a part of learning how to write in a language.

However, we are moving towards a more isomorphic world (excusing the fact that isomorphic outside of the context of programming JavaScript means something completely different). Frontend-only JavaScript developers are a dying breed, and it's not clear all of them can tool up to the Node/npm + command line + transpiling workflow. This also means more "backend" code is actually downloaded to the browser, leaving only bare APIs as pure server code. Note, though, that isomorphic JavaScript doesn't mean 100% JavaScript, but that the same JavaScript code which calls REST APIs from the browser can also fetch data while still running on the server, e.g. to pre-render the site for first-time loading or for search engine crawling.

In the end, does it mean there's only a single language for front- and back-end? It makes sense up to the event horizon of the REST API. Whether JavaScript is an appropriate language for non-web programming then is up to the team and the project.

Add new comment