Menu

GWT model compilation

Anonymous
2011-06-15
2013-04-25
  • Anonymous

    Anonymous - 2011-06-15

    Hi guys,

    I was looking for alternatives to the raw DTO approach suggested by Google when transferring information over the wire, and I have to say that Gilead is really appealing when compared to the others.

    Sometimes people forget that one of the primary concerns of programmers is eliminating repetition of concepts, and I don't think creating extra structures (name it, DTOs or interfaces) is the right way to avoid duplication.

    I'm new to GWT as well, and I was turned down by the fact that in order for Gilead to work, it seems that the model must be 100% JS compilable, that is all the references must be resolved in the "source" GWT path, as far as I know.

    Ideally, the JS representation shouldn't include any server-side code but only should act as mere data holder

    So my question is:

    is there any way to overcome this problem?
    what's your strategy?

    Thank you and I'm not giving up on Gilead

     
  • Bruno Marchesson

    Hello,

    Indeed, Gilead promotes the Domain Driven Design architecture principle, so your model class must be the same on both server and client side. That means that model must be 100% JS compilable.

    The simplest way to do it is to create your model classes using the JavaBean standard : an empty constructor, and getters/setters for members. Of course, you can add business methods in bean, but it has to be limited to GWT White List class (no session factory and so on) to be usable on client side.
    As a consequence, you will have to separate your business logic from your model and keep it on server side.

    Hope this helps !
    Bruno

     
  • Anonymous

    Anonymous - 2011-06-16

    Okay, thanks for your answer Bruno!

     

Log in to post a comment.