Showing posts with label DTO. Show all posts
Showing posts with label DTO. Show all posts

Thursday, May 26, 2011

DTO vs. POCO

This should have been clear enough. DTOs and POCO are two different things. If, by some reason, you are as confuse as I have been:

- Data Transfer Objects are objects that only have data (properties, if we are talking about C#) and, sometimes, logic to retrieve that data.
- Plain Old CLR Objects are objects that are simple -- they have simple logic to represent a real world object. They do contain methods and stuff.

I got them both mixed up some time ago (actually, a long time ago) when designing an architecture. It took me at least an year to discover that, while similar (POCOs may look like DTOs), they weren't the same. You see, I decided not to attach any logic to my POCOs, and I thought that it was "compliant" with this design principle.

Now I was reading some stuff over the matter and remembered to post it here. Someone might make the same mistake.