Entries for Tag: 'COAL'

I wanted to address a question that came up in the COAL presentation yesterday from Sean Corfield. He was questioning why in my example code of how to request a "service" from COAL why the init() was called everytime. The line looks like this:
<cfset variables.myservice = application.coal.getService("myservice").init() />
Sean made a very valid statement questioning that since a service is by very nature stateless, so there would be no need (and it would just be flat out wrong) to init() it. A service should not have any instance data, no properties and things like this. It is just a service, it gets information, it does something, it may return information, but thats it. Unfortunately I was a little nervous and couldn't quite get an answer out during the presentation to address this and intended to answer it at the end but forgot about it. The reason the init() is called when you request a service from COAL is that COAL services are not traditional services. Honestly the word "services" really isn't a good fit. I have gotten used to calling them services because COAL uses the Service Locator Pattern. But these are not necessarily services (although they most certainly could be and then there would not be an init()) but more like objects that you are requesting. So in this case, COAL is only returning objects for you to work with, not necessarily services. Now that may have been a little bit of rambling there, but I think that should about sum it up. I am definately looking into changing the terms used to keep from confusion in the future.

Posted on Thu. July 14, 2005 by Ryan Guill #
Design, Photograph, Work © Ryan Guill, aDeepBlue 2013: All Rights Reserved. | Contact | RSS Feed