I implemented ColdSpring in my first app last night after having used Spring for a few months, but one glitch stung me and required a rather "stupid" workaround. I posted about it on the forum, but at David's prompting, opted to mention it here to.
The problem is that when you have a subclass that doesn't explicitly define an init method, the inherited init method from the superclass (assuming there is one) doesn't get called. That necessitates hackery such as this: <cffunction name="init" ...> <cfreturn super.init(argumentCollection = arguments) /> </cffunction> on all your init-less subclasses. In the Java world, constructors aren't inherited like methods, so I can understand the base logic that was used to implement it the way it currrently is. However, there are a few counterpoints to that: 1. CF doesn't have object construction, aside from the psuedo-constructor, which can't take parameters. 1. CF doesn't have constructors, it has methods. By convention, the method named 'init' is generally considered to fulfill the same role as a Java constructor. However, it is still a method. 1. CF doesn't have a default constructor equivalent to what Java has. I.e. if you don't define an 'init' method, CF isn't going to create an empty one for you. That leads to the case of creating an object an not having an 'init' invocation at all, clearly very different from Java's "you must call a constructor" paradigm. 1. The 'init' method is initializing an existing object, typically VERY soon after it's created. That's behaviour, and should be considered to be like any other behaviour. My point is that the init method is NOT a constructor, and shouldn't be treated as such. In many cases, it behaves in a similar fashion, but it's really quite different. Out of that comes my opinion that ColdSpring should traverse up the metadata tree looking for an 'init' method in superclasses, along with the opinion that having a CFC with an inherited 'init' method is not only perfectly acceptable, it's good practice when possible. cheers, barneyb -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites.
