tag:blogger.com,1999:blog-26752431.post4670202169864327971..comments2023-11-02T05:30:16.348-07:00Comments on survic's blog on Programming or Enterprise Computing: survichttp://www.blogger.com/profile/05621218802357307115noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-26752431.post-86533116286664493822007-03-13T22:47:00.000-07:002007-03-13T22:47:00.000-07:00survic (myself!):You may say my definition of "Ric...survic (myself!):<BR/><BR/>You may say my definition of "Rich model" is too strict. Well, honest is honest! Here is a quote: <BR/><BR/><BR/><BR/>...a concrete example. <BR/><BR/>Suppose you have a Customer object. In the domain, the Customer has an Account, but in the object model, a Customer object only has a reference to its Account's id (following the notion of an aggregate root in domain driven design). <BR/><BR/>Now suppose the service layer supports the method getNetWorth(Customer). Without a rich domain object, the service would be responsible for retrieving the Account object on behalf of the Customer object and returning the value of the Account. Something like this:<BR/><BR/>...<BR/>Account account = accountRepository.getAccount(customer.getAccountId();<BR/>return account.getValue();<BR/>...<BR/><BR/>But suppose we want this logic to exist in the Customer object, as it should with a rich domain model. How would the Customer object obtain a reference to its Account object? The answer is it needs access the AccountRespository, And AspectJ + Spring can help achieve this. Basically, an AspectJ aspect (woven into the Customer class) would be invoked that would inject the AccountRepository bean from the Spring context whenever a Customer object in instantiated.<BR/><BR/><BR/>For deails, read the link: <BR/><BR/>http://ryanbreidenbach.blogspot.com/2006/09/spring-ddd-and-aspectj-example.html<BR/><BR/>Now, I believe I can give DDD a break now. I will not say a single bad word about DDD from now on. promise.Anonymousnoreply@blogger.com