Department of Education and Early Childhood Development (DEECD)
Application Development
Application Standards
Enterprise Library Application Blocks
Application Unit Testing

General Coding Standards

Layout and Style

No. Standard Source
1. Code layout and style are used consistently within the same file 2
2. Indentation is accurately and consistently used to show the logical structure of the code 1
3. Long continuous code lines are split and indented one level under the first line of the statement 2
4. Only one declaration or statement per line 3
5. Each code file contains types for a single namespace only 1
6. Whitespace is used consistently to improve readability of code 1
7. Each file contains a single public or internal class, interface, enumeration, or other type 2
8. Boolean conditions are not explicitly evaluated against true or false 3
9. Code elements are not aligned vertically to columns or tab stops (other than for normal indentation) 3

Back to top

Naming

No. Standard Source
10. Correct casing is used for all identifiers 1
11. Filename matches the name of the contained public or internal class, interface, enumeration, or other type 2
12. Hungarian Notation is not used for code variables and constants 2
13. Methods and properties do not expose implementation details but rather explain their intent 3
14. Standard naming scheme is used for all code constructs 3
15. Code folder structure corresponds to the namespace used within the source file 1

Back to top

Comments

No. Standard Source
16. Each user-defined data type has a description of its purpose 1
17. Each method/property has a description of its purpose, parameters, returned values, and error conditions 1
18. End-line comments should not to be used, except for declarations 3
19. Comments are structured as sentences with proper grammar and punctuation and without spelling mistakes 2
20. Commented-out code is removed from source code files 2

Back to top

Application Design

No. Standard Source
21. Global variables are not used 3
22. Namespaces are used to organise related types 1
23. Enumerated types are used over a fixed set of constant values for method parameters and return types 3
24. Constants or enumerations are used instead of literal values or "magic numbers" 1
25. Application settings that can change on deployment are not hardcoded - they are stored in a configuration file 1
26. Gotos and labels are not used (where applicable) 2
27. Class member variables are initialised in constructors, not where they are declared 3
28. Polymorphism is used to handle sub-types of a class rather than case/switch/if statements 3

Back to top

User-defined Data Types

No. Standard Source
29. Class members variables are not directly accessible by client code 1
30. References to internal class members are not returned from class methods and properties 2

Back to top

Error Handling

No. Standard Source
31. Structured exception handling is used instead of return codes for managing application errors 1
32. Unhandled exceptions are correctly propagated through the application and its interface boundaries 1
33. Exceptions are properly logged before leaving an external interface boundary 1
34. Exceptions are avoided by using validation methods when a validation method exists 3

Back to top

Data Access

No. Standard Source
35. All database access is done via stored procedures 1
36. Data access is implemented in its own package to avoid repetitious data access code throughout the program 2

Back to top

Compilation and Builds

No. Standard Source
37. All code compiles cleanly without any warnings 3
38. Code builds using relative paths and does not have hardcoded paths (e.g. to local developer folders) 1

Back to top

Visual Basic .NET

No. Standard Source
39. XML documentation is used for commenting all public, protected, and friend user-defined data types, subroutines, functions, and properties 1
40. Modules are not used (use classes instead) 3
41. Custom application exceptions should inherit from Exception not SystemException 1
42. All disposable resources are acquired in a Using statement to guarantee disposal 1
43. Option Strict and Option Explicit are turned on for every Visual Basic .NET source code file 1
44. StringBuilder class is used for concatenating strings in loops 3
45. The .NET Framework Data Provider for SQL Server is used when connecting to SQL Server databases 1
46. Server-side threads are created from the .NET Thread Pool 1
47. Use generic collections over the standard (System.Object-based) or specialized collection classes 2
48. Do not omit code access levels (Public, Protected, Private, Friend) 2
49. String literals presented in user interface elements are not hardcoded - resource files are used 2
50. Do not terminate or pause threads by calling Thread.Abort or Thread.Suspend, respectively 1
51. When re-throwing a caught exception use Throw and not Throw ex to preserve the stack trace 2

Back to top