Compare of Angular and Vue.js - bernardopnunes/SoftwareEngineeringSDUW GitHub Wiki
Angular is a part of the JavaScript ecosystem and one of the most popular software development instruments today. It was introduced by Google in 2009 and received warm commendation from the development community. According to the 2019 StackOverflow survey, 30.7 percent of software engineers now apply AngularJS and the new version Angular 2+ to create user interfaces. Since the beginning of 2019, the Angular developer community has grown 50 percent compared to 2018, as stated in NG-Conf 2019.
Angular belongs to the so-called MEAN stack. The acronym describes four technologies that cover major software product development aspects.
M – MongoDB, NoSQL (non-relational) database
E – Express, back-end middleware
A – Angular, front-end framework
N – Node.js, runtime environment. (Learn more about Node.js pros and cons in our dedicated article.)
While engineers may be using Angular regardless of other technologies in the stack, they can always rely on an existing firm ecosystem that also has its full-stack developers, specialists covering all aspects of software development.
- Component-based architecture that provides a higher quality of code
- RxJS: efficient, asynchronous programming
- High Performance
- Google Long-Term Support
- Powerful ecosystem
- Angular directives
- Divided and churning community
- Migrating legacy systems from AngularJS to Angular requires time
- Angular is verbose and complex
- Steep learning curve
VueJS is an open source progressive JavaScript framework used to develop interactive web interfaces. It is one of the famous frameworks used to simplify web development. VueJS focuses on the view layer. It can be easily integrated into big projects for front-end development without any issues.
The installation for VueJS is very easy to start with. Any developer can easily understand and build interactive web interfaces in a matter of time. VueJS is created by Evan You, an ex-employee from Google. The first version of VueJS was released in Feb 2014. It recently has clocked to 64,828 stars on GitHub, making it very popular.
- Vue is called a progressive framework.
This means that it adapts to the needs of the developer.
-
It's an elegant combination of structure and simplicity.
-
Single File Components
-
Class Binding
HTML class binding allows you to pass an object to v-bind:class to dynamically toggle classes. It can coexist with regular class attribute and after evaluation both values will be merged together. And the bound object doesn't have to be inline!
- Style Binding
And the same thing goes for inline style binding. It's almost like writing pure CSS, and you can use both pascal and kebab case.
-
Fast rendering ensured by virtual DOM and minimal load time
-
Core team supported libraries
The greatest benefit of Vue in the war of vue vs angular is it’s absence of pedigree. It is fresh and has little baggage. It has been learning from the mistakes and successes of React & Angular. The way we see it, Vue is lightweight & easy to learn.
You might say Vue.js is pretty damn similar to Angular, and you wouldn’t be far from the truth. In fact, Evan You, the creator of Vue.js is an ex Google employee. In his own words, his initial concept behind the new library was to take what he really liked about Angular and make it lightweight.
- What if I could just extract the part that I really liked about Angular and build something really lightweight. Evan You - creator of Vue.js
1. Templating.
Technically, you can count on identical syntax. There are minor differences in the templating engine when it comes to evaluating objects, arrays, and json data.
Syntax in both Vue.js and Angular:
{{expression}}
2. Model binding.
The syntax and the idea are very similar. Only the attribute names are different.
Angular:
<input ng-model="modelVariable">
<div ng-bind="modelVariable">...</div>
Vue:
<input v-model="modelVariable">
<div v-model="modelVariable">...</div>
3. Loops.
The Vue syntax is clearly inspired by Angular. Differences are minimal. Notice that the Vue.js v-repeat syntax is simplified compared to the Angular syntax.
Angular:
<li ng-repeat="item in items">
{{item.name}}
</li>
Vue:
<li v-repeat="items">
{{name}}
</li>
4. Conditionals
Apart from the ng- and v- prefixes, the code is identical.
Angular:
<div ng-if="value"></div>
<div ng-show="value"></div>
Vue:
<div v-if="value"></div>
<div v-show="value"></div>
1. Complexity
Vuejs is very easy to learn and start with. As discussed earlier, a beginner can take the CDN library of VueJS and get started in codepen and jsfiddle.
For Angular, we need to go through a series of steps for installation and it is little difficult for beginners to get started with Angular.
2. Flexibility and Modularity
AngularJS has strong opinions about how your applications should be structured, while Vue is a more flexible, modular solution. While this makes Vue more adaptable to a wide variety of projects, we also recognize that sometimes it’s useful to have some decisions made for you, so that you can just start coding.
3. Data binding
AngularJS uses two-way binding between scopes, while Vue enforces a one-way data flow between components. This makes the flow of data easier to reason about in non-trivial applications.
4. Directives vs Components
Vue has a clearer separation between directives and components. Directives are meant to encapsulate DOM manipulations only, while components are self-contained units that have their own view and data logic. In AngularJS, directives do everything and components are just a specific kind of directive.
5. Runtime Performance
Vue has better performance and is much, much easier to optimize because it doesn’t use dirty checking. AngularJS becomes slow when there are a lot of watchers, because every time anything in the scope changes, all these watchers need to be re-evaluated again. Also, the digest cycle may have to run multiple times to “stabilize” if some watcher triggers another update. Vue doesn’t suffer from this because it uses a transparent dependency-tracking observation system with async queueing - all changes trigger independently unless they have explicit dependency relationships.
6. TypeScript
Angular essentially requires using TypeScript, given that almost all its documentation and learning resources are TypeScript-based. TypeScript has its benefits - static type checking can be very useful for large-scale applications, and can be a big productivity boost for developers with backgrounds in Java and C#.
However, not everyone wants to use TypeScript. In many smaller-scale use cases, introducing a type system may result in more overhead than productivity gain. In those cases you’d be better off going with Vue instead, since using Angular without TypeScript can be challenging.
7. Size
Recent versions of Angular, with AOT compilation and tree-shaking, have been able to get its size down considerably. However, a full-featured Vue 2 project with Vuex + Vue Router included (~30KB gzipped) is still significantly lighter than an out-of-the-box, AOT-compiled application generated by angular-cli (~65KB gzipped).
8. Learning Curve
To get started with Vue, all you need is familiarity with HTML and ES5 JavaScript (i.e. plain JavaScript). With these basic skills, you can start building non-trivial applications within less than a day of reading the guide.
Angular’s learning curve is much steeper. The API surface of the framework is huge and as a user you will need to familiarize yourself with a lot more concepts before getting productive.
- MVC = model, controller, view = essentially one-way communication = poor interactivity
- MVVM = model, controller, cache, view = two-way communication = rich interactivity
MVC:
Traditional MVC is where there is a
- Model: Acts as the model for data
- View : Deals with the view to the user which can be the UI
- Controller: Controls the interaction between Model and View, where view calls the controller to update model. View can call multiple controllers if needed.
MVVM (Model View View Model)
ViewModel:
- It is the representation of the state of the view.
- It holds the data that’s displayed in the view.
- Responds to view events, aka presentation logic.
- Calls other functionalities for business logic processing.
- Never directly asks the view to display anything.
Angular is a highly popular corporate solution. Banks, financial institutions, and backend developers normally favor Angular. Angular is backed by Google, and companies like WhatsApp, Instagram, PayPal, and many other established companies use it.
Angular is a bigger, more mature framework, and it generally takes more time to develop applications. Vue on the other hand is great for simple, performant applications, as well as for rapid prototyping.
Angular is definitely the more stable solution out of the two due to the backing of Google. As a result, Angular tends to evolve at a healthy pace. Angular has 313k followers on Twitter, compared to 128k followers of Vue. This is not a direct indication of how popular the technologies are, and neither is Google Trends.
Characteristics | Angular | Vue.js |
---|---|---|
Popularity | Popular | Slowly gaining places |
Dependencies | Has to import the required modules | Does not have built in feature |
Compatibility | Projects developed in AngularJS can't be converted to Angular2 due to core differences. | Good with backward compatibility |
TypeScript | User need to have understanding of TypeScript to begin with Angular. | Coding can be done anywhere in codepen using CDN library. |
Flexibility | Not that easy to start working with other existing projects. | Can be easily merged with other projects without any issues. |
Complexity | Little difficult for beginners to start with it. | Beginner can take the CDN library and start with it. |
Performances | Fast and decent pace for front-end development. | Faster and lighter than Angular. |
Angular JS is a better option for those developers who need to deal with both client side and server side modes. If one wishes to create heavy web applications with several components and complex requirements, Angular JS would be an ideal choice. One can also go with Angular JS if there is a requirement to choose the existing components in a new project.
If developers are looking for easier product creation, they should choose Vue JS. It would be a more helpful option when your JavaScript fundamentals are not too strong. If your front end is Laravel community, then you should definitely go with Vue JS since Laravel community considers Vue JS as their most preferred framework. It will reduce the total process time by 50% and also frees up space on the server.
Vue JS is lightweight and acts as a fitter little brother of Angular JS. If you want a less opinionated framework, Vue JS is a better choice than Angular JS whereas Angular JS is a preferred way of building complex applications, yet good quality. So basically which one is perfect boils down to the nature of the project and learning capability of a developer. But Angular JS vs Vue JS both JavaScript frameworks can give the best results for your application development.
- https://www.altexsoft.com/blog/engineering/the-good-and-the-bad-of-angular-development/
- https://selleo.com/blog/vuejs-the-progressive-javascript-framework
- https://prismic.io/blog/3-reasons-to-use-vuejs-in-your-next-web-project
- https://buttercms.com/blog/comparing-angular-vs-vue
- https://www.educba.com/angular-js-vs-vue-js/
- https://vuejs.org/v2/guide/comparison.html#TypeScript