Think Before You Use The DTO Pattern

Let me preface this blog post by saying that there are still times when a DTO makes sense. Also, this post is written from a .NET perspective, so some things may be different on your platform. What I want to address though is the tendency of many developers to just automatically create a set of DTOs for each layer for each domain model. As I mentioned in other blog posts, you should always think about why you are doing something before you are doing it. Continue reading “Think Before You Use The DTO Pattern”

Dealing with Validation – Domain vs Contextual

I’ve always found validation to be one of the most difficult and tedious aspects of writing enterprise software. No matter how you organize your rules, you are going to usually end up with duplication. To make matters worse, the rules aren’t written by developers, they are created by the business. This causes a disconnect between knowledge and domain experts, and the people who are implementing the validation in the code. As the rules change over time, and as the developers who originally worked on the system move on, the validation becomes increasingly difficult to manage. As the system matures, it ultimately ends up becoming a significant source of pain for all those involved. That’s assuming, of course, that you even have validation in the first place.
Continue reading “Dealing with Validation – Domain vs Contextual”