In my previous entry, I referred to Kai's blog where various community members wished for a simpler data binding API and asked for comments.
This blog is intended to collect the various proposals I've seen for simplifying data binding into one place so we can discuss their relative merits.
First, I'll state my personal biases.
Second, what are the various ways to raise the level of abstraction?
The bindable widgets themselves have the intelligence needed to bind them.
I dislike this approach for several reasons.
This is the approach of things like Beans Binding, as well as several well-known scripting languages like Perl and Ruby.
Folks would like to write something like:
String someOutput = "Hello, my name is ${person.firstName} ${person.lastName}";
Or (from bug 195222):
BeanObservables.observeValue(person,"parents[@mother=true]/person/name");
My personal thought here is that:
Basically, I like it but it sounds like a lot of work.
Using the Builder pattern, one could easily imagine something like:
IValueProperty objectAddressStreet = BeanPropertyBuilder.value("address").value("street").build();
More thoughts along these lines are in bug 195222 and bug 194734
Someone on the E4 developer list (sorry, I'm too lazy to look up who said this) complained that data binding's problem is that it conflates data flow with the user's work flow.
In other words, it directly represents data flow in the observables and the binding:
dbc.bind(SWTObservables.observeText(txtFirstName, SWT.FocusOut), BeansObservables.observeProperty(person, "firstName"), null, null);
But if you need to alter the user's work flow, for example through validation, then this validation code becomes a cross-cutting concern across all of your bindings.
However, unless one uses something like AspectJ, this seems like essential complexity to me.
Somebody please prove me wrong.
Please comment.
20081226: Edit: Fixed link to Kai's blog entry
~~LINKBACK~~ ~~DISCUSSION:closed~~