Standard Naming Conventions
The following conventions are being used for naming the Identifiers.
• Pascal casing (The first letter in the identifier and the first letter of each subsequent concatenated word should be capital).
Example: PascalCasing
• Camel casing (The first letter in the identifier is lower case and the first letter of each subsequent concatenated word should be capital).
Example: camelCasing
“c” = camelCase
“P” = PascalCase
“_” = Prefix with _Underscore
“x” = Not Applicable.
| Identifier | Public | Protected | Internal | Private | Example |
| Class or Struct | P | P | P | P | - |
| Interface | P | P | P | P | IInvoiceWorkflow [ Add "I" with prefix of interface ] |
| Method | P | P | P | P | IGetWorkflowDetails |
| Field | C | C | C | _C | Journal,_journal( Private variable declaration ) |
Coding Style for C Sharp
1. Never declare more than one Namespce per file.
2. Avoid putting multiple classes in a single file.
3. Always use curly braces for new statements and conditional statements.
4. Always use tab with indention “4”.
5. Segregate interface implementation by using #region statements.
6. Avoid multiple Main() methods in a single assembly.
7. Avoid interface for a single member.
8. Do not omit access modifiers. Explicitly declare all identifiers with the appropriate access modifier instead of allowing default.
9. Use a single space before and after each operator and brackets.
10. Method name should tell what it does. Do not use mis-leading names. If the method name is obvious, there is no need of documentation explaining what the method does.
Example:
Good:
void GetJournalName ()
{
// Save the phone number.
}
Not Good:
void GetData ()
{
// Save the phone number.
}
11. Use String.Empty instead of “”
If ( name == String.Empty )
{
// do something
}
Not Good:
If ( name == “” )
{
// do something
}
12. For sting comparison prepare for String.Compare() statement.
13. Avoid invoking methods within the conditional expression.
14. Avoid evaluating Boolean condition against true or false.
If ( isValid )
{
// do something
}
Not Good:
If ( isValid == true )
{
// do something
}
15. Always use validation avoids Exceptions.
16. Include comments using Task-List keyword flags to allow comment-filtering
// TODO: Place Database Code Here
// UNDONE: Removed P\Invoke Call due to errors
// HACK: Temporary fix until able to refactor
17. Exception Handling process,
- Do not use try/catch blocks for flow-control.
- Never declare empty catch block.
- Only use finally block to release resources from a try statement.
- Always use validation to avoid exception.
ASP.Net Standards
Naming Standard for Controls
| Control | Prefix | Example |
| Label | lbl | lblJournal |
| TextBox | txt | txtJournal |
| GridView | grd | grdJobcard |
| DataGrid | dg | dgReport |
| Button | btn | btnUpdate |
| ImageButton | ibtn | ibtnRecdate |
| Hyperlink | lnk | lnkHomePage |
| DropdownList | ddl | ddlVolume |
| ListBox | lst | lstArticle |
| DataList | dlst | dlstArticle |
| Checkbox/CheckBoxList | chk | chkAgeGroup |
| RadioButton/RadioButtonList | rdo | rdoSex |
| Iamge | img | imgLogo |
| Panel | pan | panSection |
| PlaceHolder | plh | plhHeader |
| Table | tbl | tblResults |
| All[Validators] | val | valIsbn |
| ValidationSummary | vals | valsErrors |
Application Architecture
- Develop application using Three-Tier Architecture.
- Three Architecture contains in the below design format,
- Presentation Layer.
- Business Logic Layer.
- Data Access Layer.