One of the the core facets of our framework is the ability to respond to
attribute change events on XML element. For example if someone changes
the "text" attribute to something on a button we want the text of the
button to change.

Originally I coded this as a big if/else statement. After doing some
testing it turns out the performance on if/else isn't so good, and it
can get a bit hard to read as well.

I was thinking instead it would be nice to have attributes map to
functions that handle them, via some standard naming scheme. For
example:

"text" -> setText()
"color" -> setColor()

So when an attribute on an Element changed, we would just look for the
setter of the same name on the bridge class and call it. 

I want to do a bit of performance testing to see how much better or
worse this is, but from a code organization perspective it seems a lot
nicer.

Thoughts?

James Margaris

Reply via email to