Hi team,
As per the discussion following the new cocoon.setupObject(obj) method, I added to new methods to the FOM:
- cocoon.createObject(class) creates an object and goes through the various Avalon lifecycle interfaces.
The "class" attribute can be either a Class (written Packages.my.package.MyClass in JavaScript) or a String (the class name).
- cocoon.disposeObject(object) diposes an object if needed.
I think that createObject() is better than setupObject() and therefore would like to remove this second method.
Hrmm... I'm no Avalon expert, in fact, I don't even claim to feel comfortable using it, but I'd like to see more "Avalon Lite" stuff in the FOM, or at least the FOM stuff which corresponds to the Avalon API should be similarly named.
IMO people will be wondering why they should use createObject(Packages.foo) when they can just do "new Packages.foo()".
The name should somehow specify that the component goes through the Avalon component lifecycle. I don't know if the name of the functions can be "Avalonized" or not, but it's definitely something to think about. cocoon.lifecycle.createObject(class) ? cocoon.avalon.createObject() ? Just throwing ideas out.
Don't forget the docs! I think one thing that people are going to miss when looking up components is remembering to release them.
Thoughts?
Sylvain
Regards,
Tony
