Today, developing applications has become an easy task. We easily get ready made templates that makes the life of an application developer easy. But there is a difference in building applications and building efficient and scalable applications.
In this article, I am going to highlight some of the important considerations that we should keep in mind to build highly scalable, maintainable and efficient angular applications.
Modularity / Code Structure
First thing that comes in mind, is the application structure. One can do that in many ways, but one of the best approaches that is highly recommended is the modular approach.
In this approach, application is divided into self contained modules. In a large application, we usually have some services and components that are used in different modules. So we place those under shared module which other modules can import and use.
Modular approach provides following benefits:
1. Code Readability
2. Application loading time reduces
You must be wondering how modularity can help in reducing application load time. Let me explain it in brief. Angular Framework introduced a feature - Lazy Loading that helps in reducing the initial application loading time. When user defines a module to be lazy loaded module, angular creates a separate chunk of that module and that module is loaded on demand.
Data Flow Management
After code structure the thing which is crucial for a large application is the data flow management. There are tons of ways to get data into your applications. Angular 4 is extremely flexible in what it allows for data architecture. Some of the new ideas explored for data flow are:-
1. Two way data binding
2. Flux
3. Observables
A data strategy that works for one project doesn’t necessarily work for others. So it’s very important to understand the nature of your application and data strategy that best suits your requirement.
Before implementing any data strategy, one should clearly identify the pros and cons of the different strategies provided by the framework.
Third Party Libraries
When we build large scale applications, we end up in using lot many third party libraries that serves our purpose and we don’t have to reinvent the same ourselves. But before using any third party library we should answer some of the questions that can save us from issues arising from these libraries in future.
How often we are going to use that feature?
Is that library customizable to serve our needs?
Does that library has other dependencies?
Does that library is actively maintained?
Answering all these questions can help you in deciding whether you should create your own component or go for third party library. Sometimes, creating something from scratch proves to be more beneficial than using third party library.
Code Consistency
This is one of the important aspect of building a large application when multiple people are working on different modules of the application. Each developer has its own way of writing the code and comments.
So when working in a large team, code style checkers, linters and code editor / formatter should be setup before the actual coding begins. It’s the responsibility of each developer to adhere to those standards. If you adhere to the standards, it will be easy to maintain the large codebase.
Summary
In this article, we have tried to articulate some of the important points that we experienced while developing Angular applications. There can be other factors / points one should be keeping in mind.
Hope you enjoyed reading. Happy Coding...
In this article, I am going to highlight some of the important considerations that we should keep in mind to build highly scalable, maintainable and efficient angular applications.
Modularity / Code Structure
First thing that comes in mind, is the application structure. One can do that in many ways, but one of the best approaches that is highly recommended is the modular approach.
In this approach, application is divided into self contained modules. In a large application, we usually have some services and components that are used in different modules. So we place those under shared module which other modules can import and use.
Modular approach provides following benefits:
1. Code Readability
2. Application loading time reduces
You must be wondering how modularity can help in reducing application load time. Let me explain it in brief. Angular Framework introduced a feature - Lazy Loading that helps in reducing the initial application loading time. When user defines a module to be lazy loaded module, angular creates a separate chunk of that module and that module is loaded on demand.
Data Flow Management
After code structure the thing which is crucial for a large application is the data flow management. There are tons of ways to get data into your applications. Angular 4 is extremely flexible in what it allows for data architecture. Some of the new ideas explored for data flow are:-
1. Two way data binding
2. Flux
3. Observables
A data strategy that works for one project doesn’t necessarily work for others. So it’s very important to understand the nature of your application and data strategy that best suits your requirement.
Before implementing any data strategy, one should clearly identify the pros and cons of the different strategies provided by the framework.
Third Party Libraries
When we build large scale applications, we end up in using lot many third party libraries that serves our purpose and we don’t have to reinvent the same ourselves. But before using any third party library we should answer some of the questions that can save us from issues arising from these libraries in future.
How often we are going to use that feature?
Is that library customizable to serve our needs?
Does that library has other dependencies?
Does that library is actively maintained?
Answering all these questions can help you in deciding whether you should create your own component or go for third party library. Sometimes, creating something from scratch proves to be more beneficial than using third party library.
Code Consistency
This is one of the important aspect of building a large application when multiple people are working on different modules of the application. Each developer has its own way of writing the code and comments.
So when working in a large team, code style checkers, linters and code editor / formatter should be setup before the actual coding begins. It’s the responsibility of each developer to adhere to those standards. If you adhere to the standards, it will be easy to maintain the large codebase.
Summary
In this article, we have tried to articulate some of the important points that we experienced while developing Angular applications. There can be other factors / points one should be keeping in mind.
Hope you enjoyed reading. Happy Coding...