[josm-dev] Jumbo Patch

Petr Nejedly Petr.Nejedly at Sun.COM
Sat Dec 15 23:56:19 GMT 2007


Frederik Ramm napsal(a):
> 3. I don't like the privatisation because it bloats the code: You have
> to implement a ton of accessors and they all just "pass through"
> stuff, only a tiny percentage actually does something different. But
> that's the Java spirit probably... 

Thats not just about the "java spirit". Correct encapsulation can save you
a lot of headaches just for few lines of code (I certainly won't call
a getter "bloat" and hotspot even inlines the code).

The fact that data primitives publicize their fields naked makes a lot
of changes difficult and mostly incompatible. Having everything private
and exported through methods properly would allow not only powerful
evolution of the API, but also implementation of many optimizations
in a transparent, painless way.

I'll certainly like to return to this topic later because of some
optimizations, but at least if the data layer had the fields private,
implementing separate view-layer caching+optimizations would be quite
simple.

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