SlideShare a Scribd company logo
CODING STANDARDS
What are Coding Standards
 Coding standards are guidelines for code style
Why Have Coding Standards
 Greater consistency between developers
 Easier to develop and maintain
CODING STANDARDS
 Home page developed first
 Naming Convention
 Code Alignment
 Code Commenting
 Validate HTML and CSS
CODE ALIGNMENT
CODE ALIGNMENT
CODE COMMENT
/** Function to get customer details
@functionName: customerDetails
@params:{customerId:’’}
**/
$scope.customerDetails=function(){
//Call customer service to get fetch customer
details
}
NAMING CONVENTION
 Do not use number as variable like number1,span2
etc.
 Write name of file, folder ,function related to code.
 Use camelCase-For example- customerDetails
FOLDER STRUCTURE
 All common file should be in common folder. Directives, filters in
common folder as directives.js,filter.js
 CSS folder- inside module specific CSS, one master CSS file for
common.
 All third party JS would be in vendor folder.
 Pages Folder - Example- profile- ->profile.html,
profileController.js,profileServices.js (service file would be common
for subfolder) ,if profile has subfolder then -profile->personal-
>personal.html,personalController.js.
 Image folder –module wise.
DON’T
 Do not declare constant/global value in every files, Use a common
file.
 Do not use localStorage.
 Do not console.log();
 Don’t used $apply();
 Remove extra injection- like $rootScope if you are not using it do not
inject.
 Do not write inline CSS.
 Do not use var in angular project.
 Do not use $stateParams, $rootScope, instead of these use
services, because $stateParams does not reset when transitioning
back to current state.
 Local Storage- If we are working on offline facility then store
sensitive data in encoded form in SQLite.
DO
 Proper comments for functions, services, controllers and variables
 Remove console.log once you are done.
 Use class for css.
 Use keyword “use strict” in controllers, because it disallows global
variables.
 Write common function if applicable.
 Clean services after logout-(make common file).
THANK YOU
Miss. Shipra Shivastav Churan

More Related Content

PDF
Ch. 11 deploying
PDF
XpDays - Automated testing of responsive design (GalenFramework)
PPTX
Android webinar class_5
PPTX
Directives
PDF
Intro to RESTFul API's with ColdBox MVC
PDF
Config management
Ch. 11 deploying
XpDays - Automated testing of responsive design (GalenFramework)
Android webinar class_5
Directives
Intro to RESTFul API's with ColdBox MVC
Config management

Similar to Coding standards (20)

PPTX
Ruby on Rails: Coding Guideline
PDF
AEM Sightly Deep Dive
PDF
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
PDF
Case Study _Cloud Native Transformation Deploying Integration workloads to AK...
PPTX
Rails application refactoring steps
PDF
The Naked Bundle - Tryout
PDF
Best Practice In Nutshell
PDF
Social Connections VI — IBM Connections Extensions and Themes Demystified
PPTX
Building maintainable javascript applications
RTF
Readme
PDF
Learning To Run - XPages for Lotus Notes Client Developers
PDF
SCR Annotations for Fun and Profit
PPT
Selected Topics ASP.NET2
PDF
treeview
PDF
treeview
PDF
CUST-3 Document Management with Share
PDF
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
PPT
Advanced Web Form Practices - Miguel A. Castro
PDF
Building a Custom Theme in Drupal 8
PDF
C# .NET Developer Portfolio
Ruby on Rails: Coding Guideline
AEM Sightly Deep Dive
Strategies and Tips for Building Enterprise Drupal Applications - PNWDS 2013
Case Study _Cloud Native Transformation Deploying Integration workloads to AK...
Rails application refactoring steps
The Naked Bundle - Tryout
Best Practice In Nutshell
Social Connections VI — IBM Connections Extensions and Themes Demystified
Building maintainable javascript applications
Readme
Learning To Run - XPages for Lotus Notes Client Developers
SCR Annotations for Fun and Profit
Selected Topics ASP.NET2
treeview
treeview
CUST-3 Document Management with Share
Kicking off with Zend Expressive and Doctrine ORM (PHP Srbija 2017)
Advanced Web Form Practices - Miguel A. Castro
Building a Custom Theme in Drupal 8
C# .NET Developer Portfolio
Ad

Recently uploaded (20)

PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Well-logging-methods_new................
PPTX
UNIT 4 Total Quality Management .pptx
PPT
Mechanical Engineering MATERIALS Selection
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPT
Project quality management in manufacturing
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
OOP with Java - Java Introduction (Basics)
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Geodesy 1.pptx...............................................
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
bas. eng. economics group 4 presentation 1.pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Well-logging-methods_new................
UNIT 4 Total Quality Management .pptx
Mechanical Engineering MATERIALS Selection
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
R24 SURVEYING LAB MANUAL for civil enggi
Project quality management in manufacturing
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
CH1 Production IntroductoryConcepts.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
OOP with Java - Java Introduction (Basics)
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Internet of Things (IOT) - A guide to understanding
Geodesy 1.pptx...............................................
CYBER-CRIMES AND SECURITY A guide to understanding
Automation-in-Manufacturing-Chapter-Introduction.pdf
Ad

Coding standards

  • 2. What are Coding Standards  Coding standards are guidelines for code style Why Have Coding Standards  Greater consistency between developers  Easier to develop and maintain
  • 3. CODING STANDARDS  Home page developed first  Naming Convention  Code Alignment  Code Commenting  Validate HTML and CSS
  • 6. CODE COMMENT /** Function to get customer details @functionName: customerDetails @params:{customerId:’’} **/ $scope.customerDetails=function(){ //Call customer service to get fetch customer details }
  • 7. NAMING CONVENTION  Do not use number as variable like number1,span2 etc.  Write name of file, folder ,function related to code.  Use camelCase-For example- customerDetails
  • 8. FOLDER STRUCTURE  All common file should be in common folder. Directives, filters in common folder as directives.js,filter.js  CSS folder- inside module specific CSS, one master CSS file for common.  All third party JS would be in vendor folder.  Pages Folder - Example- profile- ->profile.html, profileController.js,profileServices.js (service file would be common for subfolder) ,if profile has subfolder then -profile->personal- >personal.html,personalController.js.  Image folder –module wise.
  • 9. DON’T  Do not declare constant/global value in every files, Use a common file.  Do not use localStorage.  Do not console.log();  Don’t used $apply();  Remove extra injection- like $rootScope if you are not using it do not inject.  Do not write inline CSS.
  • 10.  Do not use var in angular project.  Do not use $stateParams, $rootScope, instead of these use services, because $stateParams does not reset when transitioning back to current state.  Local Storage- If we are working on offline facility then store sensitive data in encoded form in SQLite.
  • 11. DO  Proper comments for functions, services, controllers and variables  Remove console.log once you are done.  Use class for css.  Use keyword “use strict” in controllers, because it disallows global variables.  Write common function if applicable.  Clean services after logout-(make common file).
  • 12. THANK YOU Miss. Shipra Shivastav Churan