[josm-dev] Jumbo Patch

Frederik Ramm frederik at remote.org
Sun Dec 16 11:01:48 GMT 2007


Hi,

> What do you mean by "code bloat" anyway? It's not like you need to _read_ 
> this code. It just has to be there.

Why?

The problem is that if I am new to the code then I have to read it
because somewhere inside all those accessors that don't do anything
there might be the one accessor which actually triggers an action -
well hidden among lots of, well, bloat.

I do not consider this "readability". In fact, those accessors that
don't do anything seem to me like decoys, trying to keep you from
finding the one that does ;-)

> Well, it could, but in Java it doesn't, and that's just the way things are. 
> If writing them is boring, I'm sure Brent or Petr will happily write them 
> for you (or use their IDEs :-).

The problem is reading it, not writing it. The argument that the IDE
can auto-generate the stuff is an insult to the human beings having to
read it (maybe if I had an IDE that would automatically detect and
hide those accessors that don't do any work...).

Maybe all of you are working with such an IDE that I just don't know
about, and that's the reason I get all upset about unneccessary code
while you don't even see it?

> Over-engineering is not about added lines of code, it's about added code 
> complexity. Getters and setters don't add _complexity_ - like you said, 
> they are entirely trivial.

If you try and find your way through other people's code and you find
a

blah.nodeList.clear();

then you know what happens without looking at blah's source code. If,
instead, you have a 

blah.clearNodeList();

then, even if "clearNodeList" is a very trivial "nodeList.clear()",
you still have to look inside Blah to know this. So you have made the
whole thing more complex.

I know that in an ideal world the inside workings of Blah would be of
no concern to you because everything was properly documented but I am
quite sure that if JOSM ever reaches that point it will be dead,
unable to keep up with the ever-evolving project it is attached to.

I am saying all this out of bitter experience working with "properly
structured" Java code written by others. I am familiar enough with
JOSM that "going private" near everywhere would not cause trouble for
me, I just think that we'd actually make it *harder* for newcomers.

The same is true for Imi's often-disputed liberal use of global static
entities. I am sure that the same people telling me off for not being
jubilant about private members would also say that statics are mostly
evil. But they make many things really easy, and that's a good thing
if you want people to participate, is it not?

Bye
Frederik

-- 
Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00.09' E008°23.33'





More information about the josm-dev mailing list