Just over the horizon - A new era of JS
Jonas Hultenius
2023-03-03
JavaScript is one of the most popular programming languages in the world, and it has been for a long time. It is the language of the web, and it has grown and evolved over the years to be included everywhere from refrigerators to cars and used for everything.
However, it is also one of the most hated languages out there, a language that has been criticized for its complexity and sometimes frustrating quirks. Something that has given rise to an almost endless supply of mitigating frameworks and function packed liberties to smooth out the rough edges.
These frameworks have done much of the heavy lifting and are one of the reasons for JavaScripts rise to prominence in later years. But like with all things there is a prince to pay. These frameworks have a steep learning curve of their own and are often opinionated about how things should work and be structured.
Being nothing more than JavaScript that augments JavaScript they also have a bloating effect as you need to package an runtime with your application. A runtime that is a black box of dependencies and that will evolve over time forcing you to get with the times or get packing.
Fortunately, a new era of JS is just over the horizon, and it promises to simplify and streamline the development process as well as free us all from the stampede of dependencies that any modern development project today battles with every day.
At the time of writing, Svelte and SolidJS are two of the most exciting new frameworks. And they’re out to change the landscape of JS frameworks forever. They are designed to make the development process more efficient, more elegant, and more enjoyable.
Svelte and SolidJS differ from the kinds of frameworks that came before them. Instead of running in the browser, they compile your code into highly optimized JavaScript that runs much faster than any traditional setup.This also means that they don’t need to come packaged with a runtime to be able to run.
This in itself might not seem that big of a deal but has massive implications. Not needing a runtime makes the whole application smaller by a significant amount. You don’t need your end user to download ReactJS or any other framework for that matter. All things needed to run your code comes prepackaged in the box. No batteries needed.
This makes your application small, ten times (or more) smaller in fact than going with a traditional framework setup. And the applications’ smaller file size will speed up download times, use less disk space and bandwidth and create a smaller environmental footprint as a direct effect.
You only get what you take with you and the framework’s dependencies are no longer yours. This is great for security! Your code is what is being compiled and subsequently what will be running, in an optimized version, on the end users machine. The treat vector that comes with a myriad of dependencies of frameworks using frameworks a thously eliminated. Your code can even be recompiled with different settings and even another different compiler to become something new, every single day, making the process of finding loopholes or drawing conclusions much harder for an attacker.
Both frameworks are also reactive (truly reactive), something that deserves its own blog post i feel, as this in a way is a revolution in its own right. (I still want to keep my 3-4 minute formfactor.)
So to round this post off I would like to put the spotlight on one of the most significant benefits of both frameworks and that is that they are designed to be easy to learn and use. Both have their roots in a new (neu modern) movement of minimalism. Code and complexity should be kept at a minimum.
This is particularly important for new developers who may be intimidated by the complexity of existing frameworks like React and Angular. Additionally, the simplicity of these frameworks makes them more accessible to designers who may not have a background in programming.
This democratizes web development by making it easier for new developers to get started and by helping to break down the barriers to entry that have traditionally existed in the field.
Minimalism also gives the added benefit of less bugs so both solutions are well suited for high maintainability. Less code means less places to get things wrong. Yet again a topic for another day. We will get back to this shortly.
In conclusion, Svelte and SolidJS are ushering in a new era of JavaScript frameworks. They are changing the way we think about web development and are helping to create a new generation of fast, responsive, and green applications that will help us all write less and better code. A new era awaits us and this topic is far from finished.