Patrick, I think you can pretty much defined coupled as "dependent upon", and i've come to understand that it's not as much black and white as it is a matter of degree. So "tight coupling" would refer to objects that are highly dependent on each other. Tight coupling in general leads to an inflexible design. As i understand it, if on the path you come across a situation where your design seems to be "wrong" - something isn't falling into place, one of the principles to get you back on track is to look for ways to loosen the coupling, and often that seems to be make your objects more modular.
An example. I didn't quite understand why one would want to separate DAO and gateway functions into separate objects, why maintain more objects than necessary? So i threw them together (tighter coupling). The day came when it became clear to me that it would help performance if i used a factory to create and then cached my gateways, and that they should be as lightweight as possible. That's the day i separated my gateways and DAOs for good. Looser coupling, and higher cohesion, lead to a much better design. Once i had that in place, i saw a few more opportunities to improve the design, simply because i started realizing the benefits of loose coupling ... -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Patrick McElhaney Sent: Wednesday, January 19, 2005 2:06 PM To: [email protected] Subject: [CFCDev] A question about coupling Lately people on this list have thrown around the word "coupling" a lot. I thought I had an understanding of what coupling is but now I'm not so sure. Can someone tell me which of these three CFCs is coupled to Thingy? Is one more coupled than another? <cfcomponent name="ExampleA"> <cffunction name="init"> <cfargument name="thingy" type="com.useful.Thingy"> <cfset variables.thingy= arguments.thingy> </cffunction> <cffunction name="doSomething"> <cfreturn variables.thingy.doSomething()> </cffunction> </cfcomponent> <cfcomponent name="ExampleB"> <cffunction name="doSomething"> <cfargument name="thingy" type="com.useful.Thingy"> <cfreturn arguments.thingy.doSomething()> </cffunction> </cfcomponent> <cfcomponent name="ExampleC"> <cffunction name="init"> <cfargument name="thirdParty" type="com.useful.ThingyHolder"> <cfset variables.thirdParty= arguments.registry> </cffunction> <cffunction name="doSomething"> <cfreturn thirdParty.getThingy().doSomething()> </cffunction> </cfcomponent> -- Patrick McElhaney 704.560.9117 http://pmcelhaney.blogspot.com ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.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' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
