<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://kb.devartsoftware.com/index.php?action=history&amp;feed=atom&amp;title=Coding_Standards</id>
	<title>Coding Standards - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://kb.devartsoftware.com/index.php?action=history&amp;feed=atom&amp;title=Coding_Standards"/>
	<link rel="alternate" type="text/html" href="https://kb.devartsoftware.com/index.php?title=Coding_Standards&amp;action=history"/>
	<updated>2026-12-06T17:26:15Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://kb.devartsoftware.com/index.php?title=Coding_Standards&amp;diff=5&amp;oldid=prev</id>
		<title>Daadmin: Created page with &quot;= DevArt Software Co. – Coding Standards &amp; Best Practices = &#039;&#039;Version 1.4 – 2023-07-25&lt;br&gt;Author: Pathum Bandara Premaratne&#039;&#039;  == 1. Introduction == Most programmers can write working code—but writing &#039;&#039;&#039;good code&#039;&#039;&#039; is an art. Characteristics of good code: * Reliable * Maintainable * Efficient   Efficiency matters, but not at the cost of reliability or maintainability.  == 2. Purpose == To produce reliable, maintainable applications, DevArtists must follow consist...&quot;</title>
		<link rel="alternate" type="text/html" href="https://kb.devartsoftware.com/index.php?title=Coding_Standards&amp;diff=5&amp;oldid=prev"/>
		<updated>2025-09-19T06:01:43Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;= DevArt Software Co. – Coding Standards &amp;amp; Best Practices = &amp;#039;&amp;#039;Version 1.4 – 2023-07-25&amp;lt;br&amp;gt;Author: Pathum Bandara Premaratne&amp;#039;&amp;#039;  == 1. Introduction == Most programmers can write working code—but writing &amp;#039;&amp;#039;&amp;#039;good code&amp;#039;&amp;#039;&amp;#039; is an art. Characteristics of good code: * Reliable * Maintainable * Efficient   Efficiency matters, but not at the cost of reliability or maintainability.  == 2. Purpose == To produce reliable, maintainable applications, DevArtists must follow consist...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= DevArt Software Co. – Coding Standards &amp;amp; Best Practices =&lt;br /&gt;
&amp;#039;&amp;#039;Version 1.4 – 2023-07-25&amp;lt;br&amp;gt;Author: Pathum Bandara Premaratne&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== 1. Introduction ==&lt;br /&gt;
Most programmers can write working code—but writing &amp;#039;&amp;#039;&amp;#039;good code&amp;#039;&amp;#039;&amp;#039; is an art. Characteristics of good code:&lt;br /&gt;
* Reliable&lt;br /&gt;
* Maintainable&lt;br /&gt;
* Efficient  &lt;br /&gt;
Efficiency matters, but not at the cost of reliability or maintainability.&lt;br /&gt;
&lt;br /&gt;
== 2. Purpose ==&lt;br /&gt;
To produce reliable, maintainable applications, DevArtists must follow consistent standards and best practices. These rules stem from experience and industry guidance.&lt;br /&gt;
&lt;br /&gt;
== 3. Naming Conventions ==&lt;br /&gt;
&lt;br /&gt;
=== Casing Rules ===&lt;br /&gt;
* PascalCase → `BackColor`, `HelloWorld`&lt;br /&gt;
* camelCase → `backColor`, `userName` *** DO NOT USE ***&lt;br /&gt;
&lt;br /&gt;
=== Standards ===&lt;br /&gt;
* Classes, methods, variables, and file names: PascalCase&lt;br /&gt;
* Interfaces: prefix with `I` → `IEntity`&lt;br /&gt;
* Avoid Hungarian Notation (e.g. `m_sName`, `nAge`)&lt;br /&gt;
* Member variables: prefix with underscore → `_Name`&lt;br /&gt;
* Use full words → `Address`, not `addr`&lt;br /&gt;
* Avoid single-letter variables except in tight loops&lt;br /&gt;
* UI Control Prefixes:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Prefix&lt;br /&gt;
|-&lt;br /&gt;
| Label || Lbl&lt;br /&gt;
|-&lt;br /&gt;
| TextBox || Txt&lt;br /&gt;
|-&lt;br /&gt;
| Button || Cmd&lt;br /&gt;
|-&lt;br /&gt;
| Grid || Grd&lt;br /&gt;
|-&lt;br /&gt;
| Checkbox || Chk&lt;br /&gt;
|-&lt;br /&gt;
| RadioButton || Rdo&lt;br /&gt;
|-&lt;br /&gt;
| Image || Img&lt;br /&gt;
|-&lt;br /&gt;
| Table || Tbl&lt;br /&gt;
|-&lt;br /&gt;
| Panel || Pnl&lt;br /&gt;
|-&lt;br /&gt;
| Hyperlink || Lnk&lt;br /&gt;
|-&lt;br /&gt;
| DropDownList || Drp&lt;br /&gt;
|-&lt;br /&gt;
| Validators || Val&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Namespace pattern: `DevArt.Product.Module.Submodule`&lt;br /&gt;
&lt;br /&gt;
== 4. Indentation and Spacing ==&lt;br /&gt;
* Use TABs (tab size = 4), no spaces&lt;br /&gt;
* Curly braces `{}` on separate lines&lt;br /&gt;
* One blank line between logical code blocks&lt;br /&gt;
* Comments aligned to code level&lt;br /&gt;
* Operators surrounded by spaces&lt;br /&gt;
 if (IsVisible == true)&lt;br /&gt;
  for (int Counter = 0; Counter &amp;lt; 10; Counter++)&lt;br /&gt;
&lt;br /&gt;
* Use `#region` for grouping code&lt;br /&gt;
* Private members top of file; public at bottom&lt;br /&gt;
&lt;br /&gt;
== 5. Programming Practices ==&lt;br /&gt;
* Method size: ideally ≤ 25 lines&lt;br /&gt;
* Method should do one job only&lt;br /&gt;
* Prefer descriptive method names&lt;br /&gt;
* Use `int`, `string`, `object` (not `Int32`, `String`)&lt;br /&gt;
* Always handle unexpected enum values:&lt;br /&gt;
 switch (MemberType)&lt;br /&gt;
 {&lt;br /&gt;
   case MemberTypes.Registered: ...&lt;br /&gt;
   case MemberTypes.Guest: ...&lt;br /&gt;
   default: throw new Exception(&amp;quot;Unexpected MemberType&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Avoid hardcoding – use constants or configs&lt;br /&gt;
* Use `String.Empty` instead of `&amp;quot;&amp;quot;`&lt;br /&gt;
* Prefer local variables to shared members&lt;br /&gt;
* Use enums for discrete states&lt;br /&gt;
* Don&amp;#039;t expose public fields – use properties&lt;br /&gt;
 private bool _IsFinished;&lt;br /&gt;
 public bool IsFinished =&amp;gt; _IsFinished;&lt;br /&gt;
&lt;br /&gt;
* Avoid logic in UI event handlers – delegate to methods&lt;br /&gt;
* Never hardcode paths – use relative, dynamic access&lt;br /&gt;
&lt;br /&gt;
== 6. Architecture ==&lt;br /&gt;
* Use layered architecture: UI → Business → DAL&lt;br /&gt;
* Never access DB directly in UI&lt;br /&gt;
* Catch and log DB errors in DAL, rethrow for handling&lt;br /&gt;
* Split solution into multiple assemblies when appropriate&lt;br /&gt;
&lt;br /&gt;
== 7. ASP.NET Guidelines ==&lt;br /&gt;
* Limit use of session variables – encapsulate access&lt;br /&gt;
* Do not store large objects in session&lt;br /&gt;
* Use CSS for all styling; never hardcode UI styles&lt;br /&gt;
&lt;br /&gt;
== 8. Commenting Standards ==&lt;br /&gt;
* Comment before logic, use `//` or `///`&lt;br /&gt;
* Don&amp;#039;t comment every line; code should be self-explanatory&lt;br /&gt;
* If logic is complex or non-obvious, comment generously&lt;br /&gt;
* Use proper spelling, grammar, punctuation&lt;br /&gt;
* Minimize comments if identifiers are meaningful&lt;br /&gt;
&lt;br /&gt;
== 9. Exception Handling ==&lt;br /&gt;
* Never catch exceptions silently&lt;br /&gt;
* Avoid generic `catch (Exception)` blocks&lt;br /&gt;
 try &lt;br /&gt;
 { &lt;br /&gt;
     ... &lt;br /&gt;
 }&lt;br /&gt;
 catch (FileIOException Ex) &lt;br /&gt;
 {&lt;br /&gt;
     Log(Ex);&lt;br /&gt;
     throw;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
* Preserve stack trace: use `throw;` not `throw Ex;`&lt;br /&gt;
* Use specific exception types (e.g. `SqlException`)&lt;br /&gt;
* Use separate try/catch blocks for distinct logic chunks&lt;br /&gt;
&lt;br /&gt;
== 10. Cascading Style Sheets (CSS) ==&lt;br /&gt;
&lt;br /&gt;
=== Formatting ===&lt;br /&gt;
* Use tabs, not spaces&lt;br /&gt;
* One rule per line, selectors on own lines&lt;br /&gt;
* Use lowercase hex → `#fff`&lt;br /&gt;
* Avoid over-qualified selectors: use `.container` not `div.container`&lt;br /&gt;
&lt;br /&gt;
=== Property Order ===&lt;br /&gt;
* Display → Position → Box Model → Typography → Other&lt;br /&gt;
* TRBL order: top, right, bottom, left&lt;br /&gt;
* Use vendor prefixes:&lt;br /&gt;
 .Box&lt;br /&gt;
 {&lt;br /&gt;
     -webkit-box-shadow: ...;&lt;br /&gt;
     -moz-box-shadow: ...;&lt;br /&gt;
     box-shadow: ...;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Font &amp;amp; Value Rules ===&lt;br /&gt;
* Use numeric font weights → `font-weight: 700;`&lt;br /&gt;
* Avoid units on zero → `margin: 0;`&lt;br /&gt;
* Line-height: unitless unless pixel-specific&lt;br /&gt;
&lt;br /&gt;
=== Media Queries ===&lt;br /&gt;
 @media screen and (max-width: 700px)&lt;br /&gt;
 {&lt;br /&gt;
     .Container&lt;br /&gt;
     {&lt;br /&gt;
        ...&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== 11. JavaScript Guidelines ==&lt;br /&gt;
&lt;br /&gt;
=== Formatting ===&lt;br /&gt;
* Use tabs, not spaces&lt;br /&gt;
* Always use braces `{}` for blocks&lt;br /&gt;
* End all statements with semicolons&lt;br /&gt;
* Prefer `const` or `let` over `var`&lt;br /&gt;
&lt;br /&gt;
=== Naming and Structure ===&lt;br /&gt;
* PascalCase for functions, files, variables&lt;br /&gt;
* Prefix member variables with `_`&lt;br /&gt;
* Avoid abbreviations and single-letter names&lt;br /&gt;
&lt;br /&gt;
=== Best Practices ===&lt;br /&gt;
* Use single quotes → `&amp;#039;Text&amp;#039;`&lt;br /&gt;
* Prefer array literals → `[]` over `new Array()`&lt;br /&gt;
* Avoid chained logic on one line&lt;br /&gt;
 if (IsValid)&lt;br /&gt;
 {&lt;br /&gt;
    DoSomething();&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Switch Statements ===&lt;br /&gt;
 switch (event.keyCode)&lt;br /&gt;
 {&lt;br /&gt;
     case 13:&lt;br /&gt;
        Submit();&lt;br /&gt;
        break;&lt;br /&gt;
  &lt;br /&gt;
     default:&lt;br /&gt;
        Cancel();&lt;br /&gt;
        break;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== Spacing &amp;amp; Multi-line Logic ===&lt;br /&gt;
* E.g.&lt;br /&gt;
 let HtmlString = `&amp;amp;lt;p&amp;amp;gt;` + Title +&lt;br /&gt;
                  ` and ` + Subtitle +&lt;br /&gt;
                  `&amp;amp;lt;/p&amp;amp;gt;`;&lt;br /&gt;
&lt;br /&gt;
=== Event Naming Convention ===&lt;br /&gt;
* Format: `Element_Action(Sender)`&lt;br /&gt;
 &amp;lt;a id=&amp;quot;LnkSubmit&amp;quot; onclick=&amp;quot;LnkSubmit_Click(this)&amp;quot;&amp;gt;Submit&amp;lt;/a&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Strict Comparison ===&lt;br /&gt;
* Use `===` &amp;amp; `==` mindfully. Use `===` if you want to check both the value and the type. Use `==` if you are checking only the value.&lt;br /&gt;
&lt;br /&gt;
=== Iteration ===&lt;br /&gt;
E.g.&lt;br /&gt;
 for (let Counter = 0, Limit = List.length; Counter &amp;lt; Length; Counter++)&lt;br /&gt;
 { &lt;br /&gt;
    ...&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== 12. SQL Standards ==&lt;br /&gt;
&lt;br /&gt;
=== Object Naming Conventions ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Type !! Example&lt;br /&gt;
|-&lt;br /&gt;
| Table || Users (Plural Entity Name)&lt;br /&gt;
|-&lt;br /&gt;
| View || UserLogins (Plural Purpose/Entity Name)&lt;br /&gt;
|-&lt;br /&gt;
| Stored Procedure || UserGet (EntityAction)&lt;br /&gt;
|-&lt;br /&gt;
| Function || CalculateAge (Operation/Action)&lt;br /&gt;
|-&lt;br /&gt;
| Trigger || OnUserSave (OnAction)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Keys and Indexes ===&lt;br /&gt;
* Primary Key: `PKUsers_Id`&lt;br /&gt;
* Foreign Key: `FKUsersEmails`&lt;br /&gt;
* Indexes: `IdxUsers_Email`&lt;br /&gt;
&lt;br /&gt;
=== Data Types ===&lt;br /&gt;
* Use `VARCHAR`, `INT`, `DECIMAL` where possible&lt;br /&gt;
* Avoid `MONEY`, use `DECIMAL(10,2)` for prices&lt;br /&gt;
&lt;br /&gt;
=== Queries ===&lt;br /&gt;
* Avoid `SELECT *`&lt;br /&gt;
* Always use explicit column lists&lt;br /&gt;
* Format with indentation&lt;br /&gt;
* Use `SET NOCOUNT ON` in SPs&lt;br /&gt;
&lt;br /&gt;
 SELECT     Id, Name&lt;br /&gt;
 FROM       Users&lt;br /&gt;
 WHERE      IsActive = 1&lt;br /&gt;
 ORDER BY   Name&lt;br /&gt;
&lt;br /&gt;
=== Best Practices ===&lt;br /&gt;
* Avoid CURSORs&lt;br /&gt;
* Use `MERGE`, `EXCEPT`, or `NOT EXISTS` over complex joins&lt;br /&gt;
* Never prefix SPs with `sp_` (reserved)&lt;br /&gt;
* Return empty collections rather than `NULL`&lt;br /&gt;
* Place `DECLARE` and `SET` at top of stored procedure&lt;br /&gt;
* Comment logic generously if complex&lt;/div&gt;</summary>
		<author><name>Daadmin</name></author>
	</entry>
</feed>