On Jan 14, 2010, at 11:40 AM, Aristedes Maniatis wrote:

Come to think of it, what is the difference between your new Key typesafe class and Path, other than a few dots...


One is a "domain object", and the other one is a DSL expression (see below).


Bridging that distinction is actually somewhat of a fundamental problem for us at this point, and I am looking for good ways to solve it.

The problem is that from a user perspective a number of things in Cayenne can be represented either as a String in a domain specific language (DSL: http://en.wikipedia.org/wiki/Domain-specific_language) or as a domain object, i.e. an object that is easy to manipulate via API.

Consider the two DSL cases are Expressions and EJBQL. In both we are using a parser to create an "abstract syntax tree" (AST: http://en.wikipedia.org/wiki/Abstract_syntax_tree) of them, and then use AST as a domain object. The problems with AST's as domain objects are these:

* ASTs are generic and not very intuitive for direct manipulation in API. A good analogy would be DOM trees vs. real object models represented by those trees.

* ASTs often have slight differences in structure compared to an ideal domain object. This is more pronounced in EJBQL, that has AST's for SelectClause and other irrelevant nodes on the tree (irrelevant to the user of course)

* Due to the use of JavaCC as a parser, we have this odd looking method names inherited from the parser Node class (e.g. org.apache.cayenne.ejbql.parser.Node)

So we need some common approach to bridging the "DSL serialization gap" for making EJQBL usable, and making Expressions more usable.

Andrus

Reply via email to