[josm-dev] Jumbo Patch

Petr Nejedly Petr.Nejedly at Sun.COM
Sun Dec 16 21:26:15 GMT 2007


Frederik Ramm napsal(a):

> 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,
Not really. In fact you need to go figure what type blah.nodeList is.
Only once you realize it is a common, known collection, you're done,
but somebody might need to swap in a special List implementation that
keeps listeners informed about changes.


> 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.

But if you need to know where and how is the collection modified, you'll
need to find all usages of the field, recognize writes and look at all
the code around. If the field was private, all writes would have to go
through very narrow profile and you can put any needed preconditions,
postconditions, notifications of cache updated only there.

-- 
Petr "Nenik" Nejedly, NetBeans/Sun Microsystems, http://www.netbeans.org
355/113 -- Not the famous irrational number PI, but an incredible simulation!




More information about the josm-dev mailing list