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
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPT
Mechanical Engineering MATERIALS Selection
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PDF
PPT on Performance Review to get promotions
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPT
introduction to datamining and warehousing
PPT
Project quality management in manufacturing
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
Current and future trends in Computer Vision.pptx
PPTX
additive manufacturing of ss316l using mig welding
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Construction Project Organization Group 2.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Safety Seminar civil to be ensured for safe working.
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
CYBER-CRIMES AND SECURITY A guide to understanding
Mechanical Engineering MATERIALS Selection
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PPT on Performance Review to get promotions
UNIT 4 Total Quality Management .pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
introduction to datamining and warehousing
Project quality management in manufacturing
Fundamentals of safety and accident prevention -final (1).pptx
Categorization of Factors Affecting Classification Algorithms Selection
Current and future trends in Computer Vision.pptx
additive manufacturing of ss316l using mig welding
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Construction Project Organization Group 2.pptx
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