TheChaseMan's Frenetic SoapBox

Always looking for better ways to do things...

Custom Class/Collection versus DataSet Pt. III - Evolution of Design Philosophy

Here's an interesting discussion on DataSets vs. Custom Classes/Collections. It is interesting because I can look back over the last few years when I started blogging and see how my opinion on the subject as evolved, and it is kinda comical. But hey, .NET developers are are all new to .NET development in a sense simply because .NET hasn't been around very long! So, I expect most people to look for better ways to do things. Here's how my thoughts have evolved...

  1. .NET arrives on the scene and I use the DataReader almost exclusively.
  2. At some point I move to the DataSet almost exclusively after getting burned by not closing/disposing DataReaders.
  3. At some point I discovered Duwamish books installed with Visual Studio .NET 2002, and I decide that typed-DataSets are pretty cool.
  4. August 2004 I liked typed-DataSets more than sliced bread and more of the same.
  5. August 2004 I'm still trying to decide if I like the idea of using custom collections or not after having fallen in love with typed-DataSets.
  6. October 2004 I'm researching O/R Mappers and am skeptical. Plus, there are more reasons to be skeptical.
  7. October 2004 I read Fowler's book and decide it is OK to like the Table Module approach using typed-DataSets in .NET.
  8. January 2005 I'm still not sold on O/R Mappers but I'm giving them a fair shot.
  9. March 2005 I'm starting to like an O/R Mapper product (LLBLGen Pro).
  10. Late March 2005 I'm starting to like an ORM even more despite the bad press.
  11. August 2005 (today), I've been using LLBLGen Pro for 6 months now and it is very slick! I prefer the class/collection approach instead of typed-DataSets.

Now, all of that being said, what have I learned from this experience? A lot I hope.  :-)  I chuckle at my varying opinions, but at the same time I have to credit being open-minded (despite the sarcasm in some of my blog posts) for my change in design approaches. Unless you TRY things, you will never know what alternatives you have. I tried using DataSets...I tried using typed-DataSets...I tried using custom collections...I tried using an ORM product. It is always worth it to keep an open mind and try things. I've posted this statement many times and I'll do it yet again, "I'm always looking for better ways to do things." That's the best approach IMO, not making blanket statements such as "DataSets suck" or "Custom collections are too complex." The approach you take depends on the problem you are trying to solve. A linear search might be OK in some cases, whereas in other cases a binary search makes more sense. It's like arguing over using a Hashtable versus an ArrayList - use what is appropriate. So, I prefer custom classes/collections for my object models, but that doesn't mean DataSets wouldn't work either. I will say that I'm still firm on my stance that typed-DataSets are infinitely better than System.Data.DataSet to code against.

Anyway, now I'm taking a good look at the Enterprise Library to see how well it might work out for me on future projects. I already have used the Exception Management Blocks and Data Access Blocks, so it should be fairly straight forward. What do you think? Have you evolved in your design approaches since the .NET Framework was first released? Drop me a line and share your story.


Digg!

posted on Saturday, August 06, 2005 10:16 AM

Feedback

# re: Custom Class/Collection versus DataSet Pt. III - Evolution of Design Philosophy 2/22/2006 4:47 AM Marcos Martins

Nice Article!

I was used to work w/ typed datasets...but recently i´ve moved to a new company and here we got those java lovers and they all talk about how great is hibernate. So start to make my self those questions DataSet or ORM.

Once we have tried both poisons....i was wondering if you could give some feedback.....if you need to make a list with good points and bad points of each approach....how it would be?