Micro Focus is now part of OpenText. Learn more >

You are here

You are here

The best JavaScript framework is ... JavaScript

Yoni Avitzur Front End Engineer, Marketo
Vanilla ice cream scoop with sprinkles

In the beginning, JavaScript was scary. Each browser had its own JavaScript APIs, and applications that worked on one browser would fail on another. Developers had to account for different behavior across the browsers, leading to convoluted code that was hard to write, debug and maintain. To help alleviate the pain, toolkits and frameworks such as GWT and Flex came along, offering powerful capabilities and cross-browser compatibility, and helping developers avoid JavaScript.

In recent years, though, JavaScript has become pretty powerful in its own right, and browser compatibility issues have been somewhat mitigated through increased standardization across browsers and HTML5 templates. But the perception that JavaScript is scary and even unreliable has persisted. This led to the rise of JavaScript frameworks.

These frameworks, such as Angular and React, are effective tools for rapid development of simple applications and are great training wheels for JavaScript beginners. But for long term projects that grow and evolve over time, they are not always the best choice.


The problem with frameworks

Frameworks are created to make life simpler and save time for developers, by automatically managing the state of the user interface, and taking care of data binding.

In reality, though, these benefits turn out to be huge disadvantages. When building interactive real-time applications, you want to have the most control possible over the actions performed inside the browser. But the framework actually takes away that control, and performs redundant operations such as managing an event loop (e.g., Angular’s digest loop), or building a virtual Document Object Model (DOM), which slows down the browser and negatively affects the user experience.

For example, when a user is interacting with a live chart that’s being updated every second, you can’t afford those redundant operations. Every action taken by the browser must be precise and deliberate, so the user doesn’t notice that the chart is being updated when they’re playing with it.

This is not only an issue of real-time applications; it’s also a concern when performing complex animations, or rich interactions that require fast rendering (such as zooming in and out). Any redundant actions will cause performance issues.

By the time you notice these issues, however, it’s too late to do anything about them. Because of the fact you’re already committed to the framework, you can only go so far with your optimizations. Even minor optimizations require a significant investment of time and effort, because you’re restricted by the framework’s  structure, which can’t be modified, and is difficult to understand.

Frameworks are highly effective if you want to quickly construct a prototype. But if the customer or your designer has user experience requirements that go beyond the basic functionality provided by the framework, it starts to get more complicated. Each framework tends to enforce its own rules about what you can and can’t do with it, and this can be very limiting if you need to build a highly customized and unique user experience.

For example, you might need to add a new control that the framework doesn’t support. You’ll spend a lot of time hunting around in vain for third party code that does exactly what you need, and you’ll probably end up having to develop it yourself.

The solution: Do it yourself

JavaScript on its own has none of these issues. It’s amazingly flexible and offers the developer total freedom to experiment and explore different approaches to a problem.

In my experience, the best choice for user-interface flexibility and long-term maintainability is plain and simple JavaScript. Add some utility libraries such as D3.js for mathematical calculations or Socket.io for real-time communications, and you’ll have an easily maintainable code base that does exactly what you need.

As an example, a friend and I recently built the website pancake-finance.com, an interactive stock-tracking dashboard built with simple JavaScript. We had a very clear vision in mind when we built it, and we couldn’t find a framework that answered all of our requirements without compromise. It took us just a few months to put it together using plain and simple JavaScript, and the result is a smooth and responsive user interface that we have complete control over.

JavaScript has made a lot of progress

JavaScript and CSS are continuously evolving. They’ve become very powerful, endlessly flexible, and increasingly easier to use. If you’re about to start a long-term project, consider using JavaScript instead of committing to a framework.

Developers new to JavaScript might find it somewhat confusing and maybe even frustrating, but as you develop a deeper understanding of the language, you’ll find that you’re able to build rich, smooth, and highly customizable web apps without having to compromise on functionality.

The experience and skills that you gain by using JavaScript will always be relevant, no matter which framework is hottest at the moment. Basic JavaScript skills are immediately applicable.

Are you using a framework? Share your thoughts and concerns about going with plain and simple JavaScript.

Keep learning

Read more articles about: App Dev & TestingApp Dev