2. Naming Convention:
The name of each database object, Classes, variables or the functions should be meaningful and must represent what they are suppose to do. E.g. if the name of database table is ‘tblEmployee’, it means that the table contains information about the employees.
2.1: Programmatic naming conventions:
2.1.1: Variable names:
Standard Microsoft recommendation is being followed for the variable naming convention that is keeping the first alphabet of the name as capital. Below are some examples:
1. Dim Employee As String
2. Dim ContactInfo As Double
2.1.2: Control names:
Controls are the basic builders for any desktop based application or a web page that are commonly used during DOTNET development. Some of the commonly used controls are button, Checkbox, label, TextBox, ComboBox etc. Below are the naming conventions for controls:
| Control Name | Naming Convention |
| | |
| Checkbox | Cbx |
| ComboBox | Cmb |
| Button | Btn |
| RadioButton | Rbtn |
| Label | Lbl |
| TextBox | Tbox |
When using the controls for different events the names can be further simplified as per purpose such as below:
CbxMale, CmbCountryList, BtnConfirm, RbtnGender, LblName, TboxUsername
2.1.2: Function names:
The names of the functions are also set using the same format. I.e. keeping the first character capital and the name should depict the purpose of the function. In below example the name of the function is SendEmail where the first alphabet is capital and the name clearly states that the function is used to send emails.
Public Function SendEmail(ByVal Var1, ByVal Var2) As String
//Content…………
End Function
2.1.3: Name Spaces:
Below are the examples for Namespace naming convention.
SqlClient.SqlConnection
Xml.XmlEntity
2.1.4: Class name:
The class name also follows the same naming convention. E.g.
Public Class DbConnect
Public Class LoginPage
2.1.5: Commenting standard
It’s a good idea to write the Purpose of the function or general information in the Comments so that other team members can understand the purpose of the code. Below is the example for single line and block comment.
'''''This is a single line comment that explains''''''
/*
This
Is a block
comment
*/
2.2: Database naming conventions:
This section explains the naming convention used for the database objects. The names of the database objects should be meaningful and they follow
2.2.1. Database name:
The database names should accurately reflect the database content and function. Spaces are not used for the names and both upper and lower case letters can be used. Usually a name of the database is followed by the prefix that’s short name of the project or the company. Some examples are as below:
TbhEmployee, TelenorHrSystem
2.2.2. Database Table names:
The names of the tables must be meaningful and can have a prefix ‘tbl’ that differentiates them from views and stored procedures. E.g.
tblCustomers, tblAccounts, tblAttendance
2.2.3. Column names:
The column names must be self explanatory with first alphabet as capital. Such as EmployeeID,
The column names must be self explanatory with first alphabet as capital. Such as EmployeeID,
EmployeeName, EmployeeInterest.
2.2.4. Database views:
The views in the database start with a prefix ‘vu’. Eg: vuMonthlyReport, vuListofEmployees.
2.2.5. Database stored procedures:
The stored procedures also follow the same Convention with first alphabet as capital and have a prefix ‘sp’. Eg:
Sp_deleteinfo, sp_addinfo
2.2.6. Database trigger name:
The names of triggers indicate the type of triggers. The prefix is T and the next letter indicates the type of trigger such as insert (I), delete (D) or Update (U). e.g.
Ti_Orders (Insert order trigger)
Tu_Orders (update order trigger)
Td_Orders (delete order trigger)
0 comments:
Post a Comment