Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sapphire-dev] XSD or DTD -> sapphire model questions

Thanks for the explanation.  It makes sense.  I did notice that you have added sapphire templates to generate properties on interfaces more quickly.  If I was proficient with those I think personally I could build the model from scratch faster than a generate+refactor approach.  

I'll continue to watch the web.xml to see the multi-version stuff as that will be important down the road for my editors, but not right away.

On Tue, May 17, 2011 at 11:37 AM, Konstantin Komissarchik <konstantin.komissarchik@xxxxxxxxxx> wrote:

Hi Greg,

 

We create models using a manual process of carefully going through the XSD, the available documentation and asking questions of relevant experts.

 

We have no automated tool that takes in an XSD or DTD and spits out a Sapphire model. The problem is that XSD and DTD are syntax descriptions. They do not carry sufficient information to create a high quality semantic models and they carry a lot of noise. For instance, given a syntax description of [ A | B | C ]*, I cannot tell if that should be three homogeneous lists or one heterogeneous list. To build an automated model generator, you would have to choose one or the other alternative, but neither is the correct choice in 100% of the cases. You have to understand what A, B and C are before you can make the determination of what should be grouped together. Or consider [ [ A | B ], C, D ]. Should that be one element type with A, B, C and D properties along with another enum property to serve as a selector between A and B? Or maybe two element types (A,C,D) and (B,C,D). Or maybe one element type with a heterogenous element property. All of these are valid answers in some cases. None of these is the correct answer in all cases.

 

You could argue that the developer could generate the model and then refactor it until it embodies the intended semantics. The problem is that in a non-trivial case, the work to refactor a generated model is roughly comparable to the work of writing the model from scratch. Given questions like above, the model generator is more likely to pick the wrong approach than it is to pick the correct one at any given junction. That’s simply a matter of statistics. There are usually more than two alternatives. The odds are not in your favor. The other problem is that the presence of a model generator gives some developers false sense of completion, but a bad semantic model directly leads to bad UI and other problems.

 

Regarding handling different versions, I am not far enough in the web.xml editor to show that, but the general answer is that we create a unified model and use enablement and validation facilities to control what’s appropriate for each version. Typically, we expose a version property at the top level of the model for everything to pivot on. In the UI definition, we have structures like if-else conditionals that allow us to tailor the UI for each version and even change UI on the fly when user changes the version.

 

- Konstantin

 

 

From: sapphire-dev-bounces@xxxxxxxxxxx [mailto:sapphire-dev-bounces@xxxxxxxxxxx] On Behalf Of Greg Amerson
Sent: Tuesday, May 17, 2011 6:24 AM
To: Sapphire project
Subject: [sapphire-dev] XSD or DTD -> sapphire model questions

 

Hi Konstantin,

 

I noticed that you have checked in many new model files for the upcoming web.xml editor.  I had a question in general about your process for creating a sapphire model that is based on a DTD or an XSD like the web.xml XSD.  Do you have a particular process for doing this other than just creating each object/property one-by-one?  I'm wondering if there is any script or tooling available to generate the model objects in a boilerplate fashion.  Its seems that much of a sapphire model could be created by a small tool that will read a DTD or XSD and create the top level objects and many of the properties that are simply to map (like a simple string value property).  The reason I ask is that I too am going to be creating a several new Sapphire models based off of some large DTD and XSD files and I was wondering if there was anything to make this process faster, less error prone.  Also, how do you handle the fact that a web.xml could have versions 2.3, 2.4, 2.5, or 3.0 and each version may have slightly different model properties?

--
Greg Amerson
Liferay, Inc.


_______________________________________________
sapphire-dev mailing list
sapphire-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/sapphire-dev




--
Greg Amerson
Liferay, Inc.

Back to the top