SlideShare a Scribd company logo
1 of 18
Friday,October4,2013TOPSTechnologies-JavaTutorial
1 TOPS Technologies – Java Introductory
Tutorial
http://www.tops-int.com/
GTU
GUIDELINE
S FOR
PROJECT
ON JAVA
WHY CODING STANDARDS ARE
IMPORTANT??
• Coding standards for Java are important because they lead to
greater consistency within code of all developers. Consistency leads
to code that is easier to understand, which in turn results in a code,
which is easier to develop and maintain. Code that is difficult to
understand and maintain runs the risk of being scrapped and
rewritten.
• The Prime Directive
• A project requirement may vary from the standards mentioned in this
document. When going against the standards, projects should make
sure to document it.
Friday,October4,2013
2
TOPSTechnologies-JavaTutorial
1. NAMING CONVENTION
• Use full English descriptors that accurately describe the
variable/field/class/interface
• For example, use names like firstName, grandTotal, or
CorporateCustomer.
• Use terminology applicable to the domain
• If the users of the system refer to their clients as Customer,
then use the term Customer for the class, not client.
 Use mixed case to make names readable
 Use abbreviations sparingly, but if you do so then use then
intelligently and document it
 For example, to use a short form for the word “number”,
choose one of nbr, no or num.
 Avoid long names (<15 characters is a good tradeoff)
 Avoid names that are similar or differ only in case
Friday,October4,2013
3
TOPSTechnologies-JavaTutorial
2. DOCUMENTATION
• Comments should add to the clarity of code.
• Avoid decoration, i.e., do not use banner-like
comments
• Document why something is being done, not just
what.
• Java Comments
Friday,October4,2013
4
TOPSTechnologies-JavaTutorial
JAVA COMMENTS
Comment Type Usage Example
Documentation
Starts with /** and
ends with */
Used before
declarations of
interfaces, classes,
member functions,
and fields to
document them.
/**
* Customer – a
person or
* organization
*/
C style
Starts with /* and
ends with */
Used to document
out lines of code that
are no longer
applicable. It is
helpful in debugging.
/*
This code was
commented out by
Ashish Sarin
*/
Single line
Starts with // and go
until the end of the
line
Used internally within
member functions to
document business
logic, sections of
code, and
declarations of
temporary variables.
// If the amount is
greater
// than 10 multiply by
100
Friday,October4,2013
5
TOPSTechnologies-JavaTutorial
3. STANDARDS FOR MEMBER
FUNCTIONS
• 1 Naming member functions
• Member functions should be named using a full English
description, using mixed case with the first letter of any non-
initial word capitalized. The first word of the member function
should be a verb.
• Examples
• openAccount()
• printMailingList()
• save()
• delete()
• This results in member functions whose purpose can be
determined just by looking at its name.
Friday,October4,2013
6
TOPSTechnologies-JavaTutorial
3.1.1 NAMING ACCESSOR MEMBER
FUNCTIONS
• 3.1.1.1 Getters: member functions that return the
value of a field / attribute / property of an object.
• Use prefix “get” to the name of the field / attribute /
property if the field in not boolean
• Use prefix “is” to the name of the field / attribute /
property if the field is Boolean
• A viable alternative is to use the prefix ‘has’ or ‘can’
instead of ‘is’ for boolean getters.
• Examples
• getFirstName()
• isPersistent()
Friday,October4,2013
7
TOPSTechnologies-JavaTutorial
• 3.1.1.2 Setters: member functions that modify
the values of a field.
• Use prefix ‘set’ to the name of the field.
• Examples
• setFirstName()
• 3.1.1.3 Constructors: member functions that
perform any necessary initialization when an
object is created. Constructors are always given
the same name as their class.
• Examples
• Customer()
• SavingsAccount()
Friday,October4,2013
8
TOPSTechnologies-JavaTutorial
3.2 MEMBER FUNCTION VISIBILITY
• A good design requires minimum coupling between
the classes. The general rule is to be as restrictive
as possible when setting the visibility of a member
function. If member function doesn’t have to be
public then make it protected, and if it doesn’t have
to be protected than make it private.
Friday,October4,2013
9
TOPSTechnologies-JavaTutorial
• Techniques for Writing Clean Code:
• Document the code Already discussed above
• Paragraph/Indent the code: Any code between the { and } should be properly
indented
• Paragraph and punctuate multi-line statements
• Example
• Line 1 BankAccount newPersonalAccount =
AccountFactory
• Line 2 createBankAccountFor(currentCustomer, startDate,
• Line 3 initialDeposit, branch)
• Lines 2 & 3 have been indented by one unit (horizontal tab)
• Use white space
• A few blank lines or spaces can help make the code more readable.
• Single blank lines to separate logical groups of code, such as control
structures
• Two blank lines to separate member function definitions
• Specify the order of Operations: Use extra parenthesis to increase the
readability of the code using AND and OR comparisons. This facilitates in
identifying the exact order of operations in the code
• Write short, single command lines Code should do one operation per line So
only one statement should be there per line
Friday,October4,2013
10
TOPSTechnologies-JavaTutorial
6.0 STANDARDS FOR LOCAL
VARIABLES
• 6.1 Naming Local Variables
• 6.1.1 Naming Streams
• 6.1.2 Naming Loop Counters
• 6.1.3 Naming Exception Objects
• 6.2 Declaring and Documenting Local Variables
• Note
• Reusing local variables is more efficient because
less memory needs to be allocated, but reusing
local variables decreases the maintainability of
code and makes it more fragile
Friday,October4,2013
11
TOPSTechnologies-JavaTutorial
7.0 STANDARDS FOR PARAMETERS
(ARGUMENTS) TO MEMBER
FUNCTIONS
 7.1 Naming Parameters
 Parameters should be named following the exact
same conventions as for local variable
 7.2 Documenting Parameters
 Parameters to a member function are documented
in the header documentation for the member
function using the javadoc @param tag. It should
describe:
 What it should be used for
 Any restrictions or preconditions
Friday,October4,2013
12
TOPSTechnologies-JavaTutorial
• 8.0 Standards for Classes
• 8.1 Class Visibility
• Use package visibility for classes internal to a
component
• Use public visibility for the façade of components
• 8.2 Naming classes
• Use full English descriptor starting with the first
letter capitalized using mixed case for the rest of
the name
• 8.3 Documenting a Class
Friday,October4,2013
13
TOPSTechnologies-JavaTutorial
[1]
Java Coding Standards
Packages The prefix of a unique package name
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 of the
package name vary 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.
com.sun.eng
com.apple.quicktim
e.v2
edu.cmu.cs.bovik.c
heese
Classes Class names 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
(unless the abbreviation is much more
widely used than the long form, such as
URL or HTML).
class Raster;
class ImageSprite;
Friday,October4,2013
14
TOPSTechnologies-JavaTutorial
Identifier Type Rules for Naming Examples
Interfaces Interface names should
be capitalized like class
names.
interface
RasterDelegate;
interface Storing;
Methods Methods should be
verbs, in mixed case
with the first letter
lowercase, with the first
letter of each internal
word capitalized.
run();
runFast();
getBackground();
Friday,October4,2013
15
TOPSTechnologies-JavaTutorial
class constants are in mixed case with a
lowercase first letter. Internal words start with
capital letters. Variable names should not start
with underscore _ or dollar sign $ characters,
even though both are allowed.
Variable names 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. One-
character variable names should be avoided
except for temporary "throwaway" variables.
Common names for temporary variables are i, j,
k, m, and n for integers; c, d, and e for
characters.
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.)
static final int
MIN_WIDTH =
4;
static final int
MAX_WIDTH =
999;
static final int
GET_THE_CPU
= 1;
Friday,October4,2013
16
TOPSTechnologies-JavaTutorial
AND MORE QUESTION ANSWER AND
INTERVIEW TRAINING AND PRACTICE AT
TOPS TECHNOLOGIES
 BIO:
 http://www.tops-int.com/
 http://www.tops-int.com/java-training-course.html
 Visit nearest center of your city
 TOPS Technologies Mehsana
 30, Rajendra estate,
Opp. Gayatri temple, Highway,
Mehsana.
76000 09613
Friday,October4,2013
17
TOPSTechnologies-JavaTutorial
Friday,October4,2013
18
TOPSTechnologies-JavaTutorial

More Related Content

What's hot

Review Session and Attending Java Interviews
Review Session and Attending Java Interviews Review Session and Attending Java Interviews
Review Session and Attending Java Interviews Hitesh-Java
 
Top 100 .Net Interview Questions and Answer
Top 100 .Net Interview Questions and AnswerTop 100 .Net Interview Questions and Answer
Top 100 .Net Interview Questions and AnswerVineet Kumar Saini
 
Code reviews
Code reviewsCode reviews
Code reviewsRoger Xia
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questionsSoba Arjun
 
Object-Oriented Design: Multiple inheritance (C++ and C#)
Object-Oriented Design: Multiple inheritance (C++ and C#)Object-Oriented Design: Multiple inheritance (C++ and C#)
Object-Oriented Design: Multiple inheritance (C++ and C#)Adair Dingle
 
Extreme Interview Questions
Extreme Interview QuestionsExtreme Interview Questions
Extreme Interview QuestionsEhtisham Ali
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorialsakreyi
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interviewKuntal Bhowmick
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web designsmumbahelp
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview QuestionsKuntal Bhowmick
 

What's hot (20)

3b jf h-readingdatafromconsole
3b jf h-readingdatafromconsole3b jf h-readingdatafromconsole
3b jf h-readingdatafromconsole
 
Basic syntax
Basic syntaxBasic syntax
Basic syntax
 
Javanotes
JavanotesJavanotes
Javanotes
 
Review Session and Attending Java Interviews
Review Session and Attending Java Interviews Review Session and Attending Java Interviews
Review Session and Attending Java Interviews
 
Oops in vb
Oops in vbOops in vb
Oops in vb
 
Top 100 .Net Interview Questions and Answer
Top 100 .Net Interview Questions and AnswerTop 100 .Net Interview Questions and Answer
Top 100 .Net Interview Questions and Answer
 
Code reviews
Code reviewsCode reviews
Code reviews
 
Basic IO
Basic IOBasic IO
Basic IO
 
Technical interview questions
Technical interview questionsTechnical interview questions
Technical interview questions
 
Object-Oriented Design: Multiple inheritance (C++ and C#)
Object-Oriented Design: Multiple inheritance (C++ and C#)Object-Oriented Design: Multiple inheritance (C++ and C#)
Object-Oriented Design: Multiple inheritance (C++ and C#)
 
Java Tokens
Java  TokensJava  Tokens
Java Tokens
 
Introduction to JAVA
Introduction to JAVAIntroduction to JAVA
Introduction to JAVA
 
Packages
PackagesPackages
Packages
 
Extreme Interview Questions
Extreme Interview QuestionsExtreme Interview Questions
Extreme Interview Questions
 
C++ classes tutorials
C++ classes tutorialsC++ classes tutorials
C++ classes tutorials
 
Java questions for interview
Java questions for interviewJava questions for interview
Java questions for interview
 
Chap1java5th
Chap1java5thChap1java5th
Chap1java5th
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
 
Complete placement guide(technical)
Complete placement guide(technical)Complete placement guide(technical)
Complete placement guide(technical)
 

Similar to GTU Guidelines for Project on JAVA

76829060 java-coding-conventions
76829060 java-coding-conventions76829060 java-coding-conventions
76829060 java-coding-conventionsslavicp
 
Coding standards for java
Coding standards for javaCoding standards for java
Coding standards for javamaheshm1206
 
Best Coding Practices in Java and C++
Best Coding Practices in Java and C++Best Coding Practices in Java and C++
Best Coding Practices in Java and C++Nitin Aggarwal
 
GTU PHP Project Training Guidelines
GTU PHP Project Training GuidelinesGTU PHP Project Training Guidelines
GTU PHP Project Training GuidelinesTOPS Technologies
 
Writing Clean Code (Recommendations by Robert Martin)
Writing Clean Code (Recommendations by Robert Martin)Writing Clean Code (Recommendations by Robert Martin)
Writing Clean Code (Recommendations by Robert Martin)Shirish Bari
 
Best practices in enterprise applications
Best practices in enterprise applicationsBest practices in enterprise applications
Best practices in enterprise applicationsChandra Sekhar Saripaka
 
Perfomatix - iOS swift coding standards
Perfomatix - iOS swift coding standardsPerfomatix - iOS swift coding standards
Perfomatix - iOS swift coding standardsPerfomatix Solutions
 
Back-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real WorldBack-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real WorldDavid McCarter
 
Standards For Java Coding
Standards For Java CodingStandards For Java Coding
Standards For Java CodingRahul Bhutkar
 
Software Craftmanship - Cours Polytech
Software Craftmanship - Cours PolytechSoftware Craftmanship - Cours Polytech
Software Craftmanship - Cours Polytechyannick grenzinger
 
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedJoão Pedro Martins
 
UiPath Development Best Practices.pptx
UiPath Development Best Practices.pptxUiPath Development Best Practices.pptx
UiPath Development Best Practices.pptxApurbaSamanta9
 
Back-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real WorldBack-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real WorldDavid McCarter
 
Learning from "Effective Scala"
Learning from "Effective Scala"Learning from "Effective Scala"
Learning from "Effective Scala"Kazuhiro Sera
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Christos Manios
 
Uvm cookbook-systemverilog-guidelines-verification-academy
Uvm cookbook-systemverilog-guidelines-verification-academyUvm cookbook-systemverilog-guidelines-verification-academy
Uvm cookbook-systemverilog-guidelines-verification-academyRaghavendra Kamath
 
Extracts from "Clean code"
Extracts from "Clean code"Extracts from "Clean code"
Extracts from "Clean code"VlatkaPavii
 

Similar to GTU Guidelines for Project on JAVA (20)

76829060 java-coding-conventions
76829060 java-coding-conventions76829060 java-coding-conventions
76829060 java-coding-conventions
 
Coding standards for java
Coding standards for javaCoding standards for java
Coding standards for java
 
Best Coding Practices in Java and C++
Best Coding Practices in Java and C++Best Coding Practices in Java and C++
Best Coding Practices in Java and C++
 
GTU PHP Project Training Guidelines
GTU PHP Project Training GuidelinesGTU PHP Project Training Guidelines
GTU PHP Project Training Guidelines
 
Writing Clean Code (Recommendations by Robert Martin)
Writing Clean Code (Recommendations by Robert Martin)Writing Clean Code (Recommendations by Robert Martin)
Writing Clean Code (Recommendations by Robert Martin)
 
Javascript best practices
Javascript best practicesJavascript best practices
Javascript best practices
 
Codings Standards
Codings StandardsCodings Standards
Codings Standards
 
Best practices in enterprise applications
Best practices in enterprise applicationsBest practices in enterprise applications
Best practices in enterprise applications
 
Perfomatix - iOS swift coding standards
Perfomatix - iOS swift coding standardsPerfomatix - iOS swift coding standards
Perfomatix - iOS swift coding standards
 
Back-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real WorldBack-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real World
 
Standards For Java Coding
Standards For Java CodingStandards For Java Coding
Standards For Java Coding
 
Software Craftmanship - Cours Polytech
Software Craftmanship - Cours PolytechSoftware Craftmanship - Cours Polytech
Software Craftmanship - Cours Polytech
 
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
 
UiPath Development Best Practices.pptx
UiPath Development Best Practices.pptxUiPath Development Best Practices.pptx
UiPath Development Best Practices.pptx
 
Back-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real WorldBack-2-Basics: .NET Coding Standards For The Real World
Back-2-Basics: .NET Coding Standards For The Real World
 
Learning from "Effective Scala"
Learning from "Effective Scala"Learning from "Effective Scala"
Learning from "Effective Scala"
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...
 
Coding standard
Coding standardCoding standard
Coding standard
 
Uvm cookbook-systemverilog-guidelines-verification-academy
Uvm cookbook-systemverilog-guidelines-verification-academyUvm cookbook-systemverilog-guidelines-verification-academy
Uvm cookbook-systemverilog-guidelines-verification-academy
 
Extracts from "Clean code"
Extracts from "Clean code"Extracts from "Clean code"
Extracts from "Clean code"
 

More from TOPS Technologies

Learn java objects inheritance-overriding-polymorphism
Learn java objects  inheritance-overriding-polymorphismLearn java objects  inheritance-overriding-polymorphism
Learn java objects inheritance-overriding-polymorphismTOPS Technologies
 
Surat tops conducted one hour seminar on “corporate basic skills”
Surat tops conducted  one hour seminar on “corporate basic skills”Surat tops conducted  one hour seminar on “corporate basic skills”
Surat tops conducted one hour seminar on “corporate basic skills”TOPS Technologies
 
Word press interview question and answer tops technologies
Word press interview question and answer   tops technologiesWord press interview question and answer   tops technologies
Word press interview question and answer tops technologiesTOPS Technologies
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assuranceTOPS Technologies
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programmingTOPS Technologies
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
What is ui element in i phone developmetn
What is ui element in i phone developmetnWhat is ui element in i phone developmetn
What is ui element in i phone developmetnTOPS Technologies
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
Software testing live project training
Software testing live project trainingSoftware testing live project training
Software testing live project trainingTOPS Technologies
 
Web designing live project training
Web designing live project trainingWeb designing live project training
Web designing live project trainingTOPS Technologies
 
iPhone training in ahmedabad by tops technologies
iPhone training in ahmedabad by tops technologiesiPhone training in ahmedabad by tops technologies
iPhone training in ahmedabad by tops technologiesTOPS Technologies
 
08 10-2013 gtu projects - develop final sem gtu project in i phone
08 10-2013 gtu projects - develop final sem gtu project in i phone08 10-2013 gtu projects - develop final sem gtu project in i phone
08 10-2013 gtu projects - develop final sem gtu project in i phoneTOPS Technologies
 
GTU Asp.net Project Training Guidelines
GTU Asp.net Project Training GuidelinesGTU Asp.net Project Training Guidelines
GTU Asp.net Project Training GuidelinesTOPS Technologies
 
GTU Guidelines for Project on Android
GTU Guidelines for Project on AndroidGTU Guidelines for Project on Android
GTU Guidelines for Project on AndroidTOPS Technologies
 

More from TOPS Technologies (20)

Learn java objects inheritance-overriding-polymorphism
Learn java objects  inheritance-overriding-polymorphismLearn java objects  inheritance-overriding-polymorphism
Learn java objects inheritance-overriding-polymorphism
 
Surat tops conducted one hour seminar on “corporate basic skills”
Surat tops conducted  one hour seminar on “corporate basic skills”Surat tops conducted  one hour seminar on “corporate basic skills”
Surat tops conducted one hour seminar on “corporate basic skills”
 
Word press interview question and answer tops technologies
Word press interview question and answer   tops technologiesWord press interview question and answer   tops technologies
Word press interview question and answer tops technologies
 
How to install android sdk
How to install android sdkHow to install android sdk
How to install android sdk
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assurance
 
Basics in software testing
Basics in software testingBasics in software testing
Basics in software testing
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programming
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
What is ui element in i phone developmetn
What is ui element in i phone developmetnWhat is ui element in i phone developmetn
What is ui element in i phone developmetn
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
Java live project training
Java live project trainingJava live project training
Java live project training
 
Software testing live project training
Software testing live project trainingSoftware testing live project training
Software testing live project training
 
Web designing live project training
Web designing live project trainingWeb designing live project training
Web designing live project training
 
Php live project training
Php live project trainingPhp live project training
Php live project training
 
iPhone training in ahmedabad by tops technologies
iPhone training in ahmedabad by tops technologiesiPhone training in ahmedabad by tops technologies
iPhone training in ahmedabad by tops technologies
 
Php training in ahmedabad
Php training in ahmedabadPhp training in ahmedabad
Php training in ahmedabad
 
Java training in ahmedabad
Java training in ahmedabadJava training in ahmedabad
Java training in ahmedabad
 
08 10-2013 gtu projects - develop final sem gtu project in i phone
08 10-2013 gtu projects - develop final sem gtu project in i phone08 10-2013 gtu projects - develop final sem gtu project in i phone
08 10-2013 gtu projects - develop final sem gtu project in i phone
 
GTU Asp.net Project Training Guidelines
GTU Asp.net Project Training GuidelinesGTU Asp.net Project Training Guidelines
GTU Asp.net Project Training Guidelines
 
GTU Guidelines for Project on Android
GTU Guidelines for Project on AndroidGTU Guidelines for Project on Android
GTU Guidelines for Project on Android
 

Recently uploaded

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 

Recently uploaded (20)

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

GTU Guidelines for Project on JAVA

  • 1. Friday,October4,2013TOPSTechnologies-JavaTutorial 1 TOPS Technologies – Java Introductory Tutorial http://www.tops-int.com/ GTU GUIDELINE S FOR PROJECT ON JAVA
  • 2. WHY CODING STANDARDS ARE IMPORTANT?? • Coding standards for Java are important because they lead to greater consistency within code of all developers. Consistency leads to code that is easier to understand, which in turn results in a code, which is easier to develop and maintain. Code that is difficult to understand and maintain runs the risk of being scrapped and rewritten. • The Prime Directive • A project requirement may vary from the standards mentioned in this document. When going against the standards, projects should make sure to document it. Friday,October4,2013 2 TOPSTechnologies-JavaTutorial
  • 3. 1. NAMING CONVENTION • Use full English descriptors that accurately describe the variable/field/class/interface • For example, use names like firstName, grandTotal, or CorporateCustomer. • Use terminology applicable to the domain • If the users of the system refer to their clients as Customer, then use the term Customer for the class, not client.  Use mixed case to make names readable  Use abbreviations sparingly, but if you do so then use then intelligently and document it  For example, to use a short form for the word “number”, choose one of nbr, no or num.  Avoid long names (<15 characters is a good tradeoff)  Avoid names that are similar or differ only in case Friday,October4,2013 3 TOPSTechnologies-JavaTutorial
  • 4. 2. DOCUMENTATION • Comments should add to the clarity of code. • Avoid decoration, i.e., do not use banner-like comments • Document why something is being done, not just what. • Java Comments Friday,October4,2013 4 TOPSTechnologies-JavaTutorial
  • 5. JAVA COMMENTS Comment Type Usage Example Documentation Starts with /** and ends with */ Used before declarations of interfaces, classes, member functions, and fields to document them. /** * Customer – a person or * organization */ C style Starts with /* and ends with */ Used to document out lines of code that are no longer applicable. It is helpful in debugging. /* This code was commented out by Ashish Sarin */ Single line Starts with // and go until the end of the line Used internally within member functions to document business logic, sections of code, and declarations of temporary variables. // If the amount is greater // than 10 multiply by 100 Friday,October4,2013 5 TOPSTechnologies-JavaTutorial
  • 6. 3. STANDARDS FOR MEMBER FUNCTIONS • 1 Naming member functions • Member functions should be named using a full English description, using mixed case with the first letter of any non- initial word capitalized. The first word of the member function should be a verb. • Examples • openAccount() • printMailingList() • save() • delete() • This results in member functions whose purpose can be determined just by looking at its name. Friday,October4,2013 6 TOPSTechnologies-JavaTutorial
  • 7. 3.1.1 NAMING ACCESSOR MEMBER FUNCTIONS • 3.1.1.1 Getters: member functions that return the value of a field / attribute / property of an object. • Use prefix “get” to the name of the field / attribute / property if the field in not boolean • Use prefix “is” to the name of the field / attribute / property if the field is Boolean • A viable alternative is to use the prefix ‘has’ or ‘can’ instead of ‘is’ for boolean getters. • Examples • getFirstName() • isPersistent() Friday,October4,2013 7 TOPSTechnologies-JavaTutorial
  • 8. • 3.1.1.2 Setters: member functions that modify the values of a field. • Use prefix ‘set’ to the name of the field. • Examples • setFirstName() • 3.1.1.3 Constructors: member functions that perform any necessary initialization when an object is created. Constructors are always given the same name as their class. • Examples • Customer() • SavingsAccount() Friday,October4,2013 8 TOPSTechnologies-JavaTutorial
  • 9. 3.2 MEMBER FUNCTION VISIBILITY • A good design requires minimum coupling between the classes. The general rule is to be as restrictive as possible when setting the visibility of a member function. If member function doesn’t have to be public then make it protected, and if it doesn’t have to be protected than make it private. Friday,October4,2013 9 TOPSTechnologies-JavaTutorial
  • 10. • Techniques for Writing Clean Code: • Document the code Already discussed above • Paragraph/Indent the code: Any code between the { and } should be properly indented • Paragraph and punctuate multi-line statements • Example • Line 1 BankAccount newPersonalAccount = AccountFactory • Line 2 createBankAccountFor(currentCustomer, startDate, • Line 3 initialDeposit, branch) • Lines 2 & 3 have been indented by one unit (horizontal tab) • Use white space • A few blank lines or spaces can help make the code more readable. • Single blank lines to separate logical groups of code, such as control structures • Two blank lines to separate member function definitions • Specify the order of Operations: Use extra parenthesis to increase the readability of the code using AND and OR comparisons. This facilitates in identifying the exact order of operations in the code • Write short, single command lines Code should do one operation per line So only one statement should be there per line Friday,October4,2013 10 TOPSTechnologies-JavaTutorial
  • 11. 6.0 STANDARDS FOR LOCAL VARIABLES • 6.1 Naming Local Variables • 6.1.1 Naming Streams • 6.1.2 Naming Loop Counters • 6.1.3 Naming Exception Objects • 6.2 Declaring and Documenting Local Variables • Note • Reusing local variables is more efficient because less memory needs to be allocated, but reusing local variables decreases the maintainability of code and makes it more fragile Friday,October4,2013 11 TOPSTechnologies-JavaTutorial
  • 12. 7.0 STANDARDS FOR PARAMETERS (ARGUMENTS) TO MEMBER FUNCTIONS  7.1 Naming Parameters  Parameters should be named following the exact same conventions as for local variable  7.2 Documenting Parameters  Parameters to a member function are documented in the header documentation for the member function using the javadoc @param tag. It should describe:  What it should be used for  Any restrictions or preconditions Friday,October4,2013 12 TOPSTechnologies-JavaTutorial
  • 13. • 8.0 Standards for Classes • 8.1 Class Visibility • Use package visibility for classes internal to a component • Use public visibility for the façade of components • 8.2 Naming classes • Use full English descriptor starting with the first letter capitalized using mixed case for the rest of the name • 8.3 Documenting a Class Friday,October4,2013 13 TOPSTechnologies-JavaTutorial [1] Java Coding Standards
  • 14. Packages The prefix of a unique package name 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 of the package name vary 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. com.sun.eng com.apple.quicktim e.v2 edu.cmu.cs.bovik.c heese Classes Class names 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 (unless the abbreviation is much more widely used than the long form, such as URL or HTML). class Raster; class ImageSprite; Friday,October4,2013 14 TOPSTechnologies-JavaTutorial
  • 15. Identifier Type Rules for Naming Examples Interfaces Interface names should be capitalized like class names. interface RasterDelegate; interface Storing; Methods Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized. run(); runFast(); getBackground(); Friday,October4,2013 15 TOPSTechnologies-JavaTutorial
  • 16. class constants are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Variable names 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. One- character variable names should be avoided except for temporary "throwaway" variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters. 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.) static final int MIN_WIDTH = 4; static final int MAX_WIDTH = 999; static final int GET_THE_CPU = 1; Friday,October4,2013 16 TOPSTechnologies-JavaTutorial
  • 17. AND MORE QUESTION ANSWER AND INTERVIEW TRAINING AND PRACTICE AT TOPS TECHNOLOGIES  BIO:  http://www.tops-int.com/  http://www.tops-int.com/java-training-course.html  Visit nearest center of your city  TOPS Technologies Mehsana  30, Rajendra estate, Opp. Gayatri temple, Highway, Mehsana. 76000 09613 Friday,October4,2013 17 TOPSTechnologies-JavaTutorial