Thursday, November 27, 2003


Source: ComputerZen.com

But what price my soul?.

Yes, it compiled.  It worked even.  Not only did it work, but it completely meets the client's requirements.  But somehow when I look at those particular lines of code (16 lines, in this case, with DataGridGirl's help) I wonder about the ramifications of this horrible algorithm on my immortal soul.

If you know me, or maybe even if you don't, you know that it has been said I have an overdeveloped sense of smell.  Specifically, Code Smell.  Often it's a gift and has served me well.  Other times it's a crushing weight as the schedule looms and I just have to buck and, well, write some crap.  (Of course, if it is totally with in spec, performance, it works, QA, etc, it's not crap, but you know.)

So my question to you, fair readers and fellow codesmith's, how bad do you feel when the pattern doesn't quite fit or that nested foreach/foreach/foreach nested a bit to deep? 

When do you know to let go? Some might say, “when it passes the NUnit Test!”  Others, who look at coding as much an art form as science might disagree.

I noticed a number of folks, from Don Box to Doug Purdy, at the PDC making GREAT PAINS to let the audience know that “this or that particular line of code is an abomination! Look away, look away from these alpha bits that hold all our pride and all our shame.”  I had to say I agreed with their evaluations.

What to do when you've built a great monument, but there's bird poop at the top that you're responsible for.  Does it take away from the accomplishment?

[ComputerZen.com]
1:56:04 PM    trackback []     Articulate [] 

Source: ComputerZen.com

Getting Session State in HttpHandlers (ASHX files).

A reminder to myself and others, when you want to get access to your Session State from an ASHX or HttpHandler, you need to implement IReadOnlySessionState:

<% @ webhandler language="C#" class="DownloadHandler" %>

using System;
using System.Web;
using System.Web.SessionState;

public class DownloadHandler : IHttpHandler, IReadOnlySessionState
{
   public bool IsReusable { get { return true; } }
  
   public void ProcessRequest(HttpContext ctx)
   {
       ctx.Response.Write(ctx.Session["fred"]);
   }
}

> [ComputerZen.com]
1:54:34 PM    trackback []     Articulate [] 

Source: help.net

An SQL text by Erland Sommarskog, SQL Server MVP.

Erland has also posted an interesting list of articles

Texts on SQL

This is a small collection of texts about some features in SQL Server that people frequently ask about in the newsgroups about MS SQL Server. Rather than being a FAQ with many questions with short answers, these are in-depth articles on some of my favourite topics

[help.net]
12:39:41 PM    trackback []     Articulate []