I needed a break today from some business tasks and decided to attend a previously recorded MSDN webcast, called Best Practices for Handling Data Using ASP.NET.
The webcast is basically an introduction to Object-Oriented Domain Model Programming and why classes and collections are better than using DataSet's (according to the presenter) in .NET. The speaker's main reason for “disliking” datasets is because generic DataSets can only validate business rules externally via other functions and classes. Domain Objects, however, encapsulate their business rules and validate themselves internally.
I think what interested me most about the presentation is the presenter's choice of words and style throughout the webcast. It was almost as if a developer was naieve and erroneous if they ever chose to use a DataSet over classes and collections. I mean no disrespect to the presenter, but I think Domain Model Programming was more of a “religious” choice for him. He is an OOP developer who uses the Domain Model and that will never change. If you use a different approach, you must be crazy in his eyes (I may be a bit dramatic here. If you watch it, let me know if you get the same feeling).
Personally, my programming style and solution varies from project to project based on the customer and the project. I may use classes and collections in either a Domain Model or Manager (Service) Model or I may use typed DataSets. Sometimes I use a Dynamic Query Engine and sometimes I use Stored Procedures. Sometimes I will even put business rules in the Database if I get a great payoff in performance or simplicity. It is important to understand the strengths and limitations of each approach and choose wisely as opposed to using one and only one style for all your projects.
One of the benefits of being a developer for small businesses is that many times I can go either way, which means I can choose a particular methodology just to break up the monotony of always using one approach. If we are not having fun and being creative while building high quality web applications, what is the sense of it all ;)!
You can view the webcast, here.
The presenter also has a website where he keeps all the downloads from other presentations, you can view them here. This webcast is actually part of a series of webcasts that I will probably watch just to see where he goes with all this.