SlideShare ist ein Scribd-Unternehmen logo
1 von 6
NAMING CONVENTION AND
COMMENTINGSTYLE FOR
CHRYSLERGFXCOMMUNICATION
APPLICATION
NAMING CONVENTION &COMMENT STYLE
JABED HOSSAIN, JUNIORBUSSINESSSYSTEMANALYST
GROUND EFFECTS LTD.
2775 St. Etienne Blvd
Windsor,Ontario.
NOVEMBER 29, 2016
1 | P a g e
Table of Contents
Background and Overview _____________________________________2
Commenting ________________________________________________2
Class Comments ______________________________________3
Inline Comments _____________________________________3
Function Comments __________________________________4
Standardized Comment Hinting ________________________________4
Variable Names, Capitalizations and Convention __________________4
FileNames _________________________________________________5
Bibliography _______________________________________________5
2 | P a g e
Background and Overview
Thisdocumentgrewoutof increasedfrustrationwhile conductingreverseengineeringonaprojectwhich
was examinedtofindsystemglitch. Asthe choicesof wordsare different fromdeveloperstodevelopers
to express singular or specific meaning, it is really crucial for developers to choose a particular naming
convention and coding style while developing applications. This document is built on the naming and
coding standard, the author followed while reverse engineering an outmoded application and re-
developing it with a new standard.
The document is broken down by subject matter to facilitate scanning [1]. The motivation of this
documentisto create a framework thatis usable forC# and C++ developmentatGround Effects Ltd and
may be extended to include other forms of development. The most important part of any code or style
documentshouldbe consistency,notthe minutiaof how toplacebrackets,semi-colonsormethodnames
[1]. This document is not going to discuss strength of particular development environment.
Commenting:
A nightmare for any developer, if the developer finds out a scratchy coding practice from their
predecessor on any project,the new developer is supposed to work with. C# has its own syntax specific
partsto define acommentblocksuchas /*-- --*/inC#andC++. Code commentscanbe brokendowninto
three primary types each with specific roles in the application [1]. They are as followings:
 Class Comments
 Inline Comments
 Function Comments
The ClassComments provideacontexttounderstandthefilethatthe developerisgoingtoworkon. Inline
comments provide context about the code right where the developer needs it. Lastly, Function
Commenting,providesnotonlybackgroundonaparticularmethod,butalsocreatesanice frameworkof
documentation for future reuse of the code [1].
Class Comments:
Thisis perhapsthe quickesttoimplementsince itcanbe addedto a defaultdocumenttemplateeasilyin
most authoring environments and provides much of the detail a later developer will need when this
document is opened years later, which exactly the author has faced [1]. Below the structure for Class
Commenting is described thoroughly:
/****
Title: This class builds database connection string
Project: ChryslerGFXCommunication
Author: Jabed Hossain
Description: This page uses .settings file to save database information. Mainly
settings file is used to create and access values that are persisted between application
execution session.
Created: November 28, 2016
Revision History:
November 29, 2016: Jabed Hossain -> Created f_setDBConnection ()
function to work with dbtype.
****/
3 | P a g e
Some additionalinformationyoucanuse inside the titleblockcommentmayincludelicensinginformation
also copyrightnoticesthat are necessaryto put. While developingasystemwe mightneedto use some
librarieswhichisdevelopedbysome thirdparty.Givinganabstract descriptionof those librariescanalso
be a good choice. There cannotbe reallyachoice of how the commentingblockwillbe structured.Inthis
scenario, the author implemented class commenting like above.
Warning: If the Class/Page Comments are in a true HTML, XML or JavaScript document, it is exposed to
anyone whocaresto lookatthe source for itand thiscouldcompromise yoursitessecurity.Soitisawise
decision to add comments within the application language instead of text that is served to users. [1]
Inline Comments:
Asnamingvariablesdiffersbetweendevelopers,codingstylebetweendevelopersmightdifferfromeach
other as well. From initialization of variables, using constructors to choosing between implementing
interfaces or implementing base/child class concepts, developers might choose to implement different
coding styles to accomplish the same goal. These are the reason, inline commenting is one of the most
importantaspectsof cleancoding.There isparticularreasonfora programmertothinkthat his/hercode
can be understood by each and every other developer. Though, achieving the expertise of being
understoodbyeveryotherdevelopershouldbe inthe listtobe acquired. Inlinecommentingisoftenthe
most common and most underused commenting since it provides help around particular processes or
piece of code that might be confusing later. It depends on the programmer how to implementinline
commenting. Some developerchoosestocommentontop of the line andsome choosesto commenton
the side. Although inline commenting shouldn’t be descriptive. It should be abstractive as much as
possible. The author used inline commenting like the following:
Statement ….. // f_setDBConnection() -> database_connection.cs
Commenting at the right side of the statement is more untestable as it is continuous and easy to read.
Abstractionatinline commentingismore logicalasfunctioncommentingandalsoclasscommentingisbit
descriptive.Sotoavoidredundancyof wordsitshouldbe awise choice touse abstractive approachwhile
inline commenting.
Function Comments:
Similarinpractice toClass/Page Commenting,FunctionCommentingcanprovide aquickoverview of what
a particularmethoddoes [1].The followingexample showshow touse FunctionCommentingtodiscern
what the part of the code does without digging into the code.
/*
Summary: Reads dbType to create connectionString.
Parameters: Nothing
Return: Nothing
*/
public void f_setDBConnection()
{
switch(v_dbType)
{
case "MySQL":
v_connectionString = "Server=" + v_dbSource + "; Port=9901; Database=" +
v_dbName + "; Uid=" + v_userName + "; Pwd=" + v_password + ";";
break;
}
4 | P a g e
Standardized Comment Hinting [1]:
Using some common text in capital letters can help to identify certain pieces of contents within the
comments used inside any applicationwhich can be useful for someone reading or reverse engineering
your code. In addition to the revision history at the top of the document, these can help call out other
items inline.
1. HACK: Acknowledges where inelegant code was used as a work around some other problem.
2. BUG: Identifies the location of problematic piece of code.
3. TODO: Denotes unfinished piece of work.
4. FIX: Marks where something was corrected. Often the bug # would be included in this line.
Variable Names, Capitalizations and Convention:
There are quite a lot methods of notation for naming variables, functions and classes for any
application. Microsoft has provided guidance to developers working with Microsoft technologies
through a naming conventions document in MSDN library [1]. Similarly, Sun Microsystem has
provided the developers using Java with naming conventions. Below, some of the popular naming
conventions are listed:
1. Camel (or Camelback) [myVariableName]
a. First Letter Lowercase with each subsequent words first letter capitalized.
b. Standard method for Java variables.
2. Pascal [MyVariableName]
a. Each words first letter is capitalized, including the first word.
b. Standard method for .NET variables.
3. Underscore
a. Using underscore character like space [MY_Variable_Name]
b. Special cases using underscore as first value to protect namespace [_variable]
Regardless of the style chosen, it is most important for the variable to describe what it means
above all. The author used Camel font as the author was developing the system with C#. But the
author modified the Camel font for the application that was developed in Ground Effects.
Variable was declared in the following manner,
string v_appName;
Putting the character ‘v’ in front of a variable helps other developers who might need to find the
variable which was used inside the project. Also sometimes variable names has unavoidable
similarities with functions, methods and objects. To avoid this the author practiced this exact way
which will provide any developer with a better insight of the code. Similar with the declaration
process of variables, the author also declared functions, methods and also objects with a ‘f’, ‘m’
and ‘a’ character in front of them. These are as follows:
 o_logMsg (for Object)
 m_logFile (for methods)
 f_buildLogMsg (for functions)
5 | P a g e
FileNames
The author used lowercase string to name files in the application. Filenames should always
describe the contents, contained within them for clarity for developers [1]. As we know filename
length limits have all been lifted out from modern operating system, it is no longer necessary to
use cryptic naming conventions. The author used the following strategy to name files inside the
application:
“log-messages.cs”
The strength to this approach is that the file can be read quite clearly without opening it top
verify its contents. In modern c#, hyphen is converted to underscore inside the class declaration
so it’s easierto read. The C# compiler indexes the above filename as ‘log_messages’(class)which
is much better than ‘logmessages’.
Bibliography
1. Web Development Naming Conventions (AF Design). Erik Giberti. September 2008.

Weitere ähnliche Inhalte

Was ist angesagt?

C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse studentsAbdur Rahim
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentMitosis Technology
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer muniryaseen
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit orderMalikireddy Bramhananda Reddy
 
Basic construction of c
Basic construction of cBasic construction of c
Basic construction of ckinish kumar
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...NicheTech Com. Solutions Pvt. Ltd.
 
C programming language Reference Note
C programming language Reference NoteC programming language Reference Note
C programming language Reference NoteChetan Thapa Magar
 
Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02thinesonsing
 
Android coding guide lines
Android coding guide linesAndroid coding guide lines
Android coding guide lineslokeshG38
 
Chapter 13.1.11
Chapter 13.1.11Chapter 13.1.11
Chapter 13.1.11patcha535
 

Was ist angesagt? (20)

C tutorials
C tutorialsC tutorials
C tutorials
 
C# Unit5 Notes
C# Unit5 NotesC# Unit5 Notes
C# Unit5 Notes
 
Overview of c#
Overview of c#Overview of c#
Overview of c#
 
C programming languag for cse students
C programming languag for cse studentsC programming languag for cse students
C programming languag for cse students
 
Chap02
Chap02Chap02
Chap02
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software development
 
over all view programming to computer
over all view programming to computer over all view programming to computer
over all view programming to computer
 
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
C notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit orderC notes by m v b  reddy(gitam)imp  notes  all units notes  5 unit order
C notes by m v b reddy(gitam)imp notes all units notes 5 unit order
 
3.2
3.23.2
3.2
 
Lecture 1 progrmming with C
Lecture 1 progrmming with C Lecture 1 progrmming with C
Lecture 1 progrmming with C
 
C# Unit 2 notes
C# Unit 2 notesC# Unit 2 notes
C# Unit 2 notes
 
Basic construction of c
Basic construction of cBasic construction of c
Basic construction of c
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 
C LANGUAGE NOTES
C LANGUAGE NOTESC LANGUAGE NOTES
C LANGUAGE NOTES
 
Word processing
Word processingWord processing
Word processing
 
C programming language Reference Note
C programming language Reference NoteC programming language Reference Note
C programming language Reference Note
 
Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02Fundamentalsofprogrammingfinal 121011003536-phpapp02
Fundamentalsofprogrammingfinal 121011003536-phpapp02
 
Android coding guide lines
Android coding guide linesAndroid coding guide lines
Android coding guide lines
 
Introduction to ‘C’ Language
Introduction to ‘C’ LanguageIntroduction to ‘C’ Language
Introduction to ‘C’ Language
 
Chapter 13.1.11
Chapter 13.1.11Chapter 13.1.11
Chapter 13.1.11
 

Andere mochten auch

Public Lecture Hong Kong University, 18 November 2015
Public Lecture Hong Kong University, 18 November 2015Public Lecture Hong Kong University, 18 November 2015
Public Lecture Hong Kong University, 18 November 2015Christian Bokhove
 
Kronologis ny. kasiani
Kronologis ny. kasianiKronologis ny. kasiani
Kronologis ny. kasianiPebri Pulungan
 
Фаберлик. Новинки и акции каталога 10-2014, с 14 июля.
Фаберлик. Новинки и акции каталога 10-2014, с 14 июля.Фаберлик. Новинки и акции каталога 10-2014, с 14 июля.
Фаберлик. Новинки и акции каталога 10-2014, с 14 июля.Natalia Antonova
 
Isolation of Yeasts from Raisins and Palm-Juice and Ethanol Production in Mol...
Isolation of Yeasts from Raisins and Palm-Juice and Ethanol Production in Mol...Isolation of Yeasts from Raisins and Palm-Juice and Ethanol Production in Mol...
Isolation of Yeasts from Raisins and Palm-Juice and Ethanol Production in Mol...Shafkat Shamim Rahman
 
"Цены в отпуске" 11 каталог 2016 г
"Цены в отпуске" 11 каталог 2016 г"Цены в отпуске" 11 каталог 2016 г
"Цены в отпуске" 11 каталог 2016 гНелли Щербина
 
Trabajo francés 5º curso
Trabajo francés   5º cursoTrabajo francés   5º curso
Trabajo francés 5º cursojlealleon
 
Ethanol Production India
Ethanol Production IndiaEthanol Production India
Ethanol Production IndiaRavi Vishnu
 
3M: An Owner's Manual for Investors
3M: An Owner's Manual for Investors3M: An Owner's Manual for Investors
3M: An Owner's Manual for InvestorsOneMarlandRoad
 

Andere mochten auch (13)

LucasLinPresentation
LucasLinPresentationLucasLinPresentation
LucasLinPresentation
 
Public Lecture Hong Kong University, 18 November 2015
Public Lecture Hong Kong University, 18 November 2015Public Lecture Hong Kong University, 18 November 2015
Public Lecture Hong Kong University, 18 November 2015
 
Kronologis ny. kasiani
Kronologis ny. kasianiKronologis ny. kasiani
Kronologis ny. kasiani
 
My work ethics
My work ethicsMy work ethics
My work ethics
 
Фаберлик. Новинки и акции каталога 10-2014, с 14 июля.
Фаберлик. Новинки и акции каталога 10-2014, с 14 июля.Фаберлик. Новинки и акции каталога 10-2014, с 14 июля.
Фаберлик. Новинки и акции каталога 10-2014, с 14 июля.
 
Ivan santiago vega
Ivan santiago vegaIvan santiago vega
Ivan santiago vega
 
Isolation of Yeasts from Raisins and Palm-Juice and Ethanol Production in Mol...
Isolation of Yeasts from Raisins and Palm-Juice and Ethanol Production in Mol...Isolation of Yeasts from Raisins and Palm-Juice and Ethanol Production in Mol...
Isolation of Yeasts from Raisins and Palm-Juice and Ethanol Production in Mol...
 
Mental Rotation Skills
Mental Rotation SkillsMental Rotation Skills
Mental Rotation Skills
 
"Цены в отпуске" 11 каталог 2016 г
"Цены в отпуске" 11 каталог 2016 г"Цены в отпуске" 11 каталог 2016 г
"Цены в отпуске" 11 каталог 2016 г
 
Ordenar y dar una instrucción
Ordenar y dar una instrucciónOrdenar y dar una instrucción
Ordenar y dar una instrucción
 
Trabajo francés 5º curso
Trabajo francés   5º cursoTrabajo francés   5º curso
Trabajo francés 5º curso
 
Ethanol Production India
Ethanol Production IndiaEthanol Production India
Ethanol Production India
 
3M: An Owner's Manual for Investors
3M: An Owner's Manual for Investors3M: An Owner's Manual for Investors
3M: An Owner's Manual for Investors
 

Ähnlich wie NamingConvention

Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptxChapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptxrajinevitable05
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net FundamentalsLiquidHub
 
A Case Study Of A Reusable Component Collection
A Case Study Of A Reusable Component CollectionA Case Study Of A Reusable Component Collection
A Case Study Of A Reusable Component CollectionJennifer Strong
 
Best practices in enterprise applications
Best practices in enterprise applicationsBest practices in enterprise applications
Best practices in enterprise applicationsChandra Sekhar Saripaka
 
Poject documentation deepak
Poject documentation deepakPoject documentation deepak
Poject documentation deepakchetankane
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementationghayour abbas
 
9. Software Implementation
9. Software Implementation9. Software Implementation
9. Software Implementationghayour abbas
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxMalla Reddy University
 
Coding standards
Coding standardsCoding standards
Coding standardsMimoh Ojha
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Robin O'Brien
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure rupeshchanchal
 
Compiler Design Using Context-Free Grammar
Compiler Design Using Context-Free GrammarCompiler Design Using Context-Free Grammar
Compiler Design Using Context-Free GrammarIRJET Journal
 
Performance tesing coding standards & best practice guidelines v1
Performance tesing coding standards & best practice guidelines v1Performance tesing coding standards & best practice guidelines v1
Performance tesing coding standards & best practice guidelines v1Argos
 
Standards For Java Coding
Standards For Java CodingStandards For Java Coding
Standards For Java CodingRahul Bhutkar
 
76829060 java-coding-conventions
76829060 java-coding-conventions76829060 java-coding-conventions
76829060 java-coding-conventionsslavicp
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Luis Valencia
 

Ähnlich wie NamingConvention (20)

Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptxChapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
Chapter vvxxxxxxxxxxx1 - Part 1 (3).pptx
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
 
Abcxyz
AbcxyzAbcxyz
Abcxyz
 
A Case Study Of A Reusable Component Collection
A Case Study Of A Reusable Component CollectionA Case Study Of A Reusable Component Collection
A Case Study Of A Reusable Component Collection
 
Best practices in enterprise applications
Best practices in enterprise applicationsBest practices in enterprise applications
Best practices in enterprise applications
 
Why Drupal is Rockstar?
Why Drupal is Rockstar?Why Drupal is Rockstar?
Why Drupal is Rockstar?
 
Poject documentation deepak
Poject documentation deepakPoject documentation deepak
Poject documentation deepak
 
Design patterns
Design patternsDesign patterns
Design patterns
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementation
 
9. Software Implementation
9. Software Implementation9. Software Implementation
9. Software Implementation
 
Coding
CodingCoding
Coding
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
Coding standards
Coding standardsCoding standards
Coding standards
 
Introduction to Behavior Driven Development
Introduction to Behavior Driven Development Introduction to Behavior Driven Development
Introduction to Behavior Driven Development
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
 
Compiler Design Using Context-Free Grammar
Compiler Design Using Context-Free GrammarCompiler Design Using Context-Free Grammar
Compiler Design Using Context-Free Grammar
 
Performance tesing coding standards & best practice guidelines v1
Performance tesing coding standards & best practice guidelines v1Performance tesing coding standards & best practice guidelines v1
Performance tesing coding standards & best practice guidelines v1
 
Standards For Java Coding
Standards For Java CodingStandards For Java Coding
Standards For Java Coding
 
76829060 java-coding-conventions
76829060 java-coding-conventions76829060 java-coding-conventions
76829060 java-coding-conventions
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 

NamingConvention

  • 1. NAMING CONVENTION AND COMMENTINGSTYLE FOR CHRYSLERGFXCOMMUNICATION APPLICATION NAMING CONVENTION &COMMENT STYLE JABED HOSSAIN, JUNIORBUSSINESSSYSTEMANALYST GROUND EFFECTS LTD. 2775 St. Etienne Blvd Windsor,Ontario. NOVEMBER 29, 2016
  • 2. 1 | P a g e Table of Contents Background and Overview _____________________________________2 Commenting ________________________________________________2 Class Comments ______________________________________3 Inline Comments _____________________________________3 Function Comments __________________________________4 Standardized Comment Hinting ________________________________4 Variable Names, Capitalizations and Convention __________________4 FileNames _________________________________________________5 Bibliography _______________________________________________5
  • 3. 2 | P a g e Background and Overview Thisdocumentgrewoutof increasedfrustrationwhile conductingreverseengineeringonaprojectwhich was examinedtofindsystemglitch. Asthe choicesof wordsare different fromdeveloperstodevelopers to express singular or specific meaning, it is really crucial for developers to choose a particular naming convention and coding style while developing applications. This document is built on the naming and coding standard, the author followed while reverse engineering an outmoded application and re- developing it with a new standard. The document is broken down by subject matter to facilitate scanning [1]. The motivation of this documentisto create a framework thatis usable forC# and C++ developmentatGround Effects Ltd and may be extended to include other forms of development. The most important part of any code or style documentshouldbe consistency,notthe minutiaof how toplacebrackets,semi-colonsormethodnames [1]. This document is not going to discuss strength of particular development environment. Commenting: A nightmare for any developer, if the developer finds out a scratchy coding practice from their predecessor on any project,the new developer is supposed to work with. C# has its own syntax specific partsto define acommentblocksuchas /*-- --*/inC#andC++. Code commentscanbe brokendowninto three primary types each with specific roles in the application [1]. They are as followings:  Class Comments  Inline Comments  Function Comments The ClassComments provideacontexttounderstandthefilethatthe developerisgoingtoworkon. Inline comments provide context about the code right where the developer needs it. Lastly, Function Commenting,providesnotonlybackgroundonaparticularmethod,butalsocreatesanice frameworkof documentation for future reuse of the code [1]. Class Comments: Thisis perhapsthe quickesttoimplementsince itcanbe addedto a defaultdocumenttemplateeasilyin most authoring environments and provides much of the detail a later developer will need when this document is opened years later, which exactly the author has faced [1]. Below the structure for Class Commenting is described thoroughly: /**** Title: This class builds database connection string Project: ChryslerGFXCommunication Author: Jabed Hossain Description: This page uses .settings file to save database information. Mainly settings file is used to create and access values that are persisted between application execution session. Created: November 28, 2016 Revision History: November 29, 2016: Jabed Hossain -> Created f_setDBConnection () function to work with dbtype. ****/
  • 4. 3 | P a g e Some additionalinformationyoucanuse inside the titleblockcommentmayincludelicensinginformation also copyrightnoticesthat are necessaryto put. While developingasystemwe mightneedto use some librarieswhichisdevelopedbysome thirdparty.Givinganabstract descriptionof those librariescanalso be a good choice. There cannotbe reallyachoice of how the commentingblockwillbe structured.Inthis scenario, the author implemented class commenting like above. Warning: If the Class/Page Comments are in a true HTML, XML or JavaScript document, it is exposed to anyone whocaresto lookatthe source for itand thiscouldcompromise yoursitessecurity.Soitisawise decision to add comments within the application language instead of text that is served to users. [1] Inline Comments: Asnamingvariablesdiffersbetweendevelopers,codingstylebetweendevelopersmightdifferfromeach other as well. From initialization of variables, using constructors to choosing between implementing interfaces or implementing base/child class concepts, developers might choose to implement different coding styles to accomplish the same goal. These are the reason, inline commenting is one of the most importantaspectsof cleancoding.There isparticularreasonfora programmertothinkthat his/hercode can be understood by each and every other developer. Though, achieving the expertise of being understoodbyeveryotherdevelopershouldbe inthe listtobe acquired. Inlinecommentingisoftenthe most common and most underused commenting since it provides help around particular processes or piece of code that might be confusing later. It depends on the programmer how to implementinline commenting. Some developerchoosestocommentontop of the line andsome choosesto commenton the side. Although inline commenting shouldn’t be descriptive. It should be abstractive as much as possible. The author used inline commenting like the following: Statement ….. // f_setDBConnection() -> database_connection.cs Commenting at the right side of the statement is more untestable as it is continuous and easy to read. Abstractionatinline commentingismore logicalasfunctioncommentingandalsoclasscommentingisbit descriptive.Sotoavoidredundancyof wordsitshouldbe awise choice touse abstractive approachwhile inline commenting. Function Comments: Similarinpractice toClass/Page Commenting,FunctionCommentingcanprovide aquickoverview of what a particularmethoddoes [1].The followingexample showshow touse FunctionCommentingtodiscern what the part of the code does without digging into the code. /* Summary: Reads dbType to create connectionString. Parameters: Nothing Return: Nothing */ public void f_setDBConnection() { switch(v_dbType) { case "MySQL": v_connectionString = "Server=" + v_dbSource + "; Port=9901; Database=" + v_dbName + "; Uid=" + v_userName + "; Pwd=" + v_password + ";"; break; }
  • 5. 4 | P a g e Standardized Comment Hinting [1]: Using some common text in capital letters can help to identify certain pieces of contents within the comments used inside any applicationwhich can be useful for someone reading or reverse engineering your code. In addition to the revision history at the top of the document, these can help call out other items inline. 1. HACK: Acknowledges where inelegant code was used as a work around some other problem. 2. BUG: Identifies the location of problematic piece of code. 3. TODO: Denotes unfinished piece of work. 4. FIX: Marks where something was corrected. Often the bug # would be included in this line. Variable Names, Capitalizations and Convention: There are quite a lot methods of notation for naming variables, functions and classes for any application. Microsoft has provided guidance to developers working with Microsoft technologies through a naming conventions document in MSDN library [1]. Similarly, Sun Microsystem has provided the developers using Java with naming conventions. Below, some of the popular naming conventions are listed: 1. Camel (or Camelback) [myVariableName] a. First Letter Lowercase with each subsequent words first letter capitalized. b. Standard method for Java variables. 2. Pascal [MyVariableName] a. Each words first letter is capitalized, including the first word. b. Standard method for .NET variables. 3. Underscore a. Using underscore character like space [MY_Variable_Name] b. Special cases using underscore as first value to protect namespace [_variable] Regardless of the style chosen, it is most important for the variable to describe what it means above all. The author used Camel font as the author was developing the system with C#. But the author modified the Camel font for the application that was developed in Ground Effects. Variable was declared in the following manner, string v_appName; Putting the character ‘v’ in front of a variable helps other developers who might need to find the variable which was used inside the project. Also sometimes variable names has unavoidable similarities with functions, methods and objects. To avoid this the author practiced this exact way which will provide any developer with a better insight of the code. Similar with the declaration process of variables, the author also declared functions, methods and also objects with a ‘f’, ‘m’ and ‘a’ character in front of them. These are as follows:  o_logMsg (for Object)  m_logFile (for methods)  f_buildLogMsg (for functions)
  • 6. 5 | P a g e FileNames The author used lowercase string to name files in the application. Filenames should always describe the contents, contained within them for clarity for developers [1]. As we know filename length limits have all been lifted out from modern operating system, it is no longer necessary to use cryptic naming conventions. The author used the following strategy to name files inside the application: “log-messages.cs” The strength to this approach is that the file can be read quite clearly without opening it top verify its contents. In modern c#, hyphen is converted to underscore inside the class declaration so it’s easierto read. The C# compiler indexes the above filename as ‘log_messages’(class)which is much better than ‘logmessages’. Bibliography 1. Web Development Naming Conventions (AF Design). Erik Giberti. September 2008.