Wednesday, December 01, 2004

DTOs...

I read the analysis of the over use of DTOs on projects (http://martinfowler.com/bliki/LocalDTO.html). There are many good technical reasons not to use DTOs: cost of implementation, they are only be used when the cost of communication is high, etc...

All sound reasons.

I use them because they help me think. I'm not the smartest guy in the world and I make mistakes. Sometimes I put business logic in the GUI. Sometimes I put display logic in my business logic.

The simple three letters "DTO" at the end of my object name make me think and that, for me, is worth the time it takes to write the assemblers. If I'm in the business logic and DTO appears, I know I'm mixing layers. If I'm working with a DTO and there's a bunch of code around it - I might be trying to put business logic in. DTOs more than anything keep a careful watch over the layers in my systems.

I'm a simple guy, I make simple mistakes. DTOs point them out. Thinking is my bottleneck - not writing assemblers.

0 Comments:

Post a Comment

<< Home