Re: [Modeling-users] Re: attaching information to a relation
Status: Abandoned
Brought to you by:
sbigaret
From: Mario R. <ma...@ru...> - 2003-08-10 10:11:23
|
On Samedi, ao=FB 9, 2003, at 14:36, Sebastien Bigaret wrote: > I wrote: >> The problem is that you were probably misled here by the names: since >> you read 'typed_assocs' and 'user', you tend to think that=20 >> associations >> are resp. to-many and to-one, and since the cardinalities are = implicit >> here, that makes it harder to see the problem. In fact, >> >> Association('User','TypedAssoc', >> relations=3D['typed_assocs','user'], >> delete=3D['cascade','nullify'], >> keys=3D['id','FK_User_id'] >> >> is equivalent to (see Association's defaults): >> >> Association('User','TypedAssoc', >> relations=3D['typed_assocs','user'], >> multiplicity=3D[ [0,1], [0,None] ], >> delete=3D['cascade','nullify'], >> keys=3D['id','FK_User_id'] >> >> and this version makes the pb appears clearly, doesn't it? ;) > > Now I really wonder if this was a so good idea to allow the=20 > multiplicity > to be implicit. If you remember the discussion on this topic, we made=20= > it > implicit becauser it allows a more concise declarations of=20 > associations. > However, this obviously lead, leads (and will lead) to problems, just > because we human-beings interpret things a lot more than machines do = :) > > It may be really better to make the multiplicity explicit in > associations (so that it is required in each declaration of > association), and allow it to be either E1 <<---> E2 (the only > possible case for now) or E1 <--->> E1. > > What do you think, all? Thanks for all the replies and fixes... To answer to this issue - well, I certainly fell into this trap (but I am particularly forgetful ;). Anyhow, even if I generally prefer=20 clarify and explicitness in code, i feel that in this case it is still better=20 not to require that "multiplicity" be stated on each assoc, as it risks to=20= quickly become "noise" -- my feeling is that copy-pasting the same line all over the place will anyhow render that line invisible quite quickly, so if we change it once every 20 occurances or so, we would never notice the one that is different, thus it will actually be better for the=20 non-deviant lines not to be there, as things would be thus made clearer. I would prefer a systematic practice of stating all the defaults at the=20= top of each model file, even those that are not different form the defaults set in PyModel.py. Each Assoc and other constructs will then only use statements that differ from these defaults. Thus in this case, we will add to defaults section, at top of each model: Association.defaults['multiplicity']=3D[ [0,1], [0,None] ] Any opinion from the others? On a related note, would we want a "collection" of models to share the same defaults? Can we make the (custom) declarations of these defaults common to several models? Cheers, mario |