Categories
Development

Getting rid of the anemic domain model

Craig Walls has an article about using AspectJ integrated with Spring for injecting DAOs, thus letting the domain objects persist themselves. It would also be an elegant way to enable domain objects to do checks against the database that are not possible just through traversing the objectgraph.

An interesting idea, and I’ve been missing something like it. The biggest grief I had when letting domain objects access my DAOs and not using this, was that classes had to remember to inject the correct DAO before utilising methods. This is maybe one of the most relevant uses of Aspects I’ve seen yet, and might be the reason I pick it up.

Leave a Reply

Your email address will not be published. Required fields are marked *