Hi Barney, you may have just joined the list here, but this very topic was just discussed a couple of days ago. The general consensus was that all concrete CFCs should have an init() method by convention, even if it is just to call the superclass's init() method. Sean and some others weighed in and agreed. That said, I'm sure you may be able to sway that opinion. Since I don't think (emphasis on think) it would be too difficult to have ColdSpring look up the inheritance tree for an init() method, maybe this is something the framework authors would adopt.
On 5/10/06, Barney Boisvert <[EMAIL PROTECTED]> wrote:
> I implemented Cold Spring 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:
>
>
> <function name="init" ...>
>
> <cfreturn super.init(argumentCollection = arguments) />
>
> </function>
>
> 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
> currently is. However, there are a few counterpoints to that:
>
> 1. CF doesn't have object construction, aside from the
> pseudo-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,
> barney b
>
> --
> Barney Boisvert
>
[EMAIL PROTECTED]
> 360.319.6145
> http://www.barneyb.com/
>
> Got Gmail? I have 100 invites.
>
>
- [coldspring-dev] No inherited init() methods Barney Boisvert
- [coldspring-dev] No inherited init() methods Brian Kotek
- [coldspring-dev] No inherited init() methods Dave Ross
- [coldspring-dev] No inherited init() methods Sean Corfield
- [coldspring-dev] No inherited init() methods Barney Boisvert
- [coldspring-dev] No inherited init() methods Barney Boisvert
- [coldspring-dev] No inherited init() methods Dave Ross
- [coldspring-dev] No inherited init() methods Brian Kotek
- [coldspring-dev] No inherited init() methods Barney Boisvert
- [coldspring-dev] No inherited init() methods Barney Boisvert
- [coldspring-dev] No inherited init() methods Chris Scott
- [coldspring-dev] No inherited init() methods Brian Kotek
