[josm-dev] Problem with referrers

Frederik Ramm frederik at remote.org
Mon Oct 5 19:41:52 BST 2009


Hi,

Jiri Klement wrote:
> OsmPrimitive is no longer just a storage for osm data. It has (will
> have) methods that will automatically update referrers, spatial index
> and other things. We need another class that will just hold data -
> that's what PrimitivePrototype is for.

Is the "traditional" setup not something like this: You have a model 
class which keeps the data, and then you have a controller class which 
performs all sorts of stuff on the models? The controller would not even 
be instantiated multiple times, or at least not normally. (I'm not 
saying we should do what everyone else does, au contraire! Just making 
sure we don't accidentally do what others do but use different names for 
it which would cause confusion.)

At the moment it sounds to me almost as if you are making a case for 
reducing the node to its bare data storage capacity, and transfer 
functionality to a controller class.

Another thing that may be worth considering at this time is whether you 
might want to separate out the display stuff. I freely admit that I 
haven't been paying much attention over the last half year of JOSM 
development and I may be talking complete rubbish here, but a while ago 
I had the plan to remove those items in the primitive that were only 
used for displaying (such as whether the node was considered 
"interesting" or whether it was on-screen or not) and put them in some 
kind of view class that would accompany all primitives. I don't know if 
this still makes sense with your ideas and with the recent changes by 
Dirk and Karl but maybe it is worth pursuing, since you seem to want to 
completely change the usage of primitives anyway.

> Having "backup copy dataset" that will discard all event received from
> it's primitives is another possibility. But I think it's cleaner to
> have separated classes - one as simple data holder and another one as
> part of real dataset with EastNorth coordinates, MapPaint fields etc.

There we go, all that stuff would have been in my "View" class - but 
some of your other ideas like the back references (don't relations 
already have them? I surely did code them but I can't remember, maybe 
Imi threw them out at the time) don't really fall into the realm of a view.

> I think almost everywhere in JOSM are primitives used as
> PrimitiveContext class. Most places in JOSM expect to update (future)
> spacial index when Node coordinates are changed. So I think it's a bit
> late for changing names.

Don't underestimate the amount of confusion that can be created by using 
bad names. At the moment it looks as if there's only three people 
working on the code anyway, but using misleading names will scare off 
people in the future. So if something is not a prototype, don't call it 
a prototype or you're depriving yourself of programming help in the 
future ;-)

Bye
Frederik





More information about the josm-dev mailing list