Not an April Fool’s post

Today I plan on writing a stored procedure. Not because I’m being forced to, but because the problem, as far as I can determine, requires a set-based solution. It’s a once-a-month process, doing bulk import, update and export of up to a million records, and it all needs to be completed within an hour or so.

There are some problems that simply work better using a set-based approach. As long as I have tests around the process, I don’t really have a problem creating a solution in SQL. I could try to use some of NHibernate’s DML capabilities, but frankly, they aren’t close to touching SQL’s featureset.

I think I’ve too often ditched previous approaches to how I’ve done software development in search of the One True Way, instead of evaluating when certain approaches work well, where they don’t, and choosing the best fit for the problem space.

About Jimmy Bogard

I'm a technical architect with Headspring in Austin, TX. I focus on DDD, distributed systems, and any other acronym-centric design/architecture/methodology. I created AutoMapper and am a co-author of the ASP.NET MVC in Action books.
This entry was posted in Design. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Steve

    I gave up on one true way many moons ago in favor of selecting the right tool for the job.

  • Indeed, there is no one true way. As my father (a hobby woodworker) always said, use the right tool for the job.

  • Carlos Ribas

    Trading the pursuit of the “One True Way” for the constant search for the “best fit in each case” is, IMO, a golden gate through which all software professionals should pass.

    As experienced as you are, Jimmy, I would bet you’ve passed through it before. We should work on making that a one-way gate!

    PS – The fact that “Not an April Fool’s post” is so funny on this blog entry is almost sad :)

  • Anonymous

    +1 to what everyone else said: “The right tool for the job”. very important lesson.

  • Somtimes i write integration tests in c# that test stored procedures using linq to sql or something with basic results-translation so I don’t feel so dirty using stored procedures.

  • HenningK

    That’s exaxtly what stored procedures are meant for. The only issue with SPs I have is that people tend to grossly overuse them for idiotic single-entity operations.