Hey all, wow, what a good ColdSpring day on the list!

Matt and Peter were asking:

Dave, would it be safe to say it better to use
dependency injection versus constructor-args (unless you need to process
something in your init)?

My personal preference is to use setter injection versus constructor injection. There's a few reasons for this. First off, it gives all your dependent CFCs a chance to become constructed in isolation before being wired up, and thus circular dependencies are not a problem. This being because each CFC's init method will only be dealing with its own state initialization. I also use setup methods to preform post dependency injection setup for my cfcs, such as retrieving the dsn name from a configuration service in a dao before it is returned from the factory. Remember that CFC creation by ColdSpring is a potentially 4 step process. 1: locate and possibly create all cfc needed to resolve all dependencies for the requested cfc (and any dependencies' dependencies and so on), 2: call any constructors for those cfc, 3: call any setters for those cfcs, 4: call any init-methods for the cfcs. And then of course return the requested cfc.

As far as Mach-ii:

I agree. At the moment we have the getPlugins/Listeners/Filters(), etc methods in the To-Do for 1.1.1 to help the CS's Mach-II plugin. Anything else boys?

Hmmm, I think those methods will get the autowiring plugin going just fine. I have a bigger idea, but I don't think it's going to happen. What about having Mach-ii look for a ColdSpring instance by itself and then requesting the Listeners from it instead of creating them? Then Listeners would be auto-wired without the need for a plugin at all. There's lots of ways to make this happen, just an idea...

Also, Dave, that was a really really great post. Why don't you repost that to your blog so anyone who misses it here can catch it there?

Peace, -Chris

On Dec 15, 2005, at 12:34 PM, Matt Woodward wrote:

On 12/15/05, Peter J. Farrell <[EMAIL PROTECTED]> wrote:

Wow Matt -- we need to talk more often. Last weekend (rather ironically), I started architecting MachBlog (no, really!). This doesn't surprise me. I
wouldn't mind helping out -- I'd like Mach-II blog anyways...

Heh--that's a really funny coincidence.  Wonder if it's great minds
thinking alike or just two people coming up with the same hair-brained
idea simultaneously.  The final app will answer that question.  I'd be
happy to have you jump in--I'll send you an email off-list about it.

I'm doing this partially for my own enjoyment (yes, I'm a dork like
that) and partially to have a more full-blown real-world sample app
for Mach-II and ColdSpring that people could rip apart and tell me how
screwed up it is. :-)  Peter and I will definitely keep people posted
on the progress.  Dave and Chris, we'll probably beg you to look at it
once it's functional to make sure we're representing at least a
modicum of decent practices for ColdSpring.

Matt
--
Matt Woodward
[EMAIL PROTECTED]
http://www.mattwoodward.com


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/ [email protected]





----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to