TDD, DDD and the No-getters principle

Posted by Justin on Stack Overflow See other posts from Stack Overflow or by Justin
Published on 2009-07-17T20:53:11Z Indexed on 2010/04/28 1:13 UTC
Read the original article Hit count: 446

Filed under:
|
|
|

Hi all,

After several years of following the bad practice handed down from 'architects' at my place of work and thinking that there must be a better way, I've recently been reading up around TDD and DDD and I think the principles and practices would be a great fit for the complexity of the software we write.

However, many of the TDD samples I have seen call a method on the domain object and then test properties of the object to ensure the behaviour executed correctly.

On the other hand, several respected people in the industry (Greg Young most noticeably so) advocate the "no-getters" principle on our domain objects.

My question therefore is: How does one test the functionality of a domain object if it is forbidden to retrieve its state?

I believe I am missing something fundamental so please feel free to call me an idiot and enlighten me - any guidance would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about TDD

Related posts about ddd