Advantages, disadvantages and limitations of using AngularJS in your SPA
Its strong sides make it the worst choice from the developers’ point of view: the dynamic typing, functional language features such as lambdas and closures, combined with the power of adding, overloading and substituting any object attribute, it easily turns a moderately complex program into a mess that is very hard to navigate, debug and detect errors early. It is demanding on strong developer skills and discipline to compensate for the lack of the inherent language structure. The data storage, intended for a few strings and lists per page, is no match for even the simplest database engines.
To present moment, AngularJS seems to be The Thing, quickly gaining popularity and becoming the de-facto standard next to jQuery.
The main Angular advantages over its closest rival, KnockoutJS, are:
- No need to use observable functions; Angular analyses the page DOM and builds the bindings based on the Angular-specific element attributes. That requires less writing, the code is cleaner, easier to understand and less error prone.
- Angular modifies the page DOM directly instead of adding inner HTML code. That is faster.
- Quite a number of different ways to do the same things, thus accommodating to particular development styles and tasks.
- Extended features such as dependency injection, routing, animations, view orchestration, and more.
- Supported by IntelliJ IDEA and Visual Studio .NET IDEs.
- Supported by Google and a great development community.
That effectively makes Angular the tool of choice for building Single Page Applications.
Angular limitations and disadvantages
The weaknesses are:
- Angular is big and complicated. With multiple ways to do the same thing it is hard to tell which way is better for particular task. Mastering Angular over the “Hello world” level requires considerable efforts. Different developers’ coding styles and habits might complicate integration of different components into a whole solution.
- The lifecycle of Angular application is complex, and to master it you really need to read the code. Compile and link are not intuitive, and specific cases can be confusing (recursion in compile, collisions between directives etc.).
- As the project grows with time, you most likely will need to throw away existing implementations and create new versions using different approaches. Angular implementations scale poorly.
- More than 2000 watchers can severely lag the UI. That limits the complexity of your Angular forms, especially big data grids and lists.
- This article outlines a number of Angular problems, focusing on:
- Some of the problems will never be fixed for Angular 1.*, and Angular 2.0 is just a promise without the firm roadmap yet.
Extensions and Counterparts
While being that big and complex, Angular does not cover everything. From the developers experience, the most useful technologies to complement Angular are:
- ASP.NET Web API. The plain old SOAP and WCF Web Services are history. ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework. A very clean and compact code provides everything that Angular applications might need to post and load data from the server.
- ASP.NET SignalR is a widely used library for ASP.NET developers that makes it incredibly simple to add real-time web functionality to your applications. It is the ability to have your server-side code push content to the connected clients as it happens, in real-time. You may have heard of WebSockets, a HTML5 API that enables bi-directional communication between the browser and server. SignalR is using WebSockets under the covers when it’s available, and gracefully fallback to other techniques and technologies when it isn’t, while your application code stays the same.
Angular is the present-day tool of choice for building Single Page Applications, but is not even close to become a silver bullet.
While alternatives to Angular are usually worse, be prepared for a tough work if your project is over the “medium size, moderate complexity” threshold. Eventually you will have to create your custom next-level framework and usage patterns above Angular. And you need the consistently high skills of the whole team plus the strong lead at all the time.
Andriy Novosiolov got Master’s degree in Applied Mathematics and System Analysis in 1994, however made the first steps in software development around 1984. Since 2001 works in SoftElegance, gradually switched from development to project management in 2003. Has a profound experience in managing various successful Business Automation and SaaS solutions development that took up to 40 man/years of work, participated in some of them as Software Architect as well.
Founded in 1993, SoftElegance is a custom software development company that has been providing reliable services for implementation of SaaS systems, sophisticated business solutions, engineering applications, and business processes automation software. A variety of companies, ranging from dynamic small and medium to Fortune 500, across oil and gas, drilling, engineering, and manufacturing industries, use SoftElegance’s software development outsourcing services. With clients from the U.S. and the E.U., offices in London, Houston, and development centers in Eastern Europe, SoftElegance assists customers in delivering innovative software solutions on a global scale.