Tuesday, November 1, 2011

Scopes vs Strict Components

So I've been working a lot with JSF, Spring Web Flow and Facelets lately.  I never thought that I'd say this, but I miss something about the AribaWeb framework.

In AribaWeb there were strict components.  Strict in the sense that ONLY attributes of the component (i.e. <my:component data="test"> were accessible as data.  In Facelets everything in the SCOPE is visible so it is very easy to get your "reusable" components mixed up with application specific logic.

Even if you have discipline and only use component attributes you still have a namespacing problem similar to early BASH or C without the namespace keyword (i.e. your "data" variable may clobber another one accidentally).

Maybe there is a solution to this that I haven't discovered yet.  Until then I may go with the old convention of prefixing names with the component name (i.e. <my:component myComponent_data="test">) and only using local attribute data.  The naming convention would make that easier to check for too!

Happy Hacking all.

No comments:

Post a Comment