Académique Documents
Professionnel Documents
Culture Documents
Project:
Programming standards
Created by:
Date:
January, 2011
Approved by:
Gerardo Morn
Date:
March, 2011
Modify by:
Date:
February, 2013
Approved by:
Gerardo Morn
Date:
April, 2013
Version:
V3
Date:
April, 2013
INDEX
1.Introduction.............................................................................................................................. 3
2.Definition.................................................................................................................................. 3
3.Capitalization styles.................................................................................................................. 3
Pascal case............................................................................................................................... 3
Camel case............................................................................................................................... 3
Uppercase................................................................................................................................ 3
4.Programming standards definition............................................................................................ 4
5.Ndeveloper Standards.............................................................................................................. 7
Namespace............................................................................................................................... 7
Reference.................................................................................................................................... 7
1. INTRODUCTION
The purpose of this document is to describe the programming standards to be used for
developing applications using the programming languages C # and Visual Basic. Net
accordance with good development practices and conventions in force in the industry.
2. DEFINITION
These conventions are industry accepted to develop C # and VB.NET software. While different
naming conventions in organizations may vary, the list below is becoming the de facto
standard in the industry. Please consider the absence of Hungarian notation. These naming
rules are suggested to be applied in all developments .NET, including ASP.NET web
applications, WPF, Silverlight and Windows Forms applications.
All the standards listed below are considered among the best programming practices, because
this convention is consistent with the standards of the Framework. Net and is easy to read.
3. CAPITALIZATION STYLES
PASCAL
CASE
The first letter of identifier and the first letter of the words concatenated must be uppercase.
The capitalization style PASCAL can be used in identifiers of three or more characters.
For example: BackColor
CAMEL
CASE
The first letter of an identifier is lowercase and the first letter of each subsequent concatenated
word is capitalized.
For example: backColor
UPPERCASE
All letters in the identifier are capitalized. Applicable only for identifiers that are formed by two
or fewer letters.
For example: System.IO, System.Web.UI
STANDARD- CONVENTION
EXAMPLE
Namespaces
AppliedIS.TimeCard.BusinessRules
IrritatedVowel.Controllers
PeteBrown.DotNetTraining.InheritanceDemo
PeteBrown.DotNetTraining.Xml
PeteBrown.DotNetTraining.InheritanceDemo
PeteBrown.DotNetTraining.Xml
Assemblies
Classes /
Structs
Widget
InstanceManager
XmlDocument
MainForm
DocumentForm
HeaderControl
CustomerListDataSet (typed dataset)
Collection
Classes
Delegate
Classes
Follow
class
naming
conventions, but add Delegate WidgetCallbackDelegate
to the end of the name
Exception
Classes
Follow
class
naming
conventions,
but
add InvalidTransactionException
Exception to the end of the
name
Attribute
Classes
Follow
class
naming
conventions, but add Attribute WebServiceAttribute
to the end of the name
Interfaces
Follow
class
naming
conventions, but start the
name with "I" and capitalize
the letter following the "I"iar el
nombre con la letra "I".
It also distinguishes classes
from interfaces, where (unlike IWidget
in VB6) are truly different
beings.
This
avoid
name
collisions as well, as it is quite
common to have IFoo and a
class
named
Foo
that
implements IFoo.
Enumerations
Follow
class
naming
conventions. Do not add
"Enum" to the end of the SearchOptions (bitwise flags)
enumeration name. If the AcceptRejectRule (normal enum)
enumeration represents a set
of bitwise flags, end the name
with a plural.
Functions /
Subs
WidgetCollection
Properties
Public/Membe
r Variables
Parameters
ProcedureLevel
Variables
Camel Case
VB: Dim recordId As Integer
It also avoids naming collisions
with class-level variables (see C#: int recordId ;
below)
Class-Level
Variables
Controls
Forms
Constants
Camel Case.
The first three consonants
correspond to the control
name followed by the name
on that identifies it.
If there is not a defined
nomenclature for a particular
control, their statement should
be agreed in the working
group.
btnAceptar (Button)
txtUsuario (TextBox)
lblNombre (Label)
sqaConexion (SQL Adapter)
5. NDEVELOPER STANDARDS
NAMESPACE.
These are the standards agreed with nDeveloper development team for namespaces /
assemblies of the projects naming in a solution. Besides structuring solutions under logical
folders.
LAYER
Data Access
Business Logic
User interface
Test
Windows
Comunication
Foundation
Data Contract del WCF
NAME
DA
BL
UI
Test
WCF
ASSEMBLY
<NombreSolucion>.DA
<NombreSolucion>.BL
<NombreSolucion>.UI
<NombreSolucion>.Test
<NombreSolucion>.WCF
WCF.Data
Web services
Windows services
Comun (cross layers)
WEBS
WINS
Comun
<NombreSolucion>.WCF.Dat
a
<NombreSolucion>.WEBS
<NombreSolucion>.WINS
<NombreSolucion>.Comun
REFERENCE
-
C# Programming Guide
http://msdn.microsoft.com/en-us/library/vstudio/67ef8sbd%28v=vs.100%29.aspx