PROBLEM:
How do you know your team's .NET code is well written?
SOLUTION:
Use the following checklist in your code reviews
Inline Documentation
- Module Headers
- Standard Routine Headers
- Routine parameters, return values, assumptions
- Constants, Module and Global variables
- Routines primary path
- Tricky code, special cases, exception handlers
Standards and guidelines
- Project Name and description
- Standard designs – message handling, clipboard, settings, etc
- Namespaces:
- CompanyName.TechnologyName[.Feature][.Design]
- Class Naming – (Pascal Case, do not use _ or prefix)
- Interface Naming – (I prefix, Pascal Case)
- Attributes Naming – (use attribute suffix)
- Interface Naming – (I prefix, Pascal Case)
- Enum Naming – (no suffix, Pascal Case)
- Static Field Naming – (Pascal Case)
- Parameter Naming – (Camel Case)
- Method Naming – (Pascal Case)
- Property Naming – (Pascal Case)
- Event Handler– (EventHandler suffix)
Change Control
- Amendment history included
- Marked changed code
- Implementation of new/changed Interfaces
Requirements/Design
- All specification features implemented
- Verification of the requirements - Unit Test
- Implementation of all interfaces defined
- Design document updated, according design changes in the implementation
Performance/Optimization
- File I/O optimized for efficiency
- File opened only once to process (unless a random-access file)
- DB - operations implemented for efficiency
- DB – correct cursor and location specified for the type of use
- DB – Use of indexed, record pointers, bookmarks
- DB – Extra records (unused) in recordsets
- Loops optimization
- Recursive routines optimization
Robustness
- Error Handling – avoid application crash
- Error Handling – meaningful defined error messages
- Error Handling – raise different error messages, according to the exceptions to provide appropriate automated response or indication to the user
- Error Handling – use of event log (to be isolated and reproduced later)
- Error Handling – catch blocks for all type of exceptions
- Transaction – group related executions and protect against failures (Commit, Rollback)
Data Use and Control
- Minimize use of global variables
- Module variables use
- Variables – declarations with the smallest scope possible
- Variables – declared with a specific type (the smallest type appropriate for the data)
- Variables – clear names to identify the use
- Variables - Data comparisons of the same type
- Variables (module and global) – initialized to default values
- Magic numbers avoided using constants and macros
- Use of Multiple-individual variables – group related data instead
Execution Control
- Functions – return proper value
- Recursive functions – boundary safeguards
- Modularization use – remove deep nesting of control statements.
- Comparisons – proper bracketed evaluations (ensure right order of priority)
Portability
- External OS related components testing – ensure compliance with requirements
- Platform specific code – clearly identified
Localization (if supported)
- Component integrations with the OS regional settings or any application settings
- Code implemented to account for user localization issues
- Presenting data – user specified date, currency formats, font, color selections, sort orders etc.
- Application correct respond to region changes
- Use of Resource file or language library – to enable easy deploy in multiple languages
Style and Layout
- Consistent use of style elements
- Code easy to read
Reusable
- Common code identified for inclusion in a common library
- Duplicated common code
Testable
- Driver program for independent test of the component
- Unit test plans used and applied – to identify critical test elements
Data Access
- General configurations (connection string)
- Proper use of Data objects
- Error Handle – use try – catch – finally blocks (close connection object)
Assemblies
- Naming Conventions (namespace)
- Assembly location (local, GAC)
- Multi File / Single File assembly
- Versioning
ASP.NET
- State Management (State object, Session / Application)
- Configuration
- Controls
- Security
- Caching
- Error Message Handle
- UI – CSS, Page Templates
Remoting Configurations
- Activation Type (Client, Singlecall, Singleton)
- Registration
- Appropriate use - (synchronous, asynchronous)
If you find this solution useful, you are welcome to press one of the ads in this page.. Thanks!