Best Practices in Coding

These are something I learnt from my architect with the code review fails.

  • If you are adding an interface with generic type entities, better to restrict it to base class.
    eg : 

    public interface IMapFilterCriteriaPlotter<TFilterCriteriaBase>
    where TFilterCriteriaBase : FilterCriteriaBase

  • All messages to users should provide the provision to localize.
  • Never ever show exception messages to users. Just log the exception and display a user friendly message to them.
  • When we want to do some continuous thing inside a loop, without disturbing in the middle if one fails, we have to add a try/catch inside the loop. Try the operation and continue it if something fails.
Advertisements

Author: Harshani Nawarathna

Sri Lankan woman in Computing

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s