I've seen a very subtle bug in an application's code. The application has an interface called FieldSet, that represents a set of fields on a kind of property sheet. There's lots of components that implement FieldSet. The FieldSet has a "label" property of type String. In most cases, the FieldSet's label property is simply the label property of the TextField inside the FieldSet (some properties are more complicated). In rare cases, the FieldSet's label property may be dynamic, as can the label parameter of the TextField.
There's also a type coercion from FieldSet to String that extracts that label. Here's where it gets tricky: <t:someothercomponent label="component:fieldset"/> This works perfectly when the FieldSet's label is static. Because the "component:" binding prefix is invariant, the TypeCoercion from FieldSet to String is computed the first time and cached for later. The problem is that if the FieldSet's label property is actually dynamic, this is not reflected properly. The first access runs through the coercion; however the value is cached because "component:" is invariant and the logic inside Tapestry assumes that any value derived from an invariant binding is also invariant .. but that's not the case. Part of me thinks we can kludge this by simply not caching the results when a type coercion is necessary. However, I'm thinking that a lot of the caching associated with invariant bindings is simply not necessary and would result in Tapestry operating more predictably without any perceptible performance change. What's frustrating the correct solution to this is to build out a sizable app and do some performance testing with the current state of the app, and the two solutions above, and see which is best. I'm just buried under too much urgent billable work to build that out, really feel like I'm running the red queen's race. -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
