Coding Structure
Angular 2 is a front-end web framework written in typescript. Typescript is inherited from Javascript. Here at Oizom, we follow the coding conventions followed by typescript language standards and angular 2 style guide. Although, there are some exceptions in which the coding format can be altered. These exceptions shall be looked thoroughly and be checked for possible alternatives. If no alternatives fulfill the purpose, use the javascript library with their coding standards.
We strictly follow the standards provided in Angular 2 style guide written by core angular 2 team and experts.
Here are few standards that we insist on following while coding this application:
Controllers/Modules/Services or any other component under root module should be used only if the content affects the entire application. If a component needs to be shared through the entire application, define it under Shared Modules.
All the content modules must be lazy loaded, even if it is called first while opening the application.
Style sheets (*.scss) under shared module are to be imported by every content modules. Avoid unnecessary declarations for the same. Whenever possible, make all the style sheets redundant.
Modularize the application for each major features.
If javascript library is used, create its component in support directory of corresponding content module. If library is used globally, use shared modules directory for the same.
Do not add javascript file to source code. If any external javascript modules (third party) required, install it using node installer (npm) and update package.json. (npm i --save ).
The modules which require user authentication to run should be declared under User Module. Others should be declared as a direct child to root component (make proper use of hierarchy if possible).
Use standard syntax for the comments in each file. Append your name in @author if you have contributed in existing file. Keep all the parameters in the header comments of each file updated.
The project is maintained with VCS using git protocol. When defining new component, make sure you add relevant files to .gitignore.
Make use of comments sections efficiently. Describe the work you contribute in comments. If needed, request the development team to make changes in the official docset to elaborate your work for future development.
Maintain dependency versions in sync with hosted code repository. If any dependency requires to be upgraded, bring the issue to their attention.
Last updated