I always want a cheat sheet that has a best practices written in a classified manner so it will be easy to remember and also easy to refer.
Below table for Best Practices of ASP.Net solves that problem. All the details given below are very SHORT and mostly solves PERFORMANCE issues. If you want to read about why the best practices should be followed, just type in the Google bar whatever it is written in the table with asp.net text concatenated. You can find why the particular best practices need to be followed. It is actually for people who have already worked in asp.net and they need a cheat sheet to remember when they are attending interview or reviewing code.
Level
|
DO's and Don’t's
|
.Aspx Level
|
|
Disable Session State if not needed
|
|
Disable View State if not needed, e.g.:- static page
|
|
Use
Lesser Web Controls, try normal HTML Controls if possible
|
|
Scripts
should be placed at the end of page, Scripts hinders loading
|
|
Try
removing scripts from aspx page to separate JS file
|
|
Try
removing styles from aspx page to separate Stylesheet file
|
|
.CS Level
|
|
Use
Server.Transfer instead of Response.Redirect wherever possible
|
|
Use
String builder instead of String concatenation using '+'
|
|
Handle
exception in previous layer do not through till presentation layer
|
|
Use
IsPostBack always in Page_Load and wherever possible
|
|
Always
use Arraylist instead of Array
|
|
Use
Page.IsValid for validating the whole page
|
|
Cache
object if it is frequently used
|
|
Design
using Value types.
|
|
Use
ASCII Format instead of UTF
|
|
Use
Format() instead of toString()
|
|
Remove
unnecessary looping inside code
|
|
Check
all loops. Identify any code that needs to be
outside
loop and remove from the loop
|
|
Config Level
|
|
Disable
Tracing in production environment
|
|
Set
Debug = false in compilation tag
|
|
JS & Stylesheet
|
|
Remove
scripts or Stylesheet that are never used from the respective files
|
|
Talk to you soon
IMPORTANT: Leave a comment to share what you learned, and hit the “like” button to let others know about it (make sure you’re logged into Facebook to like and comment).
IMPORTANT: Leave a comment to share what you learned, and hit the “like” button to let others know about it (make sure you’re logged into Facebook to like and comment).
Fantastic post, very informative. I wonder why the other specialists of this sector do not notice this. You must continue your writing. I'm confident, you have a great readers' base already!architect nijmegen
ReplyDelete