[josm-dev] Spaghetti code

Stephan osm at stephans-server.de
Wed Feb 4 23:13:12 GMT 2009


Igor Shubovych wrote:
> I really do not want to abuse anybody, but ... this is spaghetti code.
> ...Almost everywhere in JOSM.


Quote from wiki (imi):
http://josm.openstreetmap.de/wiki/DevelopingPlugins

First some words about my style of accessing public variables. Most 
people find this annoying and bad coding style in Java. If this would be 
an enterprise project, where most of the code is glue code and had to 
work with objects in a generic way, I would agree with them. But as JOSM 
is not, I like to keep the classes as simple as possible, which 
includes, that I don't add standard getter/setter but make the variable 
public. Also, there are no or very few so-called singleton-factories in 
JOSM that became popular in the past years. I use to reference singleton 
objects as global statics. This is unusual but equivalent to having 
stuff like Dependency Injection or Factory Methods (except you want to 
make complex things like auto-distributing stuff as seen in some 
enterprise programs).

Most objects are accessible through the class 
org.openstreetmap.josm.Main. There are numerous entry points for various 
parts of JOSM here.




Stephan




More information about the josm-dev mailing list