Chad, Nathan, First of all, thanks for your feedback and comments. I am not really sure what you mean by "dynamic data structures". -- I was not talking about creating, altering, or removing tables in the DB at runtime if that or something close to that is what you ment.
Maybe it is easiest to look at a concrete example, even if it's oversimplified. An end-user of my app will create questionnaires where the questions, their types and their answers are customisable. My first thought was to model this (talking on the DB level now) with relations à la: QuestionnaireForm(id, title) Question(id, qfId, questionText, kind...) PossibleAnswers(id, qid, answerText) FilledOutQuestionnaire(id, qfId) Answers(id, qid, paId) So a questionnaire has a list of questions, each of which has a list of possible answers to choose from. The last two relations represent the actual questionnaires as filled out by end-users. I do not call this a dynamic data structure. Looking at the above relations again, you can view the first three as defining (one or more) entity types, namely the questionnaire form. The last two define instances of these types, namely the filled out questionnaires. So we could use JCR (or whatever -- this is my question) to model this data structure using entities and relationships or something in this direction. Basically, I'd expect something like this behind the scene: # Represents the entity types (QuestionnaireForm, Question, ...) Types(id, name) # Defines the possible relations between entities (a QuestionnaireForm has zero or more Questions, etc.) Relations(id, fromTypeId, toTypeId, multiplicities...) # Defines what properties an entity can have, their types, constraints, etc. (QuestionnaireForm has a title, etc.) Properties(id, typeId, kind...) # Entities Instances(id, typeId, ...) # Relationship instances Associations(id, relationId, fromInstanceId, toInstanceId) # Property data Values(id, propertyId, value...) This is what I ment when I said "dynamic data structure"; it's a meta- model. And my question is: are there well-performing frameworks for something like this? I see now that I should have asked: What approaches and what tools do you GWT guys use to model this? As to tools, I know for instance JPA or JCR but maybe their are advanced modelling tools for such purposes? I see that the first approach is straightforward to implement, so why bother and make it complicated? This is the important question for me and I can see points speaking against and for the second, more generic approach: the performance will not be as good, you might not be able to capture all your requirements with this model, etc. On the positive side, you can reuse such a framework in other projects. No need to write code to index properties for search, to handle access control, to write the DB update script, etc. -- in the ideal case the framework will do this for me. And I find myself very often in the situation where the customer wants "to just add another field", which in the past took me some time (add the property to the JPA entity, maybe even add new entities and relations, add indexing, write DB update, etc.). If I even had a generic developer GUI for such a modelling framework, I could just click "Add Property", or "Add Relationship" to adjust the data model to the new requirements. I liked exactly this about some of the LAMP projects like Drupal where you can very easily change the model and "everything still works" (search, UI, etc.). Any pointers welcome! Many thanks, Kaspar On 02.08.2009, at 16:27, Nathan Wells wrote: > > I'm with Chad here... > > Dynamic Data structures sound cool and even a little sexy, but they > are by definition contradictory. Your data structure is like the > foundation of your application: you want it to be as solid as > possible. Allowing for extensibility for future improvements is one > thing. A data structure that changes at run-time would be a complete > mess. > > But then, perhaps we're misunderstanding your question. Feel free to > elaborate if you feel misunderstood. > > On Aug 1, 5:06 pm, Chad <[email protected]> wrote: >> Kaspar, >> >> While you probably can find the kind of tool you are looking for (I >> don't know of any since I don't have a need for them), I would >> question your data design. You should be able to design your data so >> that users can add questions without changing the data structure, >> just >> the data content. Then, you can build your app with a set data >> structure, but the data can be completely dynamic. This would result >> in the same experience for the user, but a lot less work for you and >> most likely less fragility for your data. >> >> HTH, >> Chad >> >> On Aug 1, 9:30 am, Kaspar Fischer <[email protected]> wrote: >> >> >> >>> Hi everybody, >> >>> I am looking for a Java library that allows me to define the data >>> model for my GWT application. Among other things, my app allows the >>> user to define different types of questionnaires and for this I >>> need a >>> flexible data model - where the user can add fields (questions, for >>> instance) at runtime. >> >>> JCR first looked like a good candidate but it has lots of additional >>> features and I was running into performance problems, at least with >>> the few implementations I tried. >> >>> Do you know of a library, on top of Hibernate for example, that >>> allows >>> me to define types (entities) with properities and relations in a >>> dynamic way? I suppose frameworks like this exist but I could not >>> find >>> any. >> >>> Many thanks, >>> Kaspar > > Type(id, name) # will represent the entities QuestionnaireForm, Question, ... Relations(fromTypeId, toTypeId, multiplicities...) # a QuestionnaireForm has zero or more Questions, a Question has zero or more PossibleAnswers, ... Properties(id, typeId, kind...) # title of QuestionnaireForm, questionText, etc. On 02.08.2009, at 16:27, Nathan Wells wrote: > > I'm with Chad here... > > Dynamic Data structures sound cool and even a little sexy, but they > are by definition contradictory. Your data structure is like the > foundation of your application: you want it to be as solid as > possible. Allowing for extensibility for future improvements is one > thing. A data structure that changes at run-time would be a complete > mess. > > But then, perhaps we're misunderstanding your question. Feel free to > elaborate if you feel misunderstood. > > On Aug 1, 5:06 pm, Chad <[email protected]> wrote: >> Kaspar, >> >> While you probably can find the kind of tool you are looking for (I >> don't know of any since I don't have a need for them), I would >> question your data design. You should be able to design your data so >> that users can add questions without changing the data structure, >> just >> the data content. Then, you can build your app with a set data >> structure, but the data can be completely dynamic. This would result >> in the same experience for the user, but a lot less work for you and >> most likely less fragility for your data. >> >> HTH, >> Chad >> >> On Aug 1, 9:30 am, Kaspar Fischer <[email protected]> wrote: >> >> >> >>> Hi everybody, >> >>> I am looking for a Java library that allows me to define the data >>> model for my GWT application. Among other things, my app allows the >>> user to define different types of questionnaires and for this I >>> need a >>> flexible data model - where the user can add fields (questions, for >>> instance) at runtime. >> >>> JCR first looked like a good candidate but it has lots of additional >>> features and I was running into performance problems, at least with >>> the few implementations I tried. >> >>> Do you know of a library, on top of Hibernate for example, that >>> allows >>> me to define types (entities) with properities and relations in a >>> dynamic way? I suppose frameworks like this exist but I could not >>> find >>> any. >> >>> Many thanks, >>> Kaspar > --~--~---------~--~----~------------~-------~--~----~ > 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 > -~----------~----~----~----~------~----~------~--~--- > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
