Tuesday, February 21, 2012

Menu Spike Postmortem

Hi,

Well . . .

I've played around with it some more, and I'm disliking GWT more than I'd originally thought. It seems very powerful, but there's basically nothing coherently organized about how to use it. I find stuff on the GWT site like "GWT is being used by tens of thousands of projects around the world.". Uh huh.

In any case, the good news is that I've successfully completed a spike. It's ugly and bad, but it works. It may be found in the SVN repository.

The spike is (VERY heavily) based off of one of the other spikes (presumably Nialls's). I cleaned up a lot of things, in the process trying to get some semblance of understanding. In the end, I removed a lot of the hardcoded stuff, and tried to abstract it. It still does basically the same thing.

The primary issue this raised, however, is how the general structure will be set up. The main concern I have is the use of canvases versus the use of panels. Everything I saw said that you should use panels. However, in the spike I was working from, canvases were used.

From what I dimly understand, panels would allow automatic positioning and sizing, which is something this project will desperately need. On the other hand, again, as I dimly understand it, canvases allow drag and drop functionality. And I have to say, it looks really good. Unfortunately, I wasn't able to find anything useful about this schism in functionality and how to resolve it.

The other, somewhat tangential issue, is copying of objects. When dragging, a new object is created. That's fantastic, but it does mean that the old object's settings need to be copied over. The spikes currently just hardcode it, which is dirty. And the GWT designers, in their infinite wisdom, didn't provide some adequate way of doing this--or, at least, making it obvious. I hacked up a deep copy using what essentially amounts to serialization, but the software complained that it didn't know what the classes I used are. So, GWT-created pages don't support all of Java? Okay, that would have been nice to know. In any case, the upshot is that copying might be an issue.

Ian

5 comments:

  1. If you read the GWT documentation they give a list of what is supported. It is a very small subset of the language.

    http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsCompatibility.html

    ReplyDelete
    Replies
    1. That's useful, thanks!

      Huh . . . so no linked lists or anything more complicated than a String?

      Delete
    2. Did you not read that article? Almost all of the Collection framework is supported. There are specific methods that don't work. But in general all of the basic data structures work.

      Delete
    3. The key phrases for me were "GWT supports most of the core Java language syntax and semantics", but I also read "Primitive types (boolean, byte, char, short, int, long, float, and double), Object, String, arrays, user-defined classes, etc. are all supported".

      A HashMap isn't a primitive type, nor is it a user-defined class. That section deals with differences between development and production modes, but it didn't mention anything specifically about higher-order classes.

      I tend to assume something is *not* supported, unless I explicitly see otherwise.

      Delete
    4. "To find out exactly which classes and methods are supported for core Java runtime packages, see the GWT JRE Emulation Reference."

      http://code.google.com/webtoolkit/doc/latest/RefJreEmulation.html

      Delete