I have tried Vue.js and just love it.
Some weeks ago, I started a new project for which, I have to build an internet website.
After spending really long hours on the internet, browsing, collecting every possible testimonials and advice, and comparing them to my first impressions, I decided to start with a hybrid / multiple page site.
(if you are interested in the reasons, it will be the subject of another post).
A hybrid /multiple page sites is a website where the content is rendered both from server-side and client-side at the opposition of single page application (SPA) full client-side and a classical server-side site(PHP..) Since I want to use the power of modern Js Frameworks as double binding, refreshing, Ajax widgets, Es2016, reactive programming, and somewhat control which pages need to be reloaded, I had to make a choice.
The framework selection
I made the following list :
- Angular 2+ (they are increasing the major version number for each patch 😅)
- Ember. Js
- JQuery (it is a joke)
I defined some selection criteria besides the popularity :
A good framework should offer different levels of usages from the straightforward approach to build quickly and easily a website with common use cases to the low-level approach where the experimented developer is able to tune the required details. What has been done in Laravel, Spring framework or Symphony are good samples.
Symphony framework is known as a huge galaxy. Many components, industry quality grade, but an overwhelming complexity if you start head-on.
Therefore they have created a microframework called Silex to bootstrap a PHP application without the nasty details and it is deadly simple. If you want more complex things, the components behind Silex are the Symphony ones.
For a web framework, always study how do they handle forms. Especially a basic post form. It takes five minutes in plain HTML to build an (unsecured) form. How long does it take with this framework?
The same thing works for **Spring* and Spring boot.
The framework must have a business-friendly license. No doubt, no legal restriction for the future company. (by the way, do you know you cannot build weapons software in Java, please stick to the line…)
An extensible / plug-ins architecture. I believe the success of a framework resides in the possibility to enable the necessary functionalities (aka feature toggling) during your project. Authentication, reactive programming, lazy loading, modularity.
The evaluation (aka trolling section)
Based on these selection criteria, here is my evaluation.
Disclaimer: I have high respect for the guys who wrote these frameworks and I do not doubt their outstanding skills. AngularJS
I have experienced projects with AngularJS and I renounced it since it is a deprecated technology. Too much code bloat, slow (I should rather say hard-to-tune), and all efforts are concentrated on the new Angular framework. Also, I think I could have a problem with my use case and disabling the AngularJS router.
Angular 2: I have received training in January and wrote several prototypes since. I have been a huge fan of typescript, angular-cli. I was happy and thinking, they took the best ideas from the other frameworks and build a big melting pot.
In Angular, you will find web components, uses template a la React.js, you have opt-in double binding, directives, modular architecture, lazy loading, and so on and so on. But I progressively hate Angular for many details, slowing me down in my developments.
I really dislike their API and concepts to build forms. You have two choices, a template form design, and a programmatic form design. The first one is almost useless and the second one is deadly cumbersome.
In Angular, they decided to kill HTML and recreate it. How? Case-sensitive attributes and non HTML attributes. You cannot use your normal code editor on it. Beautifier tools not works or partially works. And worse of all, they conceive this awful syntax based on brackets, parens, Well, I think they are huge practitioners of the Brainfuck language.
The last issue I encountered is with their wish to produce an industrial, scalable (in the sense if I put more developers on my project, I maintain a stable learning and complexity curve). Yes, they provide dependency injection, IOC. But it really increases the learning curve.
I really wanted to start with React.js. As far I have studied it, the framework seems full of promises, with some nice pluggable functionalities.
Since there is a threat for the future business (everything can be considered as a social network after all), I have rejected it.
I have never tried Ember.js. Based on my readings, the framework is definitely worth attention to building SPA applications but not for my use case. Note: during the writing of this post, I felt on that link, confirming that maybe I was wrong about ember.js
On Twitter, I am receiving a lot of feedback from happy users of Vue.js and I decided to give it a try.
The syntax seems deadly simple.
Here is the brief of my experience :
I did not use vue-cli, I had to create my own packaging to adapt Vue.js to multipage architecture.
Code bloat: the Vue.js framework is really simple and the documentation quite good. The documentation for the plug-in vue-loader is quite good but I really hate the webpack syntax to enable it (rant..)
Learning curve: I did not try the most hard-core functionalities of Vue.js, though I am using vue-loader, a different template renderer (pug), transitions, a few components, and lazy loading.
My biggest difficulty has been to maintain my js bundle as low as possible by producing chunks.
The second issue has been to understand why creating a view was creating an App and my component below using the render() function. However, I think that Vue.js is easier than Angular. 2.
As in the previous example, the syntax is quite straightforward, no need to learn complex concepts, to begin with.
The framework is also compatible with Typescript and the logic behind is quite simple.
Vue.js can be extended with several plug-ins and functionalities. I did not try all of them and the fact you are enabling them manually is comforting me in my approach.
Vue.js is not enforcing a particular programming paradigm(IOC, interfaces, Reactive programming, or. RxJS).
The only reproach I could formulate is a little fear about the Vue.js ecosystem. Please integrate existing libraries rather than trying to recreate or mimic ReactJS libraries.
In conclusion, both of these frameworks are legitimate and have their lot of practitioners, and I don’t blame it. Vue.js has been my choice and I do not regret it, yet, since it has made my project easy, fun, and effective.
I will try to provide more feedback in the following weeks especially on form editing, unit testing, and E2E testing.
Thanks for your attention