Justin Rudd’s Drivel

Exceptions #1 Cause of Leaky Abstractions

July 6, 2008 · No Comments

Nicholas Blumhardt wrote about implementing the Specification Pattern using Linq.  And Rinat Abdullin did something similar using XPO.  These are both very neat approaches.  But there is something I was wondering about…

Exceptions.

Both approaches pass around an instances of IQueryable<>.  In the Linq to SQL world, IQueryable<> will be turned into a SQL query and then executed against the database.  And it will be done with extension methods like Count, ToArray, ToList, etc. are called.  It is a neat system.  But what about exceptions?  If I pass out an IQueryable<> instance that is implemented by a database provider (ADO.NET, NHibernate, etc.), I have to know that so that I can catch the correct exception.

Now it is well know in the Java world that the Hibernate (and probably the NHibernate) guys don’t think you should wrap exceptions.  Just let it go and deal with the technology specific exception.  I understand the hibernate position.  They are the abstraction over your database.  No reason to have an abstraction over an abstraction.

But a few things I’ve read in the DDD/TDD/<whatever>DD world are to have these repository abstractions so you can change it to be file system backed, DB backed, etc.  All worthy(?) goals, but when you start passing around things that allow the abstraction to leak…

Fail Fast - :P

There are those out there that will say “Why are you catching those exceptions?  Just let them crash your app.  It is the fail fast approach”.  Poppycock!  For example, if you try to connect to a SQL server and it is down, why can’t the app go into a wait state until it can connect again?  The app should definitely alarm and let someone know.  But in the majority of cases, it is because a patch was applied to the DB server, the DB was rebooted, and the connections need to be re-established.  Those are the types of things that code is good at handling.  I know this is one example.  And a simple one at that.  But the premise stands.

I guess the few years I spent at Amazon gave me an appreciation for self correcting code.  No amount of coding can bring something back from the “dead”.  But I do have a new way of defining “dead”.

I know.  I’m a killjoy.  Ask anyone on my team :)  I spend more time worrying about the error handling, monitoring, and overall health code than anything else in the system.  Solving the business problem is only 40% of the job in my mind.  Writing code to figure out what went wrong is 40%.  And telling people what it is wrong and what possible solutions might be is 20%.

Oh yeah…a big round of thanks to Nicholas and Rinat for working on my favorite IoC container - Autofac.

→ No CommentsCategories: Mindless

Better late than never

July 6, 2008 · No Comments

July 2nd was Peabody’s birthday.  Happy Birthday!

July 5th was my birthday.  Happy Birthday!

→ No CommentsCategories: Mindless

Glassdoor.com - sneaky way of getting reviews

June 17, 2008 · No Comments

I saw today on king5.com an article about Glassdoor.com. Seeing as how I still get traffic from a post (and its follow up) I have that someone linked to in Coderific.com, I figured I would check out what people are saying about Google, Microsoft, and Amazon.

The site is actually nicely laid out. The 2 main colums are Salaries and Reviews. You get a simple taste on the front page. When you search for…say…Amazon, you get teasers of the reviews and a list of the titles of people that have posted their salary. Want to read those reviews? Here is where Glassdoor is praying on your curiosity. To be able to read the reviews, you have to post a review. Want to see the salaries? You have to post a salary.

Of course you can’t just throw some wham-bam-thank you ma’am stuff. You have to have 100 words minimum. I think that is a good minimum. For people that just want to read the bad, they probably won’t bother with filling it out or even faking 100 words. For those people that do want to read the reviews, they can probably come up with 100 words of praise, faults, and recommendations. When I was filling it out, I thought it was 100 words each. It is only 100 words total.

I like this “you must contribute” system because it should keep the content fresh. Yeah…you could go to a Lorem Ipsum generator and get 100 words easy. But supposedly all the text is read by humans at some point.

It seems like an interesting site. But as with all sites that let people vent anonymously, you either get 1 of 2 extremes - complete hatred or absolute love. You can sometimes ferret out a nugget of a more objective review, but it takes some digging.


Just for the record, I’ve never posted to Coderific (other than to reply to an outright lie of a comment). And I didn’t post to Glassdoor about Amazon. I do not hide the fact that Amazon was both a terrific 3 years as well as the most hellish professional experience of my life.

I always joked about the saying “what doesn’t kill you makes you stronger”. I can say the saying took on new meaning after Amazon. But in a good way…really :)

→ No CommentsCategories: Mindless

Live Labs Logging Library

May 29, 2008 · 3 Comments

After many delays on my part (day job always trump side projects), I finally got my logging library that I’ve written about in the past up on CodePlex - Live Labs Logging.

The quick start gives you a very brief overview of how to use.  At this point and time, I’m calling it a 0.1 because while the code is 90% done, the productizing is miles from being completed.  I need documentation, examples, etc.  But I wanted to get it out there and get some feedback.

It is released under the Microsoft Public license so any and all should be able to use it.

Enjoy!

→ 3 CommentsCategories: Mindless