Louvain-la-Neuve sprint
There was a KSS sprint in Louvain-la-Neuve. Developers produced speed improvements, new syntax for KSS style sheets and refactorings for easier development with both client-side Javascript and server-side Python code.
One week after the release of Plone 3.0 - the first official release of a project which includes KSS engine, we had a development sprint for KSS. The sprint lasted three days (August 27-29, 2007), in BubbleNet offices in Louvain-la-Neuve, Belgium.
The focus of the sprint was threefold :
Let's get a bit more into the details of the work done during the sprint.
We discussed and agreed on the following changes for the KSS syntax.
1) Declarations like the following were previously forbidden :
Changes 1) and 2) have been developed during the sprint and are NOW in the trunk and tested.
Change 3) is available in a branch developed before the sprint by Balazs : it will be merged as soon as possible.
Change 4) will be developed later.
We are very happy that Jean-François and Laurent could join Balazs and myself in developing those features : they have made their first steps in the knowledge of the Javascript code of the KSS engine. This implies that the number of developers able of supporting the engine is growing !
1) KSS is now 4 to 5 times quicker !
This is the result of integrating base2 (new library from Dean Edwards of cssQuery fame). Selection of nodes with base2 is much quicker than cssQuery because a native XPath engine is used when available in the browser instead of only slow Javascript code.
The work was started in May by Balazs and Jeroen during a week-end in Rotterdam. Balazs and Alec Mitchell spent another few days in June to benchmark and test the integration. Finally, Balazs and Jeroen made the last needed refactorings during the sprint.
2) Exception infrastructure does not swallow anymore the place where exceptions have been throwed.
Thanks to Jeroen and Balazs that did the refactoring, debugging of exceptions will be easier.
3) The KSS parser code has been refactored.
This allow for better readability and thus better extensibility or maintenability. (We need ...abilities.)
4) The Javascript unit tests page in kss.demo has also been improved. The parser code unit tests still run in IE, Firefox, Safari, Opera and Konqueror.
Thanks to Jean-François and Laurent that did 3) and 4) with me.
1) kss.base allow us to distribute Javascript plugins as Python eggs !
Jeroen had written Python code for server-side integration of KSS : he presented his integration of KSS in Pylons at EuroPython in July 2007.
During the sprint, Jeroen refactored his code into the new kss.base module. It will serve as the base implementation for server-side integration of KSS in Python frameworks. One of the features of kss.base is the registration of KSS Javascript plugins by extracting metadata from Python eggs.
kss.pylons has already been refactored to use kss.base. In the future, we will build also build kss.zope above kss.base; it will replace kss.core that is now distributed in Plone 3.0.
2) Distribution of Javascript engine is now a step further !
As Laurent had worked with Jeroen on kss.base, he could also use it to develop kssconcatjs command-line utility. This will allow to easily produce the various flavours of KSS engine in a single Javascript file : development or production, with or without concatenated plugins.
Developers from frameworks built on Java or PHP will integrate the whole engine by integrating a single Javascript file.
All in all, a lot of work was achieved. Long life KSS !
--
Godefroid Chapelle
The focus of the sprint was threefold :
- Changes of KSS stylesheets syntax,
- Refactorings in client-side engine,
- Refactorings of server-side support in Python.
Four developers joined me to work on KSS project :
- Balazs Ree (from Greenfinity - Hungary),
- Jeroen Vloothuis (from Pareto - Netherlands),
- Jean-François Roche (from Pyxel - Belgium),
- Laurent Lasudry (from Netitbe - Belgium).
Let's get a bit more into the details of the work done during the sprint.
Changes of KSS style sheets syntax
We discussed and agreed on the following changes for the KSS syntax.
1) Declarations like the following were previously forbidden :
input.blurrable:blur, select.blurrable:blur {
action-server: kssValidateField;
kssValidateField-fieldname: kssAttr('atfieldname', true);
kssValidateField-value: currentFormVar();
kssValidateField-uid: kssAttr('atuid', true);
}
Multiple CSS selectors are now allowed, both when events that should be bound are similar like above or different like below.
form.inlineForm input[name=kss-cancel]:click,2) Value providers are now recursive. In other words, parameters of value providers can now be other value providers.
form.inlineForm input.blurrable:keypress(inlineescape) {
evt-keypress-keycodes: '27'
evt-click-preventdefault: true;
action-server: replaceWithView;
replaceWithView-fieldname: kssAttr('atfieldname', true);
replaceWithView-macro: kssAttr('macro', true);
replaceWithView-templateId: kssAttr('templateId', true);
replaceWithView-uid: kssAttr('atuid', true);
replaceWithView-edit: true;
}
... {3) Value providers will be allowed in event binder ids. In other words, value providers will also be used for the selectors.
...
saveField-value: currentForm(kssAttr('variableName', true));
...
}
form.inlineForm input.blurrable:keypress(kssAttr('binderId', true)) {4) kssParameters (action parameters which have a name starting with 'kss') will be allowed in the action name declaration. They will be space separated. In other words,
...
}
... {will be equivalent and will coexist with
...
action-server: replaceWithView url(http://host/object/replaceWithView);
...
}
... {that works currently.
...
action-server: replaceWithView;
replaceWithView-kssUrl: url(http://host/object/replaceWithView);
...
}
Changes 1) and 2) have been developed during the sprint and are NOW in the trunk and tested.
Change 3) is available in a branch developed before the sprint by Balazs : it will be merged as soon as possible.
Change 4) will be developed later.
We are very happy that Jean-François and Laurent could join Balazs and myself in developing those features : they have made their first steps in the knowledge of the Javascript code of the KSS engine. This implies that the number of developers able of supporting the engine is growing !
Refactorings in client-side engine
1) KSS is now 4 to 5 times quicker !
This is the result of integrating base2 (new library from Dean Edwards of cssQuery fame). Selection of nodes with base2 is much quicker than cssQuery because a native XPath engine is used when available in the browser instead of only slow Javascript code.
The work was started in May by Balazs and Jeroen during a week-end in Rotterdam. Balazs and Alec Mitchell spent another few days in June to benchmark and test the integration. Finally, Balazs and Jeroen made the last needed refactorings during the sprint.
2) Exception infrastructure does not swallow anymore the place where exceptions have been throwed.
Thanks to Jeroen and Balazs that did the refactoring, debugging of exceptions will be easier.
3) The KSS parser code has been refactored.
This allow for better readability and thus better extensibility or maintenability. (We need ...abilities.)
4) The Javascript unit tests page in kss.demo has also been improved. The parser code unit tests still run in IE, Firefox, Safari, Opera and Konqueror.
Thanks to Jean-François and Laurent that did 3) and 4) with me.
Refactorings in server-side Python code
1) kss.base allow us to distribute Javascript plugins as Python eggs !
Jeroen had written Python code for server-side integration of KSS : he presented his integration of KSS in Pylons at EuroPython in July 2007.
During the sprint, Jeroen refactored his code into the new kss.base module. It will serve as the base implementation for server-side integration of KSS in Python frameworks. One of the features of kss.base is the registration of KSS Javascript plugins by extracting metadata from Python eggs.
kss.pylons has already been refactored to use kss.base. In the future, we will build also build kss.zope above kss.base; it will replace kss.core that is now distributed in Plone 3.0.
2) Distribution of Javascript engine is now a step further !
As Laurent had worked with Jeroen on kss.base, he could also use it to develop kssconcatjs command-line utility. This will allow to easily produce the various flavours of KSS engine in a single Javascript file : development or production, with or without concatenated plugins.
Developers from frameworks built on Java or PHP will integrate the whole engine by integrating a single Javascript file.
All in all, a lot of work was achieved. Long life KSS !
--
Godefroid Chapelle