• bteraberry (10/3/2012)


    The Dictionary.com definition of kludge:

    a software or hardware configuration that, while inelegant, inefficient, clumsy, or patched together, succeeds in solving a specific problem or performing a particular task

    I would not personally say that CLR is inherently inelegant, inefficient, clumsy or patched together. That you can write poor code with CLR shouldn't be evidence of it being a kludge. People can write bad code in any language.

    Certainly the judgement is in the eyes of the beholder and I can understand why someone with a lack of familiarity with .net languages would find CLR to meet the definition of a kludge. I just disagree that is inherently such.

    There is a great Itzek Ben-Gan article from 2006 or 07 titled (something like), "To CLR or Not to CLR: that is the question" In it he talks about how DBAs were apprehensive about introducing CLRs because they can be like giving knives and matches to kids."

    I have always been apprehensive of enabling CLRs for exactly that reason. In the same article he does recommend, for example, using a CLR for regexs (he includes a couple in the article). He tests the regex CLR vs Padindex and the CLR smokes the T-Sql implementation like 10 fold.

    CLRs are not risk free nor are they always a better choice. But, in some cases, to ignore them is to ignore a powerful Sql server tool.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001