February 13, 2010

Abstractions, Abstractions, Pile Them On

In my modest experience as a web developer using ASP.NET, I have gone through several stages of comfort and happiness with Web Forms, most of which I assume are pretty common:

  • Amazement at how little code or markup you need to write in order to spit out a bunch of html
  • Confusion over this “Postback” thing
  • Slowly growing comfort with the “Page Life Cycle” and its foibles
  • Eagerness to use more controls, especially those new-fangled “Ajax” ones
  • Happiness over how quickly pretty good applications could be written
  • Frustration at the quality of the html that gets spit out
  • More frustration over state-management (view state? session variables? hidden form fields? cookies? client-side caching? server side caching? AARRGGHH!!)
  • Yet more frustration with the hoops you have to jump through with the Page Life Cycle
  • Even more frustration with the Update Panel and the general clumsiness of ASP.NET Ajax
  • Hope that tools like jQuery will help deal with the above frustrations

You may have noticed a trend. :-) Like many, I think I have grown slowly weary of the idiosyncrasies of the Web Forms engine and its “Leaky Abstraction” problems. In our zeal to abstract away the complexities of a naturally stateless web environment, we’ve accepted abstractions piled upon abstractions piled upon more abstractions.  I can’t help but feel we’ve arrived at a point where, despite creating abstractions to simplify web development, the weight of the abstractions (or, more precisely, the weight of the leaks) have complicated things more than they’ve helped.

February 11, 2010

Developer Soft Skills

I listened to a good podcast episode of Deep Fried Bytes (Episode 44) the other day:

In this episode Keith and Woody sat down with Brian Prince, Developer/Architect Evangelist for Microsoft, to discuss the soft skills developers and software engineers need.  Brian has been speaking at conferences about soft skills for many years.  In true Deep Fried fashion this show is chalk full of stories.  The guys discuss tips for handling one's career as well as life work balance, sales and communication.

Soft skills are social, interpersonal, and leadership skills that programmers (and many other people, for that matter) sometimes neglect to develop. I strongly believe that it’s impossible to be a truly adept developer without cultivating the skills involved with effective interpersonal relationships. We are, after all, people writing code for other people.


Anyhow, the discussion between the Deep Fried Bytes guys and Brian Prince touched on a lot of important ‘soft skill’ issues. It’s well worth the listen.



February 08, 2010

Using ELMAH with multiple applications

I’ve been using ELMAH a lot lately, and have it deployed to multiple ASP.NET applications. As I’ve said before, I love it. It’s certainly easy to set up and useful for each application to have an error log of its own.

However, sometimes I want to see a consolidated list of errors across all of those  applications. Here are a few of the things I’ve done to create what I call a “Master” ELMAH error log viewer.

First, the easy part. Each of the applications that I’ve deployed are connected to the same SQL Server database, prepared using the standard ELMAH configuration. All of them log to the same database.

The ELMAH viewer page HTTP handler, however, is designed to filter the errors by application. It does this by inferring the application name (or getting it from the config file, if you’ve specified it there), and then sending that application name to the database as a parameter for the ELMAH_GetErrorsXML and ELMAH_GetErrorXML stored procedures. The stored procedures have a WHERE clause in the SELECT statement that filters the errors. This is great for the applications individually, but we have to override that behavior if we want to have a consolidated view.

To start, I created two additional stored procedures in the database called ELMAH_GetErrorsXML_Master and ELMAH_GetErrorXML_Master. These sprocs are identical to the standard ELMAH sprocs, except I’ve removed the ‘@Application’ parameter and the ‘WHERE [Application] = @Application’ clauses.

Next (this requires downloading the source code, editing it, and recompiling), I created a ‘SQLMasterErrorLog.cs’, based on the existing ‘SQLErrorLog.cs’ class. I edited the GetErrorXml() and GetErrorsXML() methods to match the new sprocs I created, removing the @Application parameter.

February 03, 2010

A few days with my son and Python

I’ve had the Hello World! Computer Programming for Kids and Other Beginners book for about a week now, and my son and I have spent a few hours dabbling with it. So far I’d have to say that I’m pretty pleased with his level of interest.

The first few chapters are designed to get the reader to the general concept of computer programming and how to use the development environment (which is IDLE, a basic Python interactive shell). The book walks you through a bunch of basic string and number manipulating commands, and then the first chapter ends by asking the reader to type in a slightly longer program (about 18 lines) to run as a demo of concepts to be learned later in the book. The program, a pirate-themed random-number guessing game, is then run in the IDLE shell.

Watching my son do this reminded me of when I was a kid, typing a 100+ line BASIC program into a friend’s Commodore64 cassette-tape drive, executing, and hoping I hadn’t made a typo. Except now, a lot of the tedium has been removed and the feedback loop is so much faster. Ahh, kids these days just don’t realize how easy they have it…