Kaspar,

I would simply do it the first way, or (in OO now)

class ConceptualQuestionnaire {
  String title;
  List<Question>;
}

class Question {
  String text;
  List<PossibleAnswer>;
}

class PossibleAnswer {
  String text;
}

class PhysicalQuestionnaire {
  User user; //assuming you want to associate a user
  ConceptualQuestionnaire theQuestionList;
  List<RealAnswer> answers;
}

class RealAnswer {
  Question q;
  PossibleAnswer a;
}

The thing is, there IS a framework for what you are trying to do (i.e.
represent a data structure without being tied to implementation). It's
called Java. If you're looking for the ability to quickly add fields
to customer's data structures, that's dependent on low coupling and
other good programming /techniques/ not a given framework. As far as
persisting the data goes, you can look at Hibernate or JPA, for which
there is much information about integrating with GWT.

I'm sorry if this isn't what you're looking for. Anytime I see someone
with an class that models "classes" or "types" or "objects" in anyway,
I start to think, "Hey, Java's already done this for me". If you
really want to go down that route, maybe you should look at
reflection? Though there's very little support for reflection in GWT.

Sorry this is getting so long, but I'm just saying that you face a
trade-off:

A - have a dynamic/meta-data structure or
B - have a domain specific data structure

A - represents huge upfront development and design costs to ensure
future usability in your domain. Also, runtime efficiency will, of
necessity, take a hit, as the processor first tries to "understand"
the structure, then does the actual processing.
B - more risk of getting too specific, increasing coupling, and making
maintainability/rapidly adjusting to customer's ever-changing
requirements more time consuming. A lot of good OOA/D will go a long
way to getting you out of these messes though.

Anyway, </rant> and HTH

On Aug 2, 7:59 pm, Jeff Chimene <[email protected]> wrote:
> Hi Kaspar,
>
> I  found some javascript +XML libraries "out there". My issue was that
> none of them really modeled the questionnaire I was asked to build.
>
> I rolled my own using GWT+XML. It isn't that difficult. Once I had the
> DTD, the survey designer could use that DTD in an XML aware editor to
> create a questionnaire. The other advantage of using XML was that I
> could transform the questionnaire results[1] into HTML via XSLT.
>
> Please note that I am deliberately using the term "questionnaire" as
> opposed to "survey" .The latter assumes amenability to statistical
> evaluation; the questionnaire was not subject to such constraints.
>
> Cheers,
> jec
>
> [1]
>   wedged into the questionnaire via attributes (e.g. score) and
> elements (e.g.  comments)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to