Four Eras of JavaScript Frameworks
pzuraq.com
pzuraq.com
> JavaScript was first released in 1995. Like I mentioned
> above, I started writing JS in 2012, almost two decades
> later, near the beginning of the era I’m dubbing the
> First Frameworks.
> [...]
> This contrasted pretty significantly with mobile apps
> when they started to hit the scene. From the get go,
> mobile apps on iOS and Android were full applications
> written in Serious Languages™ like Objective C and Java.
I'm going to make a small jump to conclusions and guess the author is too young to have accurate memories of what web development was like pre-2010.Gmail was released in 2004, Google Maps in 2005, Google Docs in 2006. All of those used JavaScript technologies (GWT and Closure) that enabled web UIs to go head-to-head with native applications of the era. There was an entire generation of JS frameworks (maybe two?) that rose and fell before the release of the iPhone.
The primary difference between GWT/Closure and what we've got now is that JavaScript was treated as a compilation target, not a developer platform. The tooling was all in Java or C++, there was no concept of writing a transpiler or bundler in JavaScript and no culture of standalone JS interpreters. IIRC the only option at the time for running JS on the server was Rhino (based on Netscape/Mozilla), which for whatever reason never saw the broad adoption of Node.
1. V8, which is actually really fast
2. Hype around being _asynchronous_ at the time JS itself started to become more hyped up.
For whatever reason, you could have done this stuff in Rhino - for better or for worse - it's just that nobody ever took it as seriously.
A "people actually used this" framework that had Rhino at its core (well, in one of many ways of using it) was Apache Cocoon (which was maybe more by-default based in XSL/T), only they did something almost ridiculously clever: as Rhino had full support for continuations, they didn't need "callback hell" (or async/await) and could even support pseudo-synchronous code that could block on the user (such as a function which sent the user a form and returned the user's selection, possibly hours later) by storing the continuation state in the user's session.
Wow! I'd only dabbled in Rhino back in the day so this is a neat little bit of history. Teleports me back to when this stuff felt fun...
On the other hand, I never heard of Rhino until now.
With npm it's also really easy (almost too easy) to take your current folder and push it to npm, making the ecosystem bloom with packages.
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
Most IDEs will automatically pick up the .venv folderI admit that I'm not a Python engineer, but I have been in the past—twice!
Since those version ranges of X don’t overlap, it isn’t possible to satisfy both A and B’s requirements. Node can handle this
In pip or composer, those dependencies have to be forked or removed or they will create conflicts.
Suppose I use a LibraryX that provides DataTypeX, and most of the functions in my project operate on DataTypeX. I later add another LibraryY, because it provides a utility function returning DataTypeX. I should be able to take the result and use it anywhere in my existing code. However, if my direct dependency on LibraryX is a different version than transitive dependency on LibraryX through LibraryY, then it may not have the same functionality. In trying to avoid a problem at compile-time, the package manager has introduced a huge potential problem at run-time.
With pip you have to resort to hacky solutions like like pip freeze. It also doesn't solve circular dependencies. Luckily these days the Python world has Poetry, which exactly solves this issue, and might be even better than npm. Unfortunately it's third party and adoption is a bit slow, but I use it for all my projects.
If package A depends on package B 1.0 and package C also depends on package B but 2.0, the order in which you run pip install for A or C will lead to a different version of B. And of course either A or V would break as soon as they hit an incompatibility. Obviously you would notice that only by running the application or tests.
So you have to use pip freeze to kind of generate a semi lock file,and every project uses it in a different way, because you also need different dependencies files for dev and production....and these are just plain TXT files which I don't think it is the best "format" for this.
Then you have these text files but also a "setup.py" which is for the package you produce, but hey you need to read the txt because otherwise you need to maintain them in two places. So you add a Makefile to tie all of this together, and that's another rabbit hole.
Add to this the mess of virtualenvs already explained in sibling comments and you have the perfect storm.
I know that nowadays are things such as Poetry, which work a lot better, but there are a good bunch of tools competing with each other.
To make an analogy, npm feels like using the latest, top of the line Macbook while pip feels like using a Casio calculator from 1985 with an external keyboard. That's the gap I feel between these two tools.
So if you ever use python, try first poetry or any of the other tools, pip is a terrible mess.
What's so "mismanaged" about pip? Honest question, I work with NPM every day but I've never really touched pip so all.
Maybe it didn’t have package signing, lock files, or deduping, but clearly it was popular in spite of those faults.
I hate all of them, use only when it’s almost inevitable, so I can’t really have an objective opinion.
Though it clearly worked well enough to be fantastically successful despite valid complaints about it.
At the time, there were JS/CSS/image minifiers in just about every language IIRC. Doing it with Node was a stronger argument to at least save the frontend side of the house from having to find a way to do them with Java or ASP.
During that time period, Java compile times were so slow that using PHP as a frontend that spoke to Java backends with SOAP services was really, really common just to avoid slowing everything on the frontend down with Java.
There was SSJS on NES/iPlanet/whatever before that. I mean, it existed. It was not really useful and few people even noticed it existed at all, but it did exist.
https://en.wikipedia.org/wiki/Oddpost
MS themselves had fairly functional Outlook web interface in 1995 (and was the reason XMLHTTPRequest was introduced
That said, I think it's an important landmark and I may end up revising this post to add a bit more discussion about it. Thanks for pointing it out!
Silverlight had the best performance/fit for my purposes and sadly was the first of many to go away, largely due to the popularity of iPhone and these platform/tools being excluded. Too bad Apple only promotes Apple's innovations and actively suppresses others.
I manage a web UI programming language in my free time, and the juxtaposition of folks claiming FP ergonomics benefits, then upon my request, showing a static, interaction-less end result whose improved version would obviate their pristine architecture, is pretty staggering. The typical defense is "hey we're not designers" but if you zoom out a bit you realize the whole environment doesn't foster engineers to care about design concerns anymore (barring a niche but valuable vertical of optimizing for payload size). This in turn puts pressure back onto designers who come to expect less and less of what they care about on the web.
Just the other day a newcomer shipped an animated row transition after fighting her framework for 3 weeks. The designer was delighted, but the manager didn't even get the point because he matured in whichever era of JS framework that de-emphasized acquiring taste in interactions.
I myself come from a Flash background, so rather than seeing an upward trend, I see a decline in UX concerns, followed by an incline of devops-related concerns in UI frameworks (accompanied by HN comments saying that in both cases the web should have stayed as a document format, only to end up with an awkward mix of document + app architecture their desktop apps through Electron anyway).
If I were to categorize these "eras", I'd rather take the perspective of wondering at which point, and why, framework process ended up more important than the product. Heck, a similar thing is happening on native too, unfortunately. Where did all the interaction designers go?
Maybe AR would nudge more folks to learn and focus on rendering, gestures, transitions, framerate, intent and the rest.
Furthermore, there really wasn't very widespread "community" use of GWT (mainly Google, and outside of that, mainly oldcorps working at similar scale to JS-ify old corp codebases), and even Closure was mainly leveraged by the community as glorified early babel / webpack type tooling, rather than a full range of things, e.g. Clojure.
All that said, calling React a "framework" is a big stretch, which makes the title questionable while one is reading through the components section, so I guess one could get away with including a few not-framework-ey things.
But... overall I don't think the author's age hampers them as much as you make out: when I started programming in JS circa 2002, nothing existing in that ecosystem was really comparable to today's frameworks, so comparing them here would add little.
Folks are building with a 20+ year old idea that has continued to evolve, in part because JavaScript is ancient in internet terms but uniquely positioned as one of the only languages (if you could call it that at the time) that was web first, instead of a traditional programming language having to connect to the web via a framework.
Ironically, the core feature for web apps in the browser to enable this existed thanks to Microsoft.
Brutally simple, efficient and likely part of what gave rise to so many JavaScript frameworks since people generally had to roll their own.
I’m sure there might be some here who reverse engineered what Outlook Web Access was doing.
“ The concept behind the XMLHttpRequest object was originally created by the developers of Outlook Web Access (by Microsoft) for Microsoft Exchange Server 2000.[4] An interface called IXMLHTTPRequest was developed and implemented into the second version of the MSXML library using this concept.[4][5] The second version of the MSXML library was shipped with Internet Explorer 5.0 in March 1999, allowing access, via ActiveX, to the IXMLHTTPRequest interface using the XMLHTTP wrapper of the MSXML library.[6]”
Building an app in the browser was not a popular idea partially because of the instability of high speed internet and the lack of performant mobile internet, and if imaginable, the lack of users on the web at that time. The first major rush of users online was likely Facebook.
Still it was possible to build a full ms office UI clone working in the browser, except it was powering your custom app.
Sometimes things are gaining popularity for a long time before they suddenly get discovered. This single call was a reason why jquery became so popular.
What I enjoyed about this article was how it speaks to an internet generation of tech or users emerging every 2-3 years, something I have long felt. Everyone starts somewhere, everyone is new to learning something and those experiences are worth sharing for new developers who do not quite have their compass in place yet.
I worked at a company around 2001 that was doing a full "Ajax" style frontend for a dashboard product for some industrial control systems. But it worked in IE only, as the Ajax pieces were not available on the other browsers yet.
Memories. I remember discovering any of these existed after doing an entire AJAX frontend site with raw JS that continued to work cross browser for the next 10 years. Made me full appreciate the value of those frameworks. IIRC JSON wasn't even really a thing yet.
I guess the difference is these new frameworks are all about letting javascript generate virtually the entire page. MooTools and friends were designed where the majority of the page was old-fashioned HTML being spat out by the backend.
1) Libraries (jQuery/Prototype/MooTools/etc) (Beginning - ~2010ish)
2) Widget-frameworks (YUI, Dojo, jQueryUI, etc) (mid-2000s - ~2013ish)
3) Data-orientied Frameworks (Backbone-onwards) (~early 2010s - current)
Edit: (Four, maybe, if you divide 1 into a 1/0 era, with 0 being the "rando DHTML scripts that many didn't really understand" era)
I do hope that we can get back to that "JS as compilation target" model eventually with WebAssembly. Even with improvements like TypeScript slathered on top, it's not fun writing Javascript, the tooling sucks, and it's vastly less productive than better developer ecosystems.
Not really true[0]. You could run server side JavaScript with JScript[1] on IIS as far back as the days of IIS 3.0, circa 1997. JScript is ostensibly JavaScript and tracked the original Netscape releases and then the ECMA standards.
[0]: depending on your love/hate with Microsoft at that time :)
Lots of dynamic (and complex) web-based CRMs were competing with each other in 2000. At my job, we were doing what is called "HTML over the wire" today by posting forms and using a frame as the target.
LiveWire's unpopularity and subsequent death was often attributed to its need for compiling and bundling steps, which seemed cumbersome to the JS devs at the time.
In fact when I got to Google in late 2011, I believe the only thing I could confirm using GWT seriously was some display ads admin tools.
GWT was awful. And not really used inside Google much.
GMail, AFAIK, never used GWT for its UI
A bunch of people messed with Rhino (IIRC Jaxer was one of the bigger ones), but Rhino had a bunch of quirks. For example, strings were Java strings, meaning that length is obtained via `"foo".length()` instead of `"foo".length`. Perhaps the biggest showstopper was the JVM variable limit per class file. Compiling large enough Rhino JS code would yield class files that crashed due to that limitation. And since JS didn't have modules back then, big balls of code were the norm.
Back then, the divide between frontend and backend was also wider. "Full stack" and the uplevelling of frontend folks towards backend skillsets wasn't really as popular as it is today. Node was also seen as revolutionary due to its async I/O first philosophy, whereas Rhino was more or less just a worse Java.
It worked. It let me use my existing desktop app experience (Java, C#, C++) to write code that had a familiar style ( `myButton.setText("Click Me")` ), and build very desktop-style apps that ran in a browser.
But after having learned JS and Backbone, and then React + Redux, it was clear this was a much better way to build apps in general. (Obviously I became biased towards React and Redux personally as shown by my involvement with those tools, but it truly was a big mental shift in how I approached writing code in the first place.)
Though, I’ll note that I do really miss VB6 and C# Winforms for RAD.
It took MONTHS to become proficient at early-ish frameworks like GWT, Dojo, Marionette, Angular, Knockout, Ember, Enyo, etc.
Getting up and running on React in a couple hours and almost completely understanding the entire API inside a couple days was incredible. The fact that the code was faster and had fewer bugs too was almost too much to believe.
Nah.. I don't know about the others but Knockout was super simple to learn and get going with. React was way harder IMHO.
ReactJS of the time was pretty simple.
https://web.archive.org/web/20131105184444/http://facebook.g...
You could read every scrap of documentation in around an hour or so. There were only around a dozen-ish APIs to learn along with only a couple "unique" concepts like controlled inputs, refs, and JSX.
Meanwhile, there was never a need to step into React code unless you believed React itself was buggy (I only came across this one time and the bug had already been reported and was being worked on). Even better, React code was usually faster than Knockout before optimizing stuff and the ways to improve performance were generally pretty obvious.
You forgot Dojo, which was the first big javascript framework.
We have a different recollection of the order of events. I was doing web dev professionally as of 2004, and how I recall it is this:
Originally people had utilities files with a bunch of javascript convenience functions copied from random blogs that they would use to enrich server-side generated pages. This is how I wrote web apps in 2004-2006: php-generated html with hand-rolled js to enrich it.
Out of those grew the first generation of libraries (not frameworks) like prototype, mootools and finally jquery (which was so good at being a web swiss army knife that it replaced every other library).
The libraries were ok to add a bit of interaction but not at building entire UI. The “write your whole UI in JS” approach I remember being popularized by dojo and yui / yui-ext / extjs. GWT was a big hype but indeed not used by many. Lots of people used dojo and extjs though. I switched to ExtJS as soon as it arrived on the scene in 2007.
Those early frameworks only solved the UI problem, they were not great at page lifecycle and backend interaction, so they relatively quickly got replaced by application frameworks that did, like backbone and angularjs. Their mistakes became the inspiration for the second generation of SPA frameworks that we are still using today.
My impression of the era was that visual pizzazz was all the rage, and Scriptaculous really delivered on that front (Flash was also huge back then). Whereas full blown web apps were relatively rare and a lot of library consumers just didn't see the point of things like modularization (despite the interest in "proper" engineering from library authors like Dean Edwards et al)
And even then, once interest in thick clients grew, Ext.js had a lot more fanfare among the heavier frameworks than the Dojos and MooTools, due to its focus on enterprise.
I'll add that looking back, EXT seemed to be a bit ahead of its time. Its data/table view rivals AG Grid [0] of today. If we could've just standardized on a table view by now, but alas.
AG Grid - [Ag Grid, agnostic JS table framework](https://www.ag-grid.com/)
SproutCore for instance was around in 2006 and Apple built it's first version of MobileMe on it[1]. Prototype.js[2] first came out in 2005. I believe it was Prototype.js that first popularised the dollar sign $() for CSS selectors, or was it cssQuery[3]? Prototype also had Dojo[4] as healthy competition right from the start.
I also remember YUI[5] and its offshot Ext.js[6].
Most will also remember YUI[4] and its offshoot Ext.js[5] 1. https://techcrunch.com/2008/06/09/want-to-try-out-mobileme-c... 2. https://en.wikipedia.org/wiki/Prototype_JavaScript_Framework 3. http://dean.edwards.name/my/cssQuery/ 4. https://en.wikipedia.org/wiki/Dojo_Toolkit 5. https://en.wikipedia.org/wiki/YUI_Library 6. https://en.wikipedia.org/wiki/Ext_JS
1. DHTML scripts: individual scripts that provided functionality e.g. a date picker. You grabbed the scripts, and wired them together on your pages to enhance your page. Includes the first generation of Ajax scripts (in page communication with the server, often using raw HTML, text, or XML). Hidden iframes and other techniques also used for server communications.
2. jQuery: the popular library that everyone used because it provided a fabulous API to access and modify the DOM, plus helper methods to abstract out browser differences and bug workarounds. Bringing Ajax to all web developers, allowing them to enhance the pages delivered by their backend web server of choice (PHP, RoR, etcetera).
3. component framework (Cambrian explosion): mostly enhance pages delivered by the server, each framework with a unique approach to its API. Pages use components designed for each framework. YUI, Dojo, jQuery UI, Mootools, ExtJS. Starting to see more Single Page Apps, but no widespread usage of any framework on large numbers of sites.
4. React (and other 2nd gen frameworks, mostly virtual DOM): fully component based, can easily deliver an SPA (Single Page Application) and often the server only really delivers JSON (no HTML pages except a blank container). Widespread usage of React in industry.
There were plenty of early adopters for each technology, but as far as I recall, widespread usage follows the progression above. And the above ignores plenty of important first innovators and minor steps (for example, I used script.aculo.us).
The first stunning example was back in 2000 which was Outlook Web Access on Internet Explorer 5: the first usage of XMLHttp and it was many years before anything else approached its sophistication as a (mostly?) single page app with complex updates. I presume it had a proprietary component system, and IE5 was enhanced to make it work smoothly.
edit: ok looks like they were contemporaries
The amazing thing is that everything was there back in 2000, and OWA showed the way. AFAIK IE5 had all the features needed to deliver an SPA, albeit the techniques to reliably and performantly take advantage of IE took a long time to either discover or to percolate through the industry. I remember people discovering almost hidden IE features all through the 00’s, and then taking advantage of those features. I personally recall IE5.5 definitely had all the DOM features I needed for a component framework, since I remember angrily writing minor workarounds specifically for that version.
The vast majority of web developers were glued to their particular choice of HTML backend, so industry adoption of front-end frameworks was hideously slow.
React was when frontend JavaScript frameworks appeared to me to become really mainstream, rather than just early adopters (era #3 of my list). My own progression was script.aculo.us -> dojo -> personal custom framework. My custom framework had major advantages for me over dojo (better: performance, reliability, flexibility, improved UI, development speed).
Each individual developer will have their own view of how the industry progressed, but this is how I perceived it as a generalisation.
ExtJS, Ember, Angular, and Next are all "full-stack" frameworks and the all were released at very different times.
I would say the "eras" were more like:
Direct manipilation with custom architecture and models (JQuery) -> MVC/P (Ember/ExtJS/Angular) -> Components (React/Vue).
Overall this division seems weird. SSR is neither a revolution, nor universally desirable.
The real revolution is in what these next-generation frameworks like Svelte or SolidJS offer: small bundles combined with high performance achieved through eschewing virtual DOM in favour of precise changes in the DOM.
The big leap forward from Solidjs and Svelte is that they do complex source-to-source compilation to avoid virtual dom diffing. That approach lets them get the best of both worlds - the programmer can pretend their components are pure & reactive. (Solidjs looks almost identical to react.) Thats great because it means there's no bugs due to fiddly or forgotten DOM updating.
But the javascript executed by the browser doesn't need any of react's complexity. The JS output by the compiler simply makes direct DOM manipulation calls when content changes. There's no heavy re-rendering of view trees, and no virtual dom to track. Unlike react, you don't need to apologize for mutating variables or re-render your entire page when you do. So we can do away with redux and all of that. A hello world app in solid or svelte is a few kilobytes, compared to 200kb+ for a react project. And it renders instantly.
It took us a few years to get here, but I'm delighted by the direction UI code in the browser is headed. I hope these ideas make it into native applications.
I've found bugs in my Svelte code just by looking at the stack.
The complex compile-time transforms enable almost no performance improvements.
As a proof just take a look at the js-framework-benchmark table [0], my framework (Voby [1]) is faster than both in the benchmark despite having an API very similar to Solid and no requirement for a Babel transform or other compile-time transform (though the basic React-like JSX transform is supported for convenience).
Those transforms actually exist 99% just for providing some convenience features to the developer. If that weren't the case it wouldn't be possible to make something similar without a transform that's faster than both. In fact Svelte is actually quite a bit slower than both Voby and Solid. Svelte is even slower than Inferno, which is a (very optimized) V-DOM framework.
[0]: https://krausest.github.io/js-framework-benchmark/current.ht...
Very cool framework though, I'll have to look more into how it works someday
If you'd like to come up with a different sort of benchmark where you think Solid would shine I'd be happy to write an implementation of it with Voby and see what happens. Or you can just try that yourself, the API is fairly similar.
---
I should probably add that js-framework-benchmark is heavily biased toward measuring creation time actually, which is something where compile-time optimizations should shine. If you are more interested in updating things, like you would be in a rich application, Voby is actually some 20% faster than Solid at replacing rows with other rows, because it support reusing of older nodes (opt-in) (this also lowers memory pressure in some cases by the way, no need to make and gc lots of stuff in some cases). This optimization is not supported in Solid nor Svelte, and interestingly it's not a safe optimization that can be applied all the time, so it must be opt-in, but how are you supposed to tell to Solid or Svelte when it's safe to apply it if something like Voby's "template" function, which is also used for this, is abstracted away entirely from you? In some sense the transform actively goes against performance here.
As a rule of thumb if you don't have any API for explicitly opting into recycling it's not happening, it's not a safe optimization that can be applied all the time.
Otherwise, it was very common practice to serve an Ember or Angular app as static files Nginx or directly on a CDN. Wrapping them in a server-side framework was always a bespoke process which required you to effectively maintain two frameworks, and stitch them together yourself (unless you count Ember + Rails in the early days, but even that is a stretch IMO). When SSR was introduced in any framework, it was usually not used to its full potential to be able to accomplish the use cases I discuss in the post, like authentication, API endpoints, etc. It was just used to render the app on the server. It did not fundamentally change the DX of the framework.
I honestly was pretty skeptical of these latest frameworks until I gave them a shot! It doesn't sound that revolutionary until you actually start using them, and things which were previously quite difficult become absolutely trivial. I highly recommend trying them out some time.
I feel like backbone deserves its own era as it seemed like all the cool kids would exclusively use that for a couple years.
Then Angular and a ton of others flooded the scene.
Another comment talks about revisionism and, while I think it is a valid critique, I think it goes beyond that. The author's career starts in 2012 and that's all the reference they seem to use.
Sure, they admit they will "probably going to gloss over a lot" and that they "can’t write about what [they] didn’t experience". But then... is this fair? Or, a better question -since anyone can write whatever they want, of course-, will this be, then, just some person's story or will it actually be representative or a larger reality?
Sadly, it feels like lately a lot of people seem intent in blurring that distinction. They seem to say "I may only have a limited view, but I'm going to present this as if this was the complete reality". And this is what this article does, I'm afraid.
The fact that there's is absolutely no mention at all of Dojo is telling. It's also quite telling that dismissing claim of "throw together some scripts for a few UI widgets, and call it a day", the quite absurd "everything was global", and the error of suggesting XHR came later -"As time went on and XHR was introduced and popularized"-.
And I think that's the core of the issue, even people who were around at that time do not remember all of these things. Ultimately, even those of us who are trying our best are going to miss details, and this is only going to get worse as we get further and further away from the beginning. Honestly it seems like this is a job for historians, and unfortunately I am not one, just a dev trying to share my thoughts and experience
> and the error of suggesting XHR came later
According to Wikipedia, XHR was introduced in 1999, 4 years after JS was introduced: https://en.wikipedia.org/wiki/XMLHttpRequest
Your way of commenting on XHR in this paragraph...
In this environment, it’s understandable that JS was generally seen as a toy language and not something you’d write a full app in. The most common thing you would do was include jQuery, throw together some scripts for a few UI widgets, and call it a day. As time went on and XHR was introduced and popularized, people started to put parts of their UI flow into a single page, especially for complex flows that required multiple back and forth interactions between the client and the server, but the majority of the app stayed firmly on the server.
...where you are talking about jQuery already being a common thing, which implies at the very least 2006 but more likely 2008-9, and then writing "As time went on and XHR was introduced and popularized", suggests the idea that XHR somehow was introduced much later, when jQuery was already common.This is what I was referring to. It may have not been intentional, but the way you comment and present it suggests a mistaken timeline.
- "simple" JavaScript to implement fancy menus in the Macromedia Dreamweaver days (css :hover wasn't supported across browsers at the time, as I recall)
- DHTML scripts copy pasted from these Hotscripts back in the day
- backend frameworks that spit out HTML + JavaScript (Rails I think did this, as did symfony 1.x which was heavily inspired by Rails), at the time the library used underneath was PrototypeJS. Which then I used on many other projects (was never a fan on jQuery)
- knockout.js, as my first "heavy" library I've used to SPAify complex pages
- angular.js starting in 2013, then Angular (2+) on followup projects
- Vue.js starting in 2020
- today, going back as much as possible to vanilla JavaScript
The projects I've worked on avoided the mainstream libraries most of the time, and I definitely wish I would have gotten my time back for the time invested in angular.js/Angular, even if I learned those on the job.
That's basically 5 different eras for me, and I'm circling back to the top.
Javascript =/= the DOM. All your frameworks are DOM abstractions, not Javascript abstraction, unless you are using Typescript or Reason (or Turbo links on the server). You're still writing Javascript code with knockout and angular and co, you're just not using the DOM directly.
Talking about "vanilla javascript" in the context of these frameworks never made sense to me.
tangential:
Javascript is not the DOM and people use frameworks because they hate DOM manipulation. We "didn't need jquery", or so someone said, but now it seems like we sure need all these frameworks somehow and people don't learn the DOM anymore. How is it any better than jQuery? it isn't...
My post was explicit in the fact that this was my frontend JavaScript path.
I don't think they are DOM abstraction, rather they are "update abstractions", as all the data binding, two way bindings, (whatever way binding a future library might call it) is there to observe X, update piece of html fragment Y with X.
The vanilla JavaScript idea is to debloat application and unlayer complexity where its possible. It doesn't offer the niceties, or feature parity of what frameworks do, but it allows me to be more explicit in the places where I'm going to use a framework. E.g. might have handrolled JavaScript code for light interactivity for a website for 90% of the time, and going to use something like VueJS only on the pages that require some highly integrated state associated page components.
The people in my circles, didn't hate DOM manipulation. They just didn't understand it (or care to), and jQuery answers where all over stackoverflow (just use this library and this jQuery plugin call).
And yes, without jQuery/frameworks DOM building is tedious. I've seen JSX praised before, but in an alternate timeline where IE didn't dominate the entire world with a legacy PoS, maybe the E4X standard would have been implemented in all browsers. Which would have been a pretty sweet deal, and another useful tool for the vanilla JavaScript camp.
Or something like that
Is it perfect? Definitely not. JS is so easy that it also makes it easy to write bad code. Higher-level languages also consume a lot more resources. Browsers become the defacto OS (good / bad?), etc. But in general I think JS has been revolutionary and the benefits far outweigh the costs from a functional perspective.
As for the article: jQuery receives to little praise imo. At the time it was truly revolutionary. Suddenly you could make your websites interactive with just a few lines of code, and it worked in every browser! This inspired an entire generation of web developers.
I believe causality went other way around. Everyone started migrating to web applications so there was money in improving tooling. So push to web applications revolutionized JS tooling.
My projects are usually either in the form of "User enters data, sends it to the server, server sends a new page back"
Example: https://www.gnoosic.com/faves
Or in the form of "User changes parameters on screen, Javascript updates the screen accordingly".
Example: https://www.productchart.com/laptops
In both cases, I don't see the benefit I would get from a framework.
If you have built a project that is public and benefits from using a framework, I would love to see it!
- transpiling JS back into the stone age for compatibility
- accessibility
- seamless localisation
I have found I just can't keep track of all of these things as well as React does.
At the same time, I think React is a huge, dependency-laden mess, very difficult to learn (because it's changed its mind on how to do things about 100x, so no responses to issues on SO apply to your version of React, Redux, React Router, etc), slow as hell and probably overkill for most projects...
Once this gets a bit more complicated you have a bunch of state to keep track of and you have to make sure to re-render only the parts that have changed, and deref that parts that should be GCd. I'll happily take on a reactive UI framework dep if I can avoid writing my own diff pipeline.
Not endorsing react by any means though.
The real value of public frameworks comes into play when you have more than one generation of developers working on your project.
It's much easier to onboard a new developer onto a react app than it is to get them to understand the weird bespoke nuances of the conventions you came up with while hacking on your site at 3am 5 years ago.
Sorry but a “framework” used by one project (especially not broken out into a separate subproject) is not a framework. That’s just infra code.
I think your point still stands that the value is developers understanding a framework can more quickly get to work—I’m just triggered by your exceedingly liberal usage of the word “framework”.
Infra code that over time, as your app grows, takes on more and more of the features of a framework
That is why I proposed a discussion based on real life examples.
The other thing is that frameworks change. You picked React for your example. A currently popular framework. Chances are, the next developer will not come on in 5 years, but in 15 years. And does not know anything about React. Or about React as it is today. Then they might have a harder time understanding React than to understand a well written, minimalistic piece of Javascript.
That doesn't seem likely to me at all. More likely in the next 6 months than in 15 years. Why are you planning for 15 years out? The company you are working for might not be around in 15 years. Code might not even be recognizable in 15 years. All of our programs might be written by AI in 15 years.
Optimizing for the short term makes way more sense to me. 2 or 3 years out, not 15.
I don't see any contradiction between creating well written, time tested software and also choosing currently popular frameworks to work in.
If your React app is well written and stable and well tested, I see no reason it shouldn't be available in 15 years. And if you can't find React Developers to hire in 15 years to work on it, that's tough. Pay to have some trained.
It is a similar situation to COBOL is today.
Sure, somehow I’m going to find React developers 15 years from now to maintain my line-of-business React app but how secure will it be?
One could argue that I can rewrite the framework-dependent parts. But rewrites cost money, too.
I love new stuff but I still think that, depending on the app, it may make good economic sense to plan ahead for it to be useful after a decade or two.
https://www.npmjs.com/package/react
Maybe I'm missing something but npm suggests it's only one dependency, which also only had one dependency.
I get that create_react_app pulls in a ton of dependencies, but React itself is not a culprit of dependency hell.
We chose it in my company in 2008 before the framework boom and it had served us well for a very long time. It's batteries included, has for example it has a very comprehensive i10n module, which was not usual at the time.
Also worth mentioning it was started among others by Alex Russell [2], a famous developer advocate at Google.
Instead of being forced to write code that would run on all the supported browsers, with Babel we could actually use new features, and let it deal with translating them to stone age equivalents.
That was huge.
Well, crap. Now I feel super old. I’ve been using JS since the mid-90s and I did not expect this to start with “the era of jQuery is in the distant past”. I recently started using Cypress (automation testing framework) and was somewhat surprised to learn that it was using jQuery under the hood. And a few weeks ago I was reading the documentation for a very popular data table grid component and was surprised that it was still using jQuery under the hood too (and had all kinds of rationales as to why they didn’t think it necessary to rewrite the component without jQuery). I assumed jQuery would have faded into complete disuse by now.
Nowadays, every time I look at a react codebase I feel certain emotions I can only describe as disgust. Maybe I have only seen bad codebases.
For any site of inherently simple interactivity, it's always been as easy if not easier than it ever has, but now it's also more manageable if you know you're going to need to scale a certain way.
It doesn't necessarily take all that much before you can start to see the reasoning. For example, take a humble grid of products, each with their own add to wishlist button, and a profile preview button in the corner of the page that indicates how many things are on your wishlist. Pretty simple to handle, render the thumbnails with unique ids and make an XHR request that stores the data with your account. Update the wishlist total count however you would.
Now suppose though that each thumbnail in the grid can open a bigger preview dialog that has more images, a bigger description, and it's own add to wishlist button. You can click that button, and it does the same thing. You close the dialog, but now your grid item needs to reflect that it's already been added to the wishlist. These things get really tiresome to keep building, something that I'm sure isn't new to you if as you say, you've been in software a while.
Sorry for the book, I mostly wrote that to challenge myself to think it through, not to imply you couldn't think of how it would be necessary to componentize things.
I'm not particularly fond of React more than Vue or anything, except for the fact that they both allow you to define UI as collections of functional state machines when it's necessary to do so.
I do totally get the point of using a framework like React or Vue to manage state on a complex app. I do purposefully call them apps, because websites are a more general term. Hand woven javascript UI, even if it was using an utility framework like mootools could get out of hand pretty easily. I recall things like extjs that were also popular.
Following my own example, managing push state by hand was tricky. So I did buy in on the premise that an opinionated way of structuring help and more importantly state was necessary. But I have been consistently failing to learn any new frontend tool ever since. This was not terrible professionally, since I mostly do what most refer to backend or systems. But still it is a bit frustrating not being able to follow along. Maybe it would be easier if this was 'it' when I started learning as sometimes it's difficult to forget and relearn.
Speaking of React / Vue codebases, I have thrice tried to contribute some changes or fix a bug on different projects and the amount of boilerplate I had to go through felt completely unnecessary and overkill. Maybe the pattern on these never 'clicked' or I was very unlucky to stumble unto bad examples. It's very easy to dismiss something one does not understand as unnecessary complex so I am still open minded about it. The feeling of disgust when I see the many levels of inference, types and juggling state around for UX that I see as pretty basic persists, though. I like the result, I abhor the execution.
I've done this many times, using plain-old jQuery and server-side rendering, and it really isn't that hard. The "conventional" way is to (of course), render the preview(s) with classes or data attributes on the updatable elements s.t. you can quickly identify the elements that need to change (say $('.wishlist-count').text(updatedCount) for the sake of argument).
For more complex things (let's say you need to be able to insert a complicated, but slightly different, object in the wishlist, for example), you can render a template into the page, dup it on wishlist addition, and populate the variable data in any number of different ways. You can even create JS objects that encapsulate this kind of logic (e.g. Wishlist.add(itemNumber)) without much additional effort. No framework required.
Now, I grant you that when you need to do this for many different kinds dynamic elements that all interact in different ways, or when you need to absolutely guarantee minimal re-rendering, you might want to jump to a framework. But I still feel that most front-end people these days instinctively rule out simpler approaches that would work just fine, because they're prematurely optimizing. Or worse...because they simply don't know anything other than React.
If I need to do WebUI stuff on my own, it is classical vanilajs with SSR in Java/.NET frameworks.
Being able to define your view as a pure function based on your state is a very powerful.l abstraction, but it took me about 2 years to learn to wield it well.
Maybe there are no good react codebases because it encourages bad code.
The whole concept of having both code and structure definitions in the same file is just flawed at its core. Like deliberately writing all your js in html script tags for some reason, except with functional-style syntax that just makes it look more cryptic to newcomers for no reason at all.
Granted there is a level of interactivity that is different for the complexity, mostly I look forward to the grand complexities of todays frameworks to continue to simplicity and be approachable.
Still things get more complex before they get streamlined.
Frameworks like svelte, vue, and even flutter to a degree feel different than react when putting together similar experiences in some cases.
The problem with the OP feeling (and mine) is that there are shoulders of giants. You either stand on them or not. If you are not, you start on much lower level of features ;)
I started building websites amaterishly from about 1995, and professionally from about 2001, and always hated how complicated and messy my code became any time I wanted to build rich functionality (i.e., a web-app rather than a website).
That first changed for me when I discovered ExtJS (now Sencha) in 2007, then later Angular and finally React in 2017.
These days I work almost daily on a React web-app I've built for displaying realtime weather/climate data for farmers, and it continues to be a very pleasing codebase to work with, more so than any I've worked on before.
It's also proof that you can make a simple and pleasant experience with a JS framework, if you focus on the essentials, there's no need to boycott JS entirely in favour of the old web, these frameworks get rid of a lot of the boilerplate when starting from scratch.
I'm an avid supporter of SvelteKit (the framework used on that website) and how they want to make the web less SPA/JS again. In this example, navigation is fast and client side, but can fall back to SSR if JavaScript is disabled, fails to load or hasn't loaded yet. There is no heavy runtime with virtual DOM diffing. Resources are cached and a page reload only sends ~17 kB over the wire on a large blog post, showing an excellent use of Tailwind CSS. It renders on Cloudflare Workers close to the user wherever you are in the world, with zero vendor lock-in if you want to stick it on a VPS.
At this point if you have JavaScript disabled is your problem.
It's like having a car and not wanting to put gas on it and pushing it around and complaining why you have to push your car.
Not saying we don't abuse its usage, but having it disables is just extremist
If the document is able to carry out navigation, without having to rely on downloading a non-negligeable amount of JS to hydrate the page, it improves the experience for that 90th percentile enourmously. Us web developers are often privileged with a very good internet connections. It's not necessarily anti-JS thinking, and SSR for crawlers generally as no longer been relevant for a number of years, it improves UX.
Edit: this also reminds me of [1], a 8.5 MB HTML file with 27.5k tweets was faster to paint than a single tweet in a React application. It depends on whether the UX can be improved by using more JS, for most websites I think less is more.
[1]: https://twitter.com/zachleat/status/1169998370041208832?s=20...
But we definitely have more fun with React SPAs and Go microservices on Kubernetes :)
(Notice I'm listing the shinny toys of the usual 3 layers at every company)
> and rewriting them entirely, like Angular did with Angular 2, killed a ton of their community’s momentum.
I don't think this is accurate, Angular may not be as popular amongst SV startups, but is still alive and well in more established businesses/enterprise.
I don't think it's fair to write about the history of Javascript frameworks and completely gloss over one of the most widely used.
Original Angular had some performance flaws that probably really did require a rewrite, but the decision to change so much syntax while they were at it caused an enormous number of people to abandon the platform.
Current Angular still exists, sure, just like Ruby on Rails still exists, and they’re both solid and useful platforms; but industry wide it’s still accurate to think of them mostly in historical terms.
It feels like (to me at least) that at this stage it is quite clear that using NPM is an anti-pattern that is best avoided if possible (security, requiring a "dev machine" with the right version of NPM installed etc, general bloat)
I know that there is nanojsx (https://deno.land/x/nano_jsx) but would be keen to know of any other examples that anyone knows of?
For all it's problems, it's still is the killer feature that makes it easy to develop JS apps. The things you mentioned can be mitigated with proper practices.
1. Security: Supply chain attacks can be mitigated through being deliberate about versions and making sure your CI systems always install a "frozen lockfile"
2. Requiring the "right" version of NPM: Can be easily solved through "engines" in package.json. You can basically tell your project to not run unless the dev has the right version of NPM. This is not that big of a deal since a dev can just install the correct version with npm. You can take this a step further with yarn and pin a specific binary in your project so it doesn't matter what version your devs are running, they will automatically use the binary you specified inside the project.
3. Performance and Bloat: Besides NPM, there's also Yarn and PNPM (Performance NPM) that both work much faster than NPM and are fully interoperable with existing package.json's.
The ecosystem is still not perfect and security is still the biggest issue. The other issues you mentioned though can be easily mitigated through good practices.
I would have liked to see some discussion of what is next. For example, where does WebAssembly fit in?
Lastly, a minor critique re.:
> That said, I can’t write about what I didn’t experience
Yes you can, it’s called historiography using primary and secondary sources. It’s a lot of work, but certainly doable, especially when so many of the participants of the history in question are still alive; you could interview them if need be.
Thanks again for a nice high-level write-up.
> From the get go, mobile apps on iOS and Android were full applications written in Serious Languages™ like Objective C and Java...This [deeper integration] resulted a much better UX...
> Doing all of that with JavaScript was seen as ludicrous at first. But as time went on, applications started to get more ambitious. Social networks added chat and DMs and other real-time features, Gmail and Google Docs...
Desktop-similar Google Docs and Gmail predate smart phones. Meebo was running a desktop-like chat app in 2005. At the time, it felt ludicrous. Rich client-side web frameworks were already pretty far along by the time the App Store came out in 2008.
Now that we've realized SSRs cannot be an optional afterthought, we'll soon realize SSRs with running JS on the server is a nightmare to scale - https://engineeringblog.yelp.com/2022/02/server-side-renderi...
Just search HN for "scaling server side rendering" and you'll land on a bunch of practical complications.
That doesn't mean SSR is bad. It just means we know the solution but stuck with the wrong tools.
My hypothesis is that we'll capitalize WebAssembly to run our UI rendering logic and a tiny platform-specific rendering layer to translate rendering commands from WASM to platform. Interesting side-benefit: Language choices other than Javascript.
I've already started working on a proof-of-concept React-ish library that runs on a WASM VM. IT lets you specify your UI component declaration and behaviour in Kotlin - https://github.com/joelewis/kwasm
This page is the first time I've heard it explained as a full-stack framework, which sounds more intriguing than just helping me with SSR.
The main problem with rendering in both the client and server environments using the same code is that you need to fetch data in two different places. On the server your code needs to fetch data during the render itself, whereas on the client you need to fetch data asynchronously then re-render with the data once it arrives (which in React means triggering the API call as a side effect, then setting the returned data as state, triggering a re-render).
Unless you really need server side rendering and can't do it statically, Next.js is the wrong choice. IME like 98% of projects are just using it because the tech lead is resume padding or an idiot. The others are something similar to Reddit or Quora with a complex UI and dynamic data that needs to perform well on SEO. For those ones Next is probably a pretty good choice.
Stuff like Next should be the 3rd tool in your arsenal after client and static rendering. It's a bunch of extra complexity for very little gain in most cases.
`getStaticProps` and `getServerSideProps` _only_ run on the server – it's possible we're conflating "rendering" with "data fetching" here. You fetch the data on the server, and send pre-rendered HTML to the browser. You can, of course, also do client-side data fetching (e.g. `useEffect`) as you mentioned.
> Stuff like Next should be the 3rd tool in your arsenal after client and static rendering.
The philosophy of Next.js is that client, static rendering, _and_ server rendering have a place. For certain application holotypes, you might want all static. For others, all server-rendered. Next.js doesn't care - it allows you to choose which strategy you want on a per-page (e.g. route) basis.
This allows you to not have to eject from the framework because your /contact pages wants to be static, while the /dashboard part of your site is server or client rendered. It also helps for incremental adoption.
That's only if you're loading the app from the server on every page transition, in which case you may as well use PHP or something to do old school server rendering. The whole point of hybrid SSR is to get a fast first paint but still have the snappiness of client side navigation. The first page loads data from the server but subsequent pages need to fetch it, including returning to the original page. Meaning every page that's both tied to a URL and navigable through the UI needs to support both paradigms.
> The philosophy of Next.js is that client, static rendering, _and_ server rendering have a place.
Their philosophy is whatever will get the most people to use their tool, whether they need it or not. My philosophy is that 5% of apps need hybrid SSR at best and the rest should use something else. All 3 paradigms have their place, but not all in every codebase. The majority of apps don't need static rendering either. And static sites don't need client rendering.
It's popularity has soared because it eliminates a lot of the routing boilerplate in react apps, and is generally quite pleasing to develop in!
He started programming in 2012. He does not know the 90s. Good for him. Honestly, I have no idea how long back components go ... my educated guess: Smalltalk? Minimum.
The issue is the community is batshit and it's almost impossible to find or build a team that's going to democratically decide to use a sensible approach. If you want to keep a simple codebase on a React project your three options are build the entire thing yourself, be the best interviewer of all time and find a one in a million team, or be willing to be an absolute nazi and piss off a bunch of confident amateurs that want to overengineer everything.
If you can somehow avoid ending up with 20 other shit dependencies then React is a big upgrade over the frameworks that came before.
Also, I like to think of Svelte as the successor to jQuery, as it's the closest to "just vanilla JavaScript" I've seen (yes, I know there's some non-standard JS syntax in there).
It may end up fine but it has a good chance to be an expensive horror show.
In my experience, only jQuery and React have obviously passed this bar.
JQuery was very early but had a theme roller I was after to build in white labeling and branding.
It also taught me if you pick something too new you might spend more time maintaining what has been built to date vs building new features and scaling them, which wasn’t always the experience.
I wouldn't dare comment on how far we've come since the early days of web scripting, or frameworks for that matter, but for all the talk of added complexity I'd sure say it feels a lot easier (and infinitely less hacky) these days.
... searches comments here for "Express"... 0 results
... goes back to writing Express apps...
Era 2: Everyone uses jQuery
Era 3: Everyone copies Gmail and Grooveshark using Backbone and Angular
Era 4: React is all the hipster bootcamps teach
Era 5: NextJS and React Native is how you build apps
For me the next step, the fifth era if you will, is javascript that manages the persisted distributed state for you without any backend or db specific API.
You push something into an array and it is magically there for another user in the other side of the world.
I'm working on something like that: https://javascriptdb.com
1. Form alerts and confirms 2. Ajax, jQuery, and plugins 3. Frameworks, from Handlebars to JSX 4. Revolution: TypeScript
I remember a time when JavaScript simply wasn't used. Everything was server-side rendered (classic ASP using VB6.0, ancient PHP, Perl, etc.) Eventually it gradually became bigger but its development was stifled by Adobe Flash taking charge of highly interactive UIs.
Then, slowly, JavaScript started to do things. Some companies started working with Ajax and suddenly you could talk to the server while you were on the client. But, for the longest of times, JavaScript was not used like it is today; we did not use it for templating or making components, because we had client-side XML and XSLT doing that with `<xsl:template>` and other such nifty tricks.
XML + XSLT + Ajax + jQuery was the status-quo for many years before we started getting UI libraries. Backbone, Ember, MooTools, and many others started to make life as a front-end developer far more interesting. We went from HTML (and later also CSS) drones to actually needing to embrace programming concepts, architecture, design, and design principles.
We had one big advantage over classically schooled university software engineering graduates: We knew JavaScript, it wasn't type-safe, it was full of little quirks, but it was ours and we had worked with it for many years. We knew it. They didn't.
And then TypeScript was born. At first, it was a monstrosity full of bugs, oversights, missing features, lack of intuitive design, and largely undocumented and confusing. Front-end engineers like myself didn't like it, because WE did not need it. We just saw that those classically schooled professionals suddenly thought they could do front-end, too, except they didn't know about HTML semantics, HTML accessibility, CSS (from floats to flexbox to grid to paint/composite/layout), browser APIs, browser differences, and so much more.
So these... people... came into our domain because TypeScript made them feel safe. They were far slower than us, they made more bugs, the code was unreadable (TypeScript generics are a hell, or in generally accepted TS-syntax: `T<G><A, H>(X<G>)<P><A><<A, B>, C>`) and worst of all, they made everything a `<div>`, including buttons and links and tables and lists and inputs and images.
Then, as the years flew by, TypeScript became more mature (except for their error messages) and it actually became somewhat intuitive to use. The back-end developers who were confronted with the fact that they knew nothing about the front-end have now either adapted and learned, or left, and the world is nice again.
The next big thing for web development and JavaScript is probably going to be the next big framework or library that we don't see coming yet. I love React, I enjoy Vue, I admire Svelte, but I don't think that React will stay around forever (libraries die because developers get bored of them, and new developers think these are getting too old), and Vue & Svelte simply haven't taken off the way I had hoped.
We'll see where it takes us.
In any case, I'll keep learning, I'll keep adapting, and I'm trying to be ahead of the hype train just so that I can keep increasing my $500,000 annual salary (excluding stock options).
https://extensiblewebmanifesto.org/
Very good ideas. If it was executed that way we would be in a different position. Some of the standards and browser implementations improved, many have been half baked or clunky, the JS ecosystem (which is the means to explore and extend) is chaotic and still moving incredibly fast without fundamental progress. I think two things happened since: We still don't agree on how to do interactive UI on the web and we've lost focus of this being a explorative journey that ultimately should result in agreed upon standards that everyone can build and rely on in the long term.