Blog

Why We Chose VueJS  -  Choosing a JavaScript Framework  -  Part 1

A JavaScript framework is an application framework written in JavaScript. It differs from a JavaScript library in its control flow: a library offers functions to be called by its parent code, whereas a framework defines the entire application design. A developer does not call a framework; instead, it is the framework that will call and use the code in some particular way.

A client-side JavaScript framework is a collection of components and libraries (mostly interdependent) that fulfill the needs of a single-page web application in browser clients. It caters the needs for routing between pages of HTML, networking with back-end (HTTP), interaction with or easy selection of DOM and its dynamic modification.

In today’s endless line of frameworks, the vast majority of them follows the pattern familiar to anyone who has ever worked with server-side frameworks: some kind of implementation of MV* — MVC (Model-View-Controller), MVP (Model-View-Presenter), or like VueJS which is focused on the ViewModel layer of the MVVM pattern. Models in a JavaScript framework, traditionally, represent the application’s data. Views are a bit more indeterminate. Depending on the framework, they vary from simple sets of templates to classes that contain process logic, which in some frameworks is the responsibility of Controllers, but in each case, views are responsible for maintaining DOM representation.

Why (not) to use a JavaScript Framework?

If your application is nothing more than a good old-school example of the Calculator application — you should switch from VanillaJS to any of the offered frameworks.

VanillaJS is a plain JavaScript without any additional libraries. It is a term for a library/framework free JavaScript, sometimes ironically referred to as a library, as a joke for people who could be seen as mindlessly using different frameworks, especially jQuery.

If you only know JavaScript and choose to go with VanillaJS, there is no learning curve. However, if you choose to go with any framework, there will be some if not a steep learning curve.

One of the few advantages of using plain JavaScript is the performance. Plain JavaScript will beat any of the existing frameworks today.

So “when” exactly should one use JavaScript framework?

Well, unless your page is even a bit more complicated than a simple calculator — we’d say “all the time”. Here’s why:

  • They offer a more responsive user experience than a traditional server-side approach since JavaScript frameworks only load in portions of the page as the user interacts with them, thus speeding up the responsiveness of the user interface
  • As a traditional server-side approach, most of the modern JavaScript frameworks also provide design patterns implementations, like MVC, making sure there is no ‘spaghetti’ code in the end
  • Most of the modern JavaScript frameworks offer either official or unofficial packages that are recognized by the community. These packages solve repetitive functionalities or problems (registration, login/logout, cross-browsing) which make development faster and more efficient
  • All popular frameworks follow the best industry standards and promote healthy engineering practices
  • Competition is a good thing, SlickSpeed tests resulted in a much faster selector engines such as Sizzle. Not having to worry about trivial DOM bugs led to more complex libraries which are created on a daily basis. All of this means that entry-level developers can have access to very powerful plugins.
  • Top JavaScript frameworks have firm security arrangements and are supported by large communities where members and users also act as testers.

Choosing a JavaScript Framework

When it comes to choosing which JavaScript framework to use, the situation is difficult and complicated. Since there is an infinite number of ways to organize JavaScript, there are a lot of different frameworks aiming to solve different problems and providing different approaches and solutions to those problems.

Some of most popular nowadays are Angular, EmberJS, React, Vue JS and Aurelia, but the list can go on and on.

Choosing a framework should never be about the number of features that a particular framework can provide. It’s clear that the terms like ‘next generation’ can sound very appealing, but what it comes down to is the actual functionality of the framework and how that functionality can be used within your project, app or software that you are building.

Some frameworks provide more experience in a sense where the framework is built by sensational developers with decades of experience behind their backs, whereas smaller web frameworks will focus on community-oriented features that can be incorporated within different framework modules.

This is a part one of our two-part series about choosing a JavaScript framework.