SPA Javascript Frameworks pros and cons

My perspective is Enterprise Applications Development with Ruby on Rails. I am talking about frameworks like AngularJS, Ember, React, Backbone ….

Javascript:

  • Ugly language. Yes, but it was improved since ECMA6. and now you can give structure with Stimulus.js, in order to do it more maintainable.
  • Verbose: we have to make one file and extend one class for each route in Emberjs for example.
  • Give +2 points for the ugliness of the language and the hell of maintenance.

Template engine:

  • Always based on HTML (like handlebars), now we have HAML or SLIM.
  • React is even worse because it has JWS templates mixing JS and HTML

Another Hell is the Authentication layer. Here you have the example with Ember.

Pro Arguments:

  • Smooth and modern fluid feeling in apps, avoiding to reload full page.
  • BTW you are building and testing your REST API. But at the same time you are spending lots of time maintaining horrible JavaScript.
  • You are separating front-end and back-end. But adding one more layer of abstraction you have an MC-MVC architecture instead of a simple MVC architecture. Increasing complexity exponentially.
  • Download all assets once, not overloading the server. Well, always you can scale your systems.

Conclusions:

  • Use Node and Yarn to manage all super-great libraries in the frontend.
  • Use Hotwire/Turbo to provide a modern SPA-feeling without reloadings. Then you can give abstraction to the most complicated parts.
  • Create your REST APIs at the same time in your App but do not lose your time with complicated frameworks.
  • Make your life easier with SASS, HAML or Slim.
  • If a client suggests you these frameworks advise that it will increment dramatically the costs of development.
  • These frameworks are recommended only if:
    • You want to develop a front-end over an API which you are not owning.
    • Your front-end requires complicated images rendering and actions in the browser, like an editor or something like this.

Leave a Reply

Your email address will not be published. Required fields are marked *