-Ray
- Three utility classes, which respectively allow for dynamically/
parametrically creating new instances, invoking their methods, and
getting/setting property values, are created at compile time for 'some
classes'.
- We have this working, and it's serving us well. And as 8 different
frameworks have independently created the same features with similar
implementations there probably is some point behind these ideas.
- However, i can understand very well if this kind of 'partially
working' feature is not acceptable as official addition to the main
GWT project. If this is how you feel, please just give me
confirmation, and we can consider the case closed?
This can be done at compile time with a Deferred Binding Generator,
and if parameterized GWT.create() calls with de-magicified syntax, it
could look roughly the same.
Non-magic syntax version
public interface MyBinding extends Binding {
/**
* @gwt.from firstName
* @gwt.to textValue
* @gwt.twoway
*/
public void bindFirstname(DomainObject do, Textbox tb);
}
MyBinding mb = GWT.create(MyBinding.class);
mb.bindFirstname(myDomainObject, textBox);
As a bonus, the Generator would check if the bound field exists at
compile time, and field synchronization would probably be optimized
down alot more than a fully dynamic dispatch.
With a more magic-syntax (see other thread on GWT.create() arguments)
you could come close to the Guice-like syntax above.
> - Generic Bean factory:
> // Depending on configuration, scoping etc. may return a new instance
> of FooView, or existing one
> beanManager.getBean(FooView.class);
Already handled by existing Deferred Binding mechanism as well. I
don't see why the getBean() method can't simply be GWT.create() if
you're passing in class literals as arguments.
> - Declarative UI with Lazy loading (XML can be loaded server on
> demand):
There is already an official declarative UI in development for GWT.
> <!-- At XML parse time the 'commandButton' tag causes corresponding
> widget to get dynamically instantiated. At run time, when the button
> is clicked, the method referenced by the #{expression} is invoked -->
> <m:commandButton text="Click me to save!"
> action="#{crudController.save(currentUser)}"/>
Perhaps I'm misunderstanding, but how does this fit into GWT? The code
you wrote looks like standard JSF code that executes on the server,
not the client. I really don't think we need EL in attributes on the
client. I would hesitate to try and bring JSF concepts into GWT. I
might be going overboard in saying this, but I think JSF is a bad
design, and that something like Wicket is a much more appropriate
model for GWT from a philosophical design standpoint. I think it is
a mistake to try and bring too many server-side design practices
(Spring, JSF, etc) which heavily depend on reflection and
interception, into GWT, which is very much concerned with compile time
reflection and interception.
Just my 2 cents,
-Ray
> - Declarative UI with Lazy loading (XML can be loaded server onThere is already an official declarative UI in development for GWT.
> demand):
The XML approach seems to treat GWT as if it's a UI Widget library like Dojo.
-Ray
Nope, wiring button clicks etc. to methods happens at runtime when the
lazily loaded XML is parsed, using expressions
('#{fooController.foomethod}') in the XML and reflection support for
the actual invocation. Basically the only associated cost should be
adding reflection support to the target method which will get invoked
with button click, and thats only some tens of bytes per method. Well,
thats the theory anyway -- the expression language has not been
implemented yet :)
We have been through this several times; what you say is true, but
when reflection support is used in app level code and in explicitly
configured way the effects of 'forced in' compiling are very limited.
These are two entirely different things, and the way how you
formulated your remark did not rub me in a way that causes pleasure.
Anyway, it's obvious that this proposal is not going to progress and i
consider the case closed.
The thing is, when i'v checked compiled JS (of 1.4.60) i haven't
noticed optimizations that would depend on knowing all possible
'invocation paths' of certain method. What kind of optimizations you
are talking about, exactly?
I'll get back as soon as i'v managed to separate the reflection stuff
to something that can be tested independently.
It seems your main concern is that the mere presence of the reflection
system makes entire software to execute at half speed or so. Luckily,
this part is easy to test. I switched to GWT 1.5 and I'v only had time
to do the very first (really bad) cut at this. The initial result is
that populating 1000x5 grid with string constants was just as fast
with reflection and binding systems on, as it was without. (it took
about 1600ms, of which about 1500 was spent on setText. This was with
firefox 2 on mac book pro C2D, measured with venkman, -style forgetten
happily to pretty, machine not booted in between etc. all possible
confounding factors, so we don't need to care about this much).
Basically at this point i'd like to get bit of input from you: what
kind of tests you would like me to run / what kind of situations
should induce the negative performance effects most likely?