SlideShare a Scribd company logo
2
Most read
3
Most read
5
Most read
WELCOME
Best Coding Practices
Why
• The rework time in coding is the actual killer
• 20-25% of the time is spent in reworking in software –
that means, fix the mistakes done
It helps in
• Greater consistency between developers
• Easier to develop and maintain
• Saves time and money
Areas Covered
1. Program Design
2. Naming Conventions
3. Documentation
4. Formatting Conventions
Program design
Way of organizing the component structure, data
structure, and control structure.
• Use standard architectures
– Eg: MVC
• Type of data storage
• Use of algorithms and flowchart
Naming conventions
• Use full English descriptors
• Use mixed case to make names readable
– Camel casing and pascal casing
– Or use underscore for separation
• Avoid long names
• Avoid leading/trailing underscores
Naming convention in Java
Java follows camelcase syntax for naming
Type Convention
Class Should start with uppercase letter and be a noun e.g. String,
Color, Button, System, Thread etc.
Interface Should start with uppercase letter and be an adjective e.g.
Runnable, Remote, ActionListener etc.
Method Should start with lowercase letter and be a verb e.g.
actionPerformed(), main(), print(), println() etc.
Variable Should start with lowercase letter e.g. firstName, orderNumber
etc.
Package Should be in lowercase letter e.g. java, lang, sql, util etc.
Constants Should be in uppercase letter. e.g. RED, YELLOW,
MAX_PRIORITY etc.
Documentation
(Comments)
• Commenting is necessary for maintaining any program
• Without commenting, the program is not complete
• Do not assume that the other person who reads this
program will understand it clearly
• If commenting is not done at the beginning, it is
forgotten.
Documentation
(Comments)
• Program - a physical file – you need to comment the
following at the top.
– at the top of the program - header comment
– what the program achieves
– who coded on what day
• Classes
– Comment at the beginning of the class about what the class does
Ex:
class Employee
// this class is used to manage all information
// about employees and retrieve specific data
Documentation
(Comments)
• Methods within classes
– what this method/function/procedure does
– what are the parameters and their purpose
– what are the return values
• Comment before every loop.
• Comment before every file or database operation
• Comment before every if condition
Formatting
(Comments)
• Indentation
• White space
• Opening and closing the braces/ block
THANK YOU
Ad

Recommended

Coding Best Practices
Coding Best Practices
mh_azad
 
Coding Standards & Best Practices for iOS/C#
Coding Standards & Best Practices for iOS/C#
Asim Rais Siddiqui
 
Coding standards
Coding standards
Mark Reynolds
 
Coding standards for java
Coding standards for java
maheshm1206
 
Constructor in java
Constructor in java
Pavith Gunasekara
 
Coding standards
Coding standards
Mimoh Ojha
 
Arrays in java
Arrays in java
Arzath Areeff
 
Typescript Fundamentals
Typescript Fundamentals
Sunny Sharma
 
Generics in java
Generics in java
suraj pandey
 
Properties and indexers in C#
Properties and indexers in C#
Hemant Chetwani
 
Enumeration in Java Explained | Java Tutorial | Edureka
Enumeration in Java Explained | Java Tutorial | Edureka
Edureka!
 
How Hashmap works internally in java
How Hashmap works internally in java
Ramakrishna Joshi
 
Arrays in Java
Arrays in Java
Naz Abdalla
 
C# classes objects
C# classes objects
Dr.Neeraj Kumar Pandey
 
OOP java
OOP java
xball977
 
Arrays in Java
Arrays in Java
Abhilash Nair
 
Generics
Generics
Ravi_Kant_Sahu
 
Control Flow Statements
Control Flow Statements
Tarun Sharma
 
The Singleton Pattern Presentation
The Singleton Pattern Presentation
JAINIK PATEL
 
C#.NET
C#.NET
gurchet
 
Typescript ppt
Typescript ppt
akhilsreyas
 
Coding conventions
Coding conventions
systemcrashed
 
Strings in Java
Strings in Java
Abhilash Nair
 
Control Statements in Java
Control Statements in Java
Niloy Saha
 
Control structures in java
Control structures in java
VINOTH R
 
Java abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Recursive Function
Recursive Function
Kamal Acharya
 
Control structure C++
Control structure C++
Anil Kumar
 
76829060 java-coding-conventions
76829060 java-coding-conventions
slavicp
 
Coding standards
Coding standards
BishalAryal8
 

More Related Content

What's hot (20)

Generics in java
Generics in java
suraj pandey
 
Properties and indexers in C#
Properties and indexers in C#
Hemant Chetwani
 
Enumeration in Java Explained | Java Tutorial | Edureka
Enumeration in Java Explained | Java Tutorial | Edureka
Edureka!
 
How Hashmap works internally in java
How Hashmap works internally in java
Ramakrishna Joshi
 
Arrays in Java
Arrays in Java
Naz Abdalla
 
C# classes objects
C# classes objects
Dr.Neeraj Kumar Pandey
 
OOP java
OOP java
xball977
 
Arrays in Java
Arrays in Java
Abhilash Nair
 
Generics
Generics
Ravi_Kant_Sahu
 
Control Flow Statements
Control Flow Statements
Tarun Sharma
 
The Singleton Pattern Presentation
The Singleton Pattern Presentation
JAINIK PATEL
 
C#.NET
C#.NET
gurchet
 
Typescript ppt
Typescript ppt
akhilsreyas
 
Coding conventions
Coding conventions
systemcrashed
 
Strings in Java
Strings in Java
Abhilash Nair
 
Control Statements in Java
Control Statements in Java
Niloy Saha
 
Control structures in java
Control structures in java
VINOTH R
 
Java abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Recursive Function
Recursive Function
Kamal Acharya
 
Control structure C++
Control structure C++
Anil Kumar
 
Properties and indexers in C#
Properties and indexers in C#
Hemant Chetwani
 
Enumeration in Java Explained | Java Tutorial | Edureka
Enumeration in Java Explained | Java Tutorial | Edureka
Edureka!
 
How Hashmap works internally in java
How Hashmap works internally in java
Ramakrishna Joshi
 
Control Flow Statements
Control Flow Statements
Tarun Sharma
 
The Singleton Pattern Presentation
The Singleton Pattern Presentation
JAINIK PATEL
 
Control Statements in Java
Control Statements in Java
Niloy Saha
 
Control structures in java
Control structures in java
VINOTH R
 
Java abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Control structure C++
Control structure C++
Anil Kumar
 

Similar to Best coding practices (20)

76829060 java-coding-conventions
76829060 java-coding-conventions
slavicp
 
Coding standards
Coding standards
BishalAryal8
 
Javacodingstandards
Javacodingstandards
Portal_do_Estudante_Java
 
1. Coding Conventions [Part 1]
1. Coding Conventions [Part 1]
Hardik Patel
 
c-coding-standards-and-best-programming-practices.ppt
c-coding-standards-and-best-programming-practices.ppt
VinayakHospet1
 
Java convention
Java convention
Tan Tran
 
Coding conventions
Coding conventions
Thitipong Jampajeen
 
Coding standard and coding guideline
Coding standard and coding guideline
Dhananjaysinh Jhala
 
Coding
Coding
Vishal Singh
 
Writing High Quality Code in C#
Writing High Quality Code in C#
Svetlin Nakov
 
Codings Standards
Codings Standards
Philip Johnson
 
Software development best practices & coding guidelines
Software development best practices & coding guidelines
Ankur Goyal
 
Abcxyz
Abcxyz
vacbalolenvadi90
 
Source Code Quality
Source Code Quality
Alberto Simões
 
Programming style guildelines
Programming style guildelines
Rich Nguyen
 
Java Coding Conventions
Java Coding Conventions
Rodel Barcenas
 
Best Coding Practices in Java and C++
Best Coding Practices in Java and C++
Nitin Aggarwal
 
Variables
Variables
Maha Saad
 
Clean code
Clean code
Uday Pratap Singh
 
CodingStandardsDoc
CodingStandardsDoc
Amol Patole
 
76829060 java-coding-conventions
76829060 java-coding-conventions
slavicp
 
1. Coding Conventions [Part 1]
1. Coding Conventions [Part 1]
Hardik Patel
 
c-coding-standards-and-best-programming-practices.ppt
c-coding-standards-and-best-programming-practices.ppt
VinayakHospet1
 
Java convention
Java convention
Tan Tran
 
Coding standard and coding guideline
Coding standard and coding guideline
Dhananjaysinh Jhala
 
Writing High Quality Code in C#
Writing High Quality Code in C#
Svetlin Nakov
 
Software development best practices & coding guidelines
Software development best practices & coding guidelines
Ankur Goyal
 
Programming style guildelines
Programming style guildelines
Rich Nguyen
 
Java Coding Conventions
Java Coding Conventions
Rodel Barcenas
 
Best Coding Practices in Java and C++
Best Coding Practices in Java and C++
Nitin Aggarwal
 
CodingStandardsDoc
CodingStandardsDoc
Amol Patole
 
Ad

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
Core java - baabtra
Core java - baabtra
baabtra.com - No. 1 supplier of quality freshers
 
Acquiring new skills what you should know
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Php sessions & cookies
Php sessions & cookies
baabtra.com - No. 1 supplier of quality freshers
 
Php database connectivity
Php database connectivity
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 6 database normalisation
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 3 stored procedures
Chapter 3 stored procedures
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Microsoft holo lens
Microsoft holo lens
baabtra.com - No. 1 supplier of quality freshers
 
Blue brain
Blue brain
baabtra.com - No. 1 supplier of quality freshers
 
5g
5g
baabtra.com - No. 1 supplier of quality freshers
 
Aptitude skills baabtra
Aptitude skills baabtra
baabtra.com - No. 1 supplier of quality freshers
 
Gd baabtra
Gd baabtra
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra soft skills
Baabtra soft skills
baabtra.com - No. 1 supplier of quality freshers
 
Ad

Recently uploaded (20)

A Visual Introduction to the Prophet Jeremiah
A Visual Introduction to the Prophet Jeremiah
Steve Thomason
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
HistoPathology Ppt. Arshita Gupta for Diploma
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
How to use search fetch method in Odoo 18
How to use search fetch method in Odoo 18
Celine George
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 6-14-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
Intellectual Property Right (Jurisprudence).pptx
Intellectual Property Right (Jurisprudence).pptx
Vishal Chanalia
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
Tanja Vujicic - PISA for Schools contact Info
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
A Visual Introduction to the Prophet Jeremiah
A Visual Introduction to the Prophet Jeremiah
Steve Thomason
 
NSUMD_M1 Library Orientation_June 11, 2025.pptx
NSUMD_M1 Library Orientation_June 11, 2025.pptx
Julie Sarpy
 
Pests of Maize: An comprehensive overview.pptx
Pests of Maize: An comprehensive overview.pptx
Arshad Shaikh
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
HistoPathology Ppt. Arshita Gupta for Diploma
HistoPathology Ppt. Arshita Gupta for Diploma
arshitagupta674
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
Vitamin and Nutritional Deficiencies.pptx
Vitamin and Nutritional Deficiencies.pptx
Vishal Chanalia
 
How to use search fetch method in Odoo 18
How to use search fetch method in Odoo 18
Celine George
 
Birnagar High School Platinum Jubilee Quiz.pptx
Birnagar High School Platinum Jubilee Quiz.pptx
Sourav Kr Podder
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Photo chemistry Power Point Presentation
Photo chemistry Power Point Presentation
mprpgcwa2024
 
Values Education 10 Quarter 1 Module .pptx
Values Education 10 Quarter 1 Module .pptx
JBPafin
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
Intellectual Property Right (Jurisprudence).pptx
Intellectual Property Right (Jurisprudence).pptx
Vishal Chanalia
 
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
THE PSYCHOANALYTIC OF THE BLACK CAT BY EDGAR ALLAN POE (1).pdf
nabilahk908
 
Tanja Vujicic - PISA for Schools contact Info
Tanja Vujicic - PISA for Schools contact Info
EduSkills OECD
 
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
OBSESSIVE COMPULSIVE DISORDER.pptx IN 5TH SEMESTER B.SC NURSING, 2ND YEAR GNM...
parmarjuli1412
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 

Best coding practices

  • 3. Why • The rework time in coding is the actual killer • 20-25% of the time is spent in reworking in software – that means, fix the mistakes done It helps in • Greater consistency between developers • Easier to develop and maintain • Saves time and money
  • 4. Areas Covered 1. Program Design 2. Naming Conventions 3. Documentation 4. Formatting Conventions
  • 5. Program design Way of organizing the component structure, data structure, and control structure. • Use standard architectures – Eg: MVC • Type of data storage • Use of algorithms and flowchart
  • 6. Naming conventions • Use full English descriptors • Use mixed case to make names readable – Camel casing and pascal casing – Or use underscore for separation • Avoid long names • Avoid leading/trailing underscores
  • 7. Naming convention in Java Java follows camelcase syntax for naming Type Convention Class Should start with uppercase letter and be a noun e.g. String, Color, Button, System, Thread etc. Interface Should start with uppercase letter and be an adjective e.g. Runnable, Remote, ActionListener etc. Method Should start with lowercase letter and be a verb e.g. actionPerformed(), main(), print(), println() etc. Variable Should start with lowercase letter e.g. firstName, orderNumber etc. Package Should be in lowercase letter e.g. java, lang, sql, util etc. Constants Should be in uppercase letter. e.g. RED, YELLOW, MAX_PRIORITY etc.
  • 8. Documentation (Comments) • Commenting is necessary for maintaining any program • Without commenting, the program is not complete • Do not assume that the other person who reads this program will understand it clearly • If commenting is not done at the beginning, it is forgotten.
  • 9. Documentation (Comments) • Program - a physical file – you need to comment the following at the top. – at the top of the program - header comment – what the program achieves – who coded on what day • Classes – Comment at the beginning of the class about what the class does Ex: class Employee // this class is used to manage all information // about employees and retrieve specific data
  • 10. Documentation (Comments) • Methods within classes – what this method/function/procedure does – what are the parameters and their purpose – what are the return values • Comment before every loop. • Comment before every file or database operation • Comment before every if condition
  • 11. Formatting (Comments) • Indentation • White space • Opening and closing the braces/ block