Search the web
Sign In
New User? Sign Up
domaindrivendesign · Domain-Driven Design
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Improving application design with a rich domain model   Message List  
Reply | Forward Message #5857 of 16097 |
Re: [domaindrivendesign] Re: Improving application design with a rich domain model


Quoting Geert Pante <geertpante@...>:

> --- In domaindrivendesign@yahoogroups.com, Jing Xue <jingxue@...> wrote:
> Hi Jing,

Hi,

> I remember struggling with this for a while. One of the first issues I
> had was that Hibernate calls a default constructor of persisted
> objects to find out what the 'unsaved value' of the primary key is.
> This happens _during_ the hibernate sessionfactory construction. If we
> then inject using @Configurable a DAO that depends on the
> sessionfactory, we get a cyclic dependency.

Ah, I see. Yeah, that's a well known "gotcha". I actually even blogged
about it a while ago:
http://www.digizenstudio.com/blog/2006/02/06/the-circular-bean-reference-problem\
-in-spring-20s-arbitrary-domain-object-wiring/


> Further, it didn't seem to be a good idea to intercept constructors.
> 90% of all loaded domain objects are read-only. The injected services
> are only needed when the domain object needs to change state. For
> performance reasons, we decided to inject lazily, and intercepted the
> getBlaBlaService() method in the Domain Object.

Indeed, that's another valid approach which I toyed around for a
little too, but in the end there are just some issues I can't get
myself comfortable with (maybe you can help me sort out some of these
as I'm sure you've thought it through):

1. Intercepting getAService() would mean that the code everywhere
needs to remember to call getAService() instead of using this.aService.

2. From performance standpoint, every time getAService() gets called,
it has to call getBean().

3. There are many cases where services aren't necessarily for
modifying an object, but for the object to performance its part of the
domain logic. For instance, we had this User class that had a
PasswordHashStrategy injected (not strictly a service, but as
meaningful in this context) to handle password hashing.

Cheers.
--
Jing





Wed Sep 5, 2007 6:25 pm

manifoldronin
Offline Offline
Send Email Send Email

Forward
Message #5857 of 16097 |
Expand Messages Author Sort by Date

Hi, Back in June at the SpringOne conference I gave a talk on improving application design with a rich domain model. The video of the talk has now been...
Chris Richardson
cer
Online Now Send Email
Aug 27, 2007
1:44 pm

I seriously wish all conference presentations had the same online content that yours does... it's almost like attending the conference. ;) Thanks, James...
James Carr
jay_c_the_man
Offline Send Email
Aug 31, 2007
4:58 am

Chris, This is an excellent description covering many topics. There was a couple of things in there I was not aware of. Can you go more in depth on how...
dkode8880
Offline Send Email
Aug 31, 2007
12:57 pm

This post - http://tech.groups.yahoo.com/group/domaindrivendesign/message/4348 - may help you understand the distinction between Service Layer and domain...
randy stafford
randalparker...
Offline Send Email
Sep 1, 2007
2:21 am

Sean, I'm glad that you liked the presentation. The MoneyTransferService I describe in the presentation is a simplified but typical service in the applications...
Chris Richardson
cer
Online Now Send Email
Sep 5, 2007
12:54 am

Chris, Thanks again, This is the thinking that I was having so I'm glad I have the right idea. I currently am using C# and I use Castle MonoRail for my MVC...
dkode8880
Offline Send Email
Sep 5, 2007
12:47 pm

Excellent presentation, Chris. My team and I have been practicing DDD for the past year or so, and have a significant and robust stack at this point. We use...
Brad Neighbors
snoopy6996us
Online Now Send Email
Sep 2, 2007
12:54 am

... Hi Brad, The possibility of injecting a repository into an entity does enable some interesting designs indeed. Unfortunately the Hibernate's CGLib ...
Geert Pante
geertpante
Offline Send Email
Sep 4, 2007
6:29 am

... Hi Geert, Could you please elaborate on how exactly the interference happens? I'm interested in learning more details about this, because we've been using...
Jing Xue
manifoldronin
Offline Send Email
Sep 5, 2007
5:58 am

... Hi Jing, I remember struggling with this for a while. One of the first issues I had was that Hibernate calls a default constructor of persisted objects to...
Geert Pante
geertpante
Offline Send Email
Sep 5, 2007
8:34 am

... Hi, ... Ah, I see. Yeah, that's a well known "gotcha". I actually even blogged about it a while ago: ...
Jing Xue
manifoldronin
Offline Send Email
Sep 5, 2007
6:29 pm

Hi Brad, Glad you liked the presentation. Injecting dependencies into entities is definitely useful and avoids passing dependencies through many levels of...
Chris Richardson
cer
Online Now Send Email
Sep 5, 2007
1:09 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help