SlideShare a Scribd company logo
Naming
Conventions
http://www.oracle.com/technetwork/jav
a/codeconventions-135099.html
Why?
• Naming conventions make programs more
understandable by making them easier to read
Packages
• Is always written in all-lowercase ASCII letters and
should be one of the top-level domain
names, currently com, edu, gov, mil, net, org, or
one of the English two-letter codes identifying
countries as specified in ISO Standard 3166, 1981.
• Subsequent components, according to an
organization's own internal naming conventions.
Such conventions might specify that certain
directory name components be
division, department, project, machine, or login
names.
Example
• com.sun.eng
• com.apple.quicktime.v2
• edu.cmu.cs.bovik.cheese
Classes
• Should be nouns, in mixed case with the first letter of
each internal word capitalized.
• Try to keep your class names simple and descriptive.
• Use whole words-avoid acronyms and
abbreviations.
Example
• class Raster;
• class ImageSprite;
• class RequestQueue;
Interfaces
• Interface names should be capitalized like class
names.
• Example :
interface RasterDelegate;
interface Storing;
Methods
• should be verbs, in mixed case with the first letter
lowercase, with the first letter of each internal word
capitalized.
• Example :
run();
runFast();
getBackground();
Variables
Are in mixed case with a lowercase first letter.
Internal words start with capital letters.
• Should not start with underscore _ or dollar sign $
characters, even though both are allowed.
• Should be short yet meaningful. The choice of a
variable name should be mnemonic- that
is, designed to indicate to the casual observer the
intent of its use
•
Example
• int i, j;
• char c;
• float myWidth;
Constants
• The names of variables declared class constants
and of ANSI constants should be all uppercase with
words separated by underscores ("_"). (ANSI
constants should be avoided, for ease of
debugging.)
Example
• static final int MIN_WIDTH = 4;
• static final int MAX_WIDTH = 999;
• static final int GET_THE_CPU = 1;

More Related Content

PPTX
From Idea to Implementation
PPT
A P Notes Sept 1 2009
PPT
Internet Bookmobile Presentation
PPT
Art Of Creating Career Connections
PPS
Orhideje i-misli
PPT
Database.Cache&Buffer&Lock
PPT
Kelly ruggles 2
From Idea to Implementation
A P Notes Sept 1 2009
Internet Bookmobile Presentation
Art Of Creating Career Connections
Orhideje i-misli
Database.Cache&Buffer&Lock
Kelly ruggles 2

Viewers also liked (18)

PPS
I Ovo Ce Proci
PPT
Antarctica Exploration ICEBLOCK Intro for Children
PPSX
Leon Chartarifsky
PPT
PPS
Best photos cnn 2004
PPT
Zakład ZTPOK w nowoczesnym systemie gospodarki odpadami
PDF
A binary graphics recognition algorithm based on fitting function
PDF
Fatal Accident Nprotected Rebar External
PPTX
Charles Gould at Learning Live 2014: Total learning: learn faster, work smart...
PDF
Home Grown Nov 09
PPT
Bios 275 Final Project
PDF
Expo Booking Form Wynyard
PPT
Continuous design innovation - 10 ways to improve the learner experience
PPTX
Diary of a next generation learner [Learning Technologies Summer Forum 2013 s...
PDF
Networked Citizens a Cagliari: presentazione libro e open lesson
PPT
Branding Yourself For Success
PDF
「ハイパーバイザの作り方」読書会#2
PDF
Behavioral addictions
I Ovo Ce Proci
Antarctica Exploration ICEBLOCK Intro for Children
Leon Chartarifsky
Best photos cnn 2004
Zakład ZTPOK w nowoczesnym systemie gospodarki odpadami
A binary graphics recognition algorithm based on fitting function
Fatal Accident Nprotected Rebar External
Charles Gould at Learning Live 2014: Total learning: learn faster, work smart...
Home Grown Nov 09
Bios 275 Final Project
Expo Booking Form Wynyard
Continuous design innovation - 10 ways to improve the learner experience
Diary of a next generation learner [Learning Technologies Summer Forum 2013 s...
Networked Citizens a Cagliari: presentazione libro e open lesson
Branding Yourself For Success
「ハイパーバイザの作り方」読書会#2
Behavioral addictions
Ad

Similar to Naming conventions (20)

PDF
UNIT I cloud computing ppt cloud ccd all about the cloud computing
PPT
GTU Guidelines for Project on JAVA
PPTX
Coding conventions
PDF
Building iOS App Project & Architecture
PPTX
The right way coding for ios app development
PPTX
Lecture-3.pptx and faculty. His research interests include RF sensing,
PDF
1. Coding Conventions [Part 1]
PPT
Naming standards and basic rules in .net coding
PDF
Java Coding Conventions
DOC
Coding standards php
PPTX
Java_code_convention_ppt_report for group 1.pptx
PDF
What's in a Name?
PPTX
Ppt programming by alyssa marie paral
PPT
Bb Tequila Coding Style (Draft)
PDF
Learn C# programming - Interfaces & Namespaces
PPTX
Writing High Quality Code in C#
PPTX
Coding standards
PPT
Codings Standards
PPT
Best Practices of Software Development
UNIT I cloud computing ppt cloud ccd all about the cloud computing
GTU Guidelines for Project on JAVA
Coding conventions
Building iOS App Project & Architecture
The right way coding for ios app development
Lecture-3.pptx and faculty. His research interests include RF sensing,
1. Coding Conventions [Part 1]
Naming standards and basic rules in .net coding
Java Coding Conventions
Coding standards php
Java_code_convention_ppt_report for group 1.pptx
What's in a Name?
Ppt programming by alyssa marie paral
Bb Tequila Coding Style (Draft)
Learn C# programming - Interfaces & Namespaces
Writing High Quality Code in C#
Coding standards
Codings Standards
Best Practices of Software Development
Ad

Recently uploaded (20)

PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Getting Started with Data Integration: FME Form 101
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
DOCX
search engine optimization ppt fir known well about this
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Unlock new opportunities with location data.pdf
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
STKI Israel Market Study 2025 version august
PPTX
The various Industrial Revolutions .pptx
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
CloudStack 4.21: First Look Webinar slides
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PPT
Geologic Time for studying geology for geologist
PDF
Hybrid model detection and classification of lung cancer
Web Crawler for Trend Tracking Gen Z Insights.pptx
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Getting Started with Data Integration: FME Form 101
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Group 1 Presentation -Planning and Decision Making .pptx
search engine optimization ppt fir known well about this
Hindi spoken digit analysis for native and non-native speakers
Unlock new opportunities with location data.pdf
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
STKI Israel Market Study 2025 version august
The various Industrial Revolutions .pptx
Univ-Connecticut-ChatGPT-Presentaion.pdf
CloudStack 4.21: First Look Webinar slides
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
A comparative study of natural language inference in Swahili using monolingua...
Zenith AI: Advanced Artificial Intelligence
sustainability-14-14877-v2.pddhzftheheeeee
Geologic Time for studying geology for geologist
Hybrid model detection and classification of lung cancer

Naming conventions

  • 2. Why? • Naming conventions make programs more understandable by making them easier to read
  • 3. Packages • Is always written in all-lowercase ASCII letters and should be one of the top-level domain names, currently com, edu, gov, mil, net, org, or one of the English two-letter codes identifying countries as specified in ISO Standard 3166, 1981. • Subsequent components, according to an organization's own internal naming conventions. Such conventions might specify that certain directory name components be division, department, project, machine, or login names.
  • 5. Classes • Should be nouns, in mixed case with the first letter of each internal word capitalized. • Try to keep your class names simple and descriptive. • Use whole words-avoid acronyms and abbreviations.
  • 6. Example • class Raster; • class ImageSprite; • class RequestQueue;
  • 7. Interfaces • Interface names should be capitalized like class names. • Example : interface RasterDelegate; interface Storing;
  • 8. Methods • should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized. • Example : run(); runFast(); getBackground();
  • 9. Variables Are in mixed case with a lowercase first letter. Internal words start with capital letters. • Should not start with underscore _ or dollar sign $ characters, even though both are allowed. • Should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use •
  • 10. Example • int i, j; • char c; • float myWidth;
  • 11. Constants • The names of variables declared class constants and of ANSI constants should be all uppercase with words separated by underscores ("_"). (ANSI constants should be avoided, for ease of debugging.)
  • 12. Example • static final int MIN_WIDTH = 4; • static final int MAX_WIDTH = 999; • static final int GET_THE_CPU = 1;

Editor's Notes

  • #6: unless the abbreviation is much more widely used than the long form, such as URL or HTML.
  • #10: ការ​ជ្រើសរើស​ឈ្មោះ​អថេរ គួរ​តែ​ត្រូវ​បាន​ជំនួយ​ជា​ការ​រំលឹក​ដឹង, ត្រូវ​បាន​បង្កើត​ឡើង​ដើម្បី​ចង្អុល​បង្ហាញគោល​បំណង​នៃ​ការ​ប្រើប្រាស់​របស់​វា