Hi Doug: I agree with you assessment of repetition classes. We had a somewhat related discussion in http://www.ccs.neu.edu/research/demeter/demeter-method/uml-syntax-discussion Also see below. >From dougo@ccs.neu.edu Sat Oct 18 18:53:58 1997 >From: Doug Orleans >To: dem@ccs.neu.edu >Subject: repetition classes, RIP? > >Speaking of repetition classes and multiplicity edges... > >I've been thinking about this for a while now, and I've pretty much >convinced myself that we should just get rid of repetition classes as >they are now. Instead, we should simply allow construction classes to >have repetition edges, or in UML terms, roles with "0..*" or "1..*" >multiplicity. I suggest using a syntax akin to JavaCC's: > > Basket = ( Fruit )*. // 0..* > Company = ( Employee )+. // 1..* > Earlier we thought of a syntax like: // same as > >These edges can be freely combined with ordinary construction and >optional edges. We could even generate the edge name automatically by >pluralizing & lowercasing the class name. > >Why? I just find that having a separate Foo_List class for every time >I want to have a collection of Foo to be really cumbersome, both >conceptually and in the class dictionary. Also, I find the current Especially users in the information systems community find this cumbersome. >syntax for repetition classes to be awkward-- why do I have to mention Well, that is because of the EBNF heritage. In EBNF you write: List = S { S }. >the name of the class twice if it's a 1..* repetition? The one minor >problem I see with this new notation is that there's no obvious way to >specify "between" syntax, e.g. in the current notation, > > Commalist ~ X { "," X }. > >This means that there is a comma between each pair of X's in the >sequence. However, this is awkward in the current system too, because >if you want a list that has "between" syntax, it is not allowed to be >empty, leading to this situation everywhere: > > Foo = [ Commalist ]. > >I end up doing things like this all over demjava, and it's an annoying >detail that always gets in the way. > >--Doug > To solve the between syntax problem, we could use something like: Company = ( Employee before: "{" between: "," after: "}" )+ . // 1..* We could also specify the desired (GenVoca) implementation: Company = ( Employee before: "{" between: "," after: "}" implementation AVL tree )+ . -- Karl