18/12/2013: 10 Best Practices of programming from CodeSpread(21-30)

bestpractice
bestpractice

18/12/2013: 10 Best Practices of programming from CodeSpread(21-30)

We love programming and having a knowledge of best practices always helps in writing beautiful code. We have shared first 20 random best practice in our previous articles 1-10, 11-20. More best practices from CodeSpread.

Best Practice #21, A single huge EDMX file may hit the performance. So split the EDMX into multiple EDMXs.

Best Practice #22, Perform minimum operations possible within one sql transaction

Best Practice #23, Use more than one DataContext where each one can represent a single unit of work. This can remove the database objects that are not used frequently.

Best Practice #24, SQL Query plans should be reused whenever possible as this can avoid unnecessary query compilation costs.

Best Practice #25, Prefer DateTime.TryParse method over try/catch blocks.


if (DateTime.TryParse(text, out result))

{ // code }

else

{ // throw error }

Best Practice #26, While using select LINQ Query, return IQueryable and not a ‘var’ object.

Best Practice #27, Do not use the unnecessary demo code which is available by default, while creating a new application.

Best Practice #28, Place all the Scripts to the end of webpage. This will get downloaded once browser has downloaded all the other content and will help in progressive rendering of the page.

Best Practice #29, ORDER BY,DISTINCT, TOP etc. operations may degrade query performance as they are performed only after the resultset is retrieved, so use them only when there is clear requirement.

Best Practice #30, Use namespaces while defining contracts in WCF service. This will help with versioning and interaction of the application with other services.

We would love to hear from our users about the best practices used by them. Please write to admin@codespread.com

Author: hershey

A passion for knowledge drives me to do programming, A passion for programming drives me to create something different, A passion for creation drives me to spread the knowledge.

Share This Post On

0 Comments

  1. nice superb explaination

    Post a Reply
  2. thanks for the tutorial
    I am having a problem.
    The feature “Create SQL server database” isn’t available , I can’t select it.
    Can you help, please ?

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

More from CodeSpread:

  • 17/12/2013: 10 Best Practices of programming from CodeSpread(11-20)17/12/2013: 10 Best Practices of programming from CodeSpread(11-20)We love programming and having a knowledge of best practices always helps in writing beautiful code. We have shared first 10 random best practice in our previous article here, now we are sharing fe...
  • 16/12/2013: 10 Best Practices of programming from CodeSpread16/12/2013: 10 Best Practices of programming from CodeSpreadWe love programming and having a knowledge of best practices always helps in writing beautiful code. Here, we have few best practices shared by professionals. Best Practice#1, Use foreach loop i...
  • 24/12/2013: 10 Best Practices of programming from CodeSpread(31-40)24/12/2013: 10 Best Practices of programming from CodeSpread(31-40)We love programming and having a knowledge of best practices always helps in writing beautiful code. We have shared first 20 random best practice in our previous articles 1-10, 11-20, 21-30. More b...
  • Tip : Code Structure C#Tip : Code Structure C#As a developer, I always stress on developing a habit of following the best practices to structure the code. It helps me to easily navigate through the code and also saves a lot of effort in search...
  • Concepts: S O L I DConcepts: S O L I DSOLID - Object oriented programming principles. May be its easy to forget these principles  but for creating a reusable code or maintainable code, people will always have to come back and check ...
  • C# Code to send a MailC# Code to send a MailWhile working in a project, we always neglect the importance of the code which we have written many times and now end up in copy pasting the code from old projects. Lately, I saw a request in fo...
  • Agile Encounters UnpredictabilityAgile Encounters UnpredictabilityWhat is Agile? Wikipedia says “Agile software development is a group of software development methods based on iterative and incremental development, where requirements and solutions evolve through...
  • Why Multiple Inheritance is discouraged?Why Multiple Inheritance is discouraged?Hi Guys, This is Sathish Again,Today we will discuss why most of the higher languages eliminates Multiple Inheritance? Most of you guys already know that multiple inheritance is not available for...