November 13, 2016
VueJS has been getting a fair amount of press recently. Most of it is from
people who write frontend code for a living. I’ve instead spent most of my
professional life working with backend & infrastructure code so I consider
myself a new entrant to the JS world. I do have some memories writing JS, but they
go back to the days when Rails 2.3 was still new and jQuery was the hot new thing.
Which means in those days you could drop in a script tag, wrap everything around
$(document).ready and no one would raise an eyebrow.
A lot of people give all sorts of technical reasons why Vue is better than X. I won’t do that. Partly because the Vue comparison guide does that already. And partly because I think every project is better than every other project at serving at least one use case. So comparing engineering approaches does not feel right. Instead, I list out the top 3 non-technical reasons why I like working with Vue.
Frameworks are supposed to make your life easier, by giving you a set of tools
and then letting you think about your application logic. To me, that sounds like
the reason why frameworks exist. And the lower the surface area of the API is
(another metric instead of surface area might be how intuitive the API is),
the easier it is to keep all of it in your head. This, in turn, frees up your
brain to think about the actual problem at hand. And this is exactly the first
reason I like Vue. The API by itself is tiny. You have the HTML views,
computed properties. And that’s basically it. You can skim
through the documentation in less than half a day and basically start writing
We make decisions all day, and every decision we make costs brain power. I’ve often noticed that the more decisions I have to make, the worse is my ability to make more decisions. A JS framework these days has to provide more than just the view layer. The fact that Vue provides “official recommendations” on what software to pick and how to setup tools to organize your build pipeline saves me so many decision tokens. For a new entrant, it can be very overwhelming to setup the entire build process before even getting to write some application code. And if the framework helps you do that - excellent!
The third, and slightly technical reason is that Vue lets my application evolve. It somehow hits the sweet spot between adding callbacks to server-side rendered pages, and a complete SPA website. I can pull the it towards the jQuery end of things and just drop in a script tag and write some tiny logic that keeps some elements in sync with some others. And when my application complexity grows, I can also pull the framework towards the React side of things, and organize everything around components to introduce some sanity. Nothing is enforced from the beginning. The evolution is completely organic.
At the end of the day, we all want to solve problems. Your application could always be better from an engineering perspective. But finding that sweet spot when it’s engineered well enough and also solves business needs can be difficult. And somehow Vue helped me get there faster than anything else could. That’s not to say that it’s not achievable using other frameworks. It basically comes down to choosing the right tool for the job keeping in mind the context constraints.