back to all posts

Making my fingertips dirty with technical stuff

Published in software-development by max.favilli, 9/5/2015 0

A rather innocent and naive question on Quora sparked a fiery debate, as usual when programmers start debating about what language, framework, library, etc… is better.

I don’t want to continue that debate on what JS framework is better, AngularJS or React.js. I don’t like those fanboy fights in general. I like both those frameworks, and I fully understand why they are different. There’s a side discussion which originated within comments to that question which I would like to recap here.

It’s my fault to have started that side discussion writing…

React looks nice, it’s performance when rendering HTML is it’s strongest achievement, but there’s one fundamental design choice in React that I can’t swallow. To change the DOM you need to use React beautiful designed Classes. That’s because React manage a virtual version of the DOM, which keeps in synch with the browser DOM, to be able to modify it very fast and improve overall performance.
I like Angular (and mustache, and handlebars, etc…) approach much more, angular embrace HTML as it’s template language, and it’s bracket notation just make it incredibly easy to, and quick to, develop applications thanks to native two-way-data-binding.

I feel it’s the wrong thing to have javascript dynamically generate HTML. HTML was not designed for that purpose and it’s making it extremely painful to change it later.

If you have never done it, it may sound like you are injecting javascript in HTML which is even worst than generating HTML through JS.

Actually when you use angularjs or handlebarsjs or knockoutjs (which is also good, everything is good! when you use it for the purpose it was designed!) or any other HTML templating framework/library you do not put javascript into html, you use mustache bracket notation to inject your model content. HTML is not intact, but it’s used for what is intended to be used, markup content.

Now, it’s also true, however you generate HTML, these days you can theoretically manipulate it with css to make it look totally different, in color, shape, size and position.

But, it seems to me totally unrealistic to believe once you have built the HTML for a page you will never change it, or that you will never drastically change it. Sooner or later you will have to do it, that’s real world. And when you do it, is much simpler if all you have to do is edit an html template, than going through javascript to change it. No matter how beautifully designed is the javascript library manipulating it.

And, this React tutorial is perfect to let my eyebrow rise, because this template will always be easier to manipulate.


It looks smart, and fast, and if I was starting to develop from scratch a backend application, I would seriously consider it over AngularJS. But for a frontend app, where in six months it maybe required to overhaul the whole UI? I don’t think I would dare to.


This video comparing React and AngularJS is rather interesting, even if also scratching just the surface analyzing one (different) aspect.

Join the discussion



No comments yet! Be the first to comment!