Wednesday, May 20, 2015

Design Patterns

Design patterns provide efficient and standardize solutions for the software problems that occurs again and again. This design patterns can be use to develop high quality robust applications. But the thing is you have to select the right design pattern for the right problem. Once the selected pattern is need to change lot from its initial pattern too much, that means selected pattern is not adopted to your need. And picking the wrong pattern will lead you to write inefficient, complex and unmanageable code.

You can also create your own custom design patterns. Whenever you come up with a solution that can be re use in your application you may create a abstract pattern of it and re use in your application.

In this article I am going to discuss the famous design patterns introduced by the Gang of Four(GoF) using c# Code. Those patterns can be apply for any language.

We can group those design patterns into three groups.

  • Creational Design Patterns 
  • Structural Design Patterns
  • Behavioral Design Patterns
cont.... 

Wednesday, May 6, 2015

Sql Dependency

In a recent project I wanted to share data between different instance. I tried different things like getting data using a timer and reading throug a web service. It had some slowness and I research about this and found about the "Sql Dependency.

Sql dependency was introduced in sql 2005 to provide data flow between separate instances of an application. This is a query notification feature of the sql. This query notification feature lets to subscribe for a query such that when the result of that query changes it will notify to the subscriber. This notification is a message.

Sql Dependency is a special .Net Class which is under the System.Data. This allows you to subscribe for a event and later subscribe command get the notification from the sql server. This notification triggers for each and every insert and deletes and send the notification to the subscriber. So we can get the table changes instantly using this feature. This has some effect on the inser and update commands. But this is very handy and you don't need to poll the database every now and then to get updates.

Following link is one of the best links that I have found. It demonstrate all the little things related to this topic.

http://www.codeproject.com/Articles/144344/Query-Notification-using-SqlDependency-and-SqlCach