tag:blogger.com,1999:blog-6851845813602526520.post7729835706432469017..comments2023-10-12T03:57:08.352-07:00Comments on Not So Much...: AOP meets DDDRyan Breidenbachhttp://www.blogger.com/profile/08321479442409262496noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-6851845813602526520.post-70805426936574828742007-05-25T13:27:00.000-07:002007-05-25T13:27:00.000-07:00I have to agree with Sunny, your Customer should h...I have to agree with Sunny, your Customer should have full blown Accounts. <BR/><BR/>If that causes performance problems then I guess they'll have to call repositories but don't underestimate the trouble this causes, mocking sounds like a good approach but it quickly gets out of hand so I'd avoid it unless completely necessary.Colin Jackhttps://www.blogger.com/profile/01403166737046938219noreply@blogger.comtag:blogger.com,1999:blog-6851845813602526520.post-51184263617407850572006-10-13T22:48:00.000-07:002006-10-13T22:48:00.000-07:00All Wrong, at first,your domain model 'Customer ' ...All Wrong, at first,your domain model 'Customer ' is wrong:<br /><br />Customer should refer to Account object, not Account's accountId.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-6851845813602526520.post-74049109074917587032006-09-22T10:30:00.000-07:002006-09-22T10:30:00.000-07:00Yeah, I considered the Hibernate interceptor appro...Yeah, I considered the Hibernate interceptor approach myself. The limitation is that this is only useful when Hibernate is managing the lifecycle of the domain object. What about in other circumstances - specifically new DomainObject()? This is where class-level aspects shine - being able to advise constructors.<br /><br />Regarding your other issue of unit testing...I would take the approach of testing a domain object that now has visibility to service/data access objects just as I would any other similar scenario - I would mock these dependencies. Of course, I have not done this with a domain object (yet). I plan on writing some example code and posting a follow-up this weekend.Ryan Breidenbachhttps://www.blogger.com/profile/08321479442409262496noreply@blogger.comtag:blogger.com,1999:blog-6851845813602526520.post-63176750923852286792006-09-22T07:06:00.000-07:002006-09-22T07:06:00.000-07:00I am tasting the kool-aid as well. I'm currently ...I am tasting the kool-aid as well. I'm currently using this technique to inject data access objects into the domain objects (and a few other objects ;-)). My Pre-AspectJ approach was to use a Hibernate interceptor (entityInterceptor on the sessionFactory) that was BeanFactoryAware. There's alot of talk on the Spring forums about both approaches. The Spring team recommends using AOP, and after I heard Ramnivas speak at the No Fluff Just Stuff Cincinnati Symposium, I was ready to give it a try.<br /><br />For spring documentation, look in section 6.8.1 of the 2.0 doc: http://static.springframework.org/spring/docs/2.0.x/reference/aop.html#aop-atconfigurable<br /><br />There were some bugs in 2.0 RC-3 in aspect weaving but they have been fixed in RC-4.<br /><br />Also, this technique requires load-time weaving or pre-compilation which can be a pain to remember to do when running a unit test in an IDE.Kyle Wrighthttps://www.blogger.com/profile/12727837333087020966noreply@blogger.com