Wednesday, January 7, 2009

CLR Programming

I want to keep this blog as generic as possible and hence the name "Literally No Reservations". Hey, a lot of people will tell you that your blog should focus on a particular topic, but I beleive that should not be the case. So adding to the variety of topics, here is my first technical blog. The topic deals with one of the aspects of my day to day work.

Over the span of my IT experience I have used many different programming languages ranging from Pascal to C# and every step has been a progress towards opening a new door to the possibilities of effective programming. I recently started working with CLR (Common Language Runtime) integration in SQL Server 2005. At first I was skeptical about the design and the purpose of this process, but as complexity increased I could see the benefits. Usually we are only used to programming the database layer using T-SQL and the application layer using .NET. But embedding the .NET code in the SQL Sever does give us a lot of flexibility. e.g. with T-SQL it is cumbersome to do heavy computing and procedural tasks as well as cross server data extraction and manipulation. But working with the extracted data and performing a variety of transformations and computations on the data using a .Net compliant language like C# makes it a lot easier. Recently I have been dealing with a lot of scenarios where I have to deal with cross server databases as the architecture has been widely dispersed, and using CLR to do the work is a great help.

Well there are some restrictions to this process though. e.g. it is not a good idea to use this when the amount of data being worked on is really big. This would really slow down the application. Debugging is also a crucial factor in deciding to use this path, as debugging can be troublesome, like with debugging and re-deploying any other assembly. But overall, for me as a solution developer, the pros out-weigh the cons. I would rather prefer writing a well maintained code than trying to gain a few nano-seconds over the performance of the code.

Below are some of the books that would be a good read on this topic:
  • CLR via C#, Second Edition. Author : Jeffrey Richter (Wintellect)
  • Professional SQL Server 2005 CLR Programming: with Stored Procedures, Functions, Triggers, Aggregates and Types. Author : Derek Comingore, Douglas Hinson

No comments:

Post a Comment