I have circular dependencies all the time. They are a valid situation. Most
commonly I see them between service classes where (for example) UserService
and AddressService need to access each other.

Best Wishes,
Peter



On 6/20/07 10:35 AM, "Jonathon Stierman" <[EMAIL PROTECTED]> wrote:

> Gotcha :)
> 
> So what's the reasoning behind the dislike of circular dependencies?  From
> what I can tell, they're unavoidable in my case...
> 
> I have a couple of objects, for example: Domains and DomainEmails.  When a
> call to the Domains.deleteDomain() method is called, I need to be able to
> clear out all the DomainEmail records for that domain -- so I call the
> DomainEmails.deleteDomainEmail() method for every record that exists for
> that particular domain.  Domains requires an instance of("is dependent on")
> the DomainEmails CFC to make that call.  DomainEmails also requires a
> Domains CFC -- when I create a DomainEmail record, I want to make sure that
> the domainID it's being created for actually exists.  To do that, I need a
> reference to my Domains.getAllDomains() method.  That's circular depedency
> :( But I don't see any way around it, unless I wanted to live with sloppy
> deletes and inserts...
> 
> Jonathon
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of Tom Chiverton
> Sent: Wednesday, June 20, 2007 3:33 AM
> To: [email protected]
> Subject: [coldspring-dev] newbie question!
> 
> On Tuesday 19 Jun 2007, Jonathon Stierman wrote:
>> My one "issue" with Setter injection is that the dependencies aren't
>> guaranteed to be set by the time I need them (hence why I liked the
>> constructor-arg property).  What do you guys do for ensuring that your
>> dependencies are in place when you use setter injection?
> 
> What Peter said :-)
> But we only ever had to do it once, and it bothers me we had to do it.




Reply via email to