Sergiu Dumitriu wrote:
Vincent Massol wrote:
Very good! :)
Some small comments:
* Not sure why you call the class HelloWorldContextualizer instead of HelloWorldVelocityContextInitializer
That's my fault, I used this name in an example I gave Anca.
It sounded good anyway, except for the situation mentioned by Vincent, when the name is "already taken".
* Might be good to have a small section about the fact that components remove the need for static code (for the best!) since you can have a component with a "singleton" lifecycle. * "and since we don't want to add the whole core and all its dependencies as a dependency of a simple lightweight component, ". Actually the real problem is that this would create a circular dependency since the core uses the components.
This is already specified a bit further down, in the "Code outside components" section. Anyway, I added a short note here, too.
* "In the component world, the current request information is held in an execution context. This is actually more powerful than the old XWiki context, as it is a generic execution context, and you can create one anytime you want and use it anyway you want. And you don't have to manually pass it around with all method calls, as execution contexts are managed by the Execution component, which you can use just like any other XWiki component.". We need to specify that it's a ThreadLocal implementation (meaning you get a new instance of the Execution context per thread). This means also that it's initialized by default at all XWiki entry points (i.e. where threads are created: Servlet, Portlet, Lucene thread, Stats thread, etc).
It's a bit too technical IMHO. But perhaps it would be good to specify this so that people creating new thread should know to take care of the execution context.
* "If you need some functionality from the old core, consider rewriting that part as a new component first, and then use that new component from your code.". I'd rather ask to discuss it on the list so that we find a solution collaboratively
Done.
I even learnt something! Good idea with the old xwikicontext cast to a Map, hasn't thought of that :)
Actually, to make this fully useful, I'd like to change all setters to put data held in fields in the map, too.
Excellent work Anca.
Big +1 to link it from our dev practices document.
Thanks -Vincent
On Sep 29, 2008, at 8:33 PM, Anca Paula Luca wrote:
Hi devs,
while developing my XWiki watch component, I've written a quick start tutorial on XWiki components, which I would like to add in the dedicated section on platform.xwiki.org.
It is currently in draft version at http://dev.xwiki.org/xwiki/bin/view/Drafts/CreatingComponents . Please give it a critical look and signal any errors that might have slipped or send improvement suggestions.
Here's my +1 for taking it out of draft version, WDYT?
Happy coding, Anca Luca _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs