- Not Only Read-Only
- A Somewhat Unusual Choice in the .NET Platform
- Data Transfer Objects or Smart Objects?
- A Simplistic Custom Classes Example
- Some Pros and Cons with the Customer Classes Solution
- Custom Classes Code Examples
- Test of the Week
- Conclusion
Some Pros and Cons with the Customer Classes Solution
As you might guess, I have gathered a lot of advantages about using custom classes. But not to sound like a salesmen, I also have found some drawbacks.
Some advantages are listed here:
Self-contained classes, so the client might (if desired) receive business rules, too.
Object orientation, with all its advantages. For example, it is pretty direct to apply classic design patterns, such as the GoF ones.
Full flexibility.
Typically type-safe operations.
Minimal interface.
Good performance.
Some disadvantages are as follows:
A lot of extra work required if you do it by hand
Somewhat weak for integration as is with heterogeneous clients
NOTE
The disadvantage of the extra work is actually a big one. For starters, it's very complex to create a solid framework for a domain model regarding persistence. And when you are done with that, you might find that your productivity is bad because you have to write a lot of code by hand; therefore, you need to write tools.
The problems regarding complexity and productivity are well knownsee, for example, Martin Fowler's book Patterns of Enterprise Application Architecture (Addison Wesley Professional, 2002). The common recommendation is to buy a product.