This post originated from an RSS feed registered with .NET Buzz
by Udi Dahan.
Original Post: Web Service Software Factory - Data Access CRUD!
Feed Title: Udi Dahan - The Software Simplist
Feed URL: http://feeds.feedburner.com/UdiDahan-TheSoftwareSimplist
Feed Description: I am a software simplist. I make this beast of architecting, analysing, designing, developing, testing, managing, deploying software systems simple.
This blog is about how I do it.
And I don't mean CRUD as in Create,Read,Update,Delete.
I haven't been following the factories much but David Hayden's recent post pulled me back in. Here's an example of the kind of solution that the factory creates:
I thought that object orientation was already accepted as good practice, but here comes Microsoft splitting up data and behavior once again. Business components that have only behavior, and business entities that contain only data (relationships between entities doesn't count as behavior) <shudder/>.
If anything, the business components, when you actually look at the code in them, are more service layer objects than anything else. Which kind of makes you wonder why there is a separate Service Implementation layer. Is it because the service implementation is technology dependent? The answer is yes.
Wouldn't it be great if we could have service layer objects that were technology independent? Then we could take the code in the "business components" and put it there, and do away with an entire layer.
You know where this is heading. The tried and true Domain Model pattern and its friends. Its just that this whole "data access" paradigm that Microsoft keeps pushing gets on my nerves. It just does not hold up in complex domains - I know, I've tried. I've also consulted on many other projects that have tried, and seen them get to the point of no return. The point where programmers just don't know what the domain logic is - because its spread all over the place: service implementation, business components, entities, data access, stored procedures... Its at that point when they have to "ship" so that the project won't be called a failure. Then they scrap the whole thing, and start working on version 2.0 which will be totally different! They use a rules engine! I've already wrote about the kinds of successes I've seen there.
OK, enough whining. Do your own design. There are other patterns besides what Microsoft puts out. Read them, use them. Just because there's a factory that autogenerates thousands of lines of code, doesn't mean that they're the right thousands of lines of code.