As I was developing this morning, I came across a trade-off that I
wasn't happy with. Namely, as I create handlers and other interface
implementations in a given class, the implementations create new
classes, which adds additional, unnecessary code into the compiled
output.

One way around this is to sacrifice my code readability and simply
have the containing class implement those interfaces. For example,

class Foo {
  static class BarHandler implements ClickHandler, KeyDownHandler {
    ...
  }

  static class FooCommand implements Command {
    ...
  }

  ... class body that doesn't implement and onClick, onKeyDown or
execute method...

}

could compile to something like

class Foo implements ClickHandler, KeyDownHandler, Command {
  ... merged implementations ...
}

Of course, I'm operating under a few assumptions (based on my watching
this group and the developer group, and my lack of knowledge about how
the compiler actually works ;)

1. This isn't already done,
2. Adding more classes actually significantly increases the bulk of
compiled output.
3. The amount of time to add this optimization would be less than the
pain of the trade-off I'm dealing with.

Let me know what you think,
Nathan
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to