Renderer - information hiding

why do these :


    public static final int MAX_SHADER_TYPES = 30;
    public static final int MAX_SHADER_STATES = 1000;
    public static final int MAX_ATOM_TYPES = 20;


    public List<NodeUpdater> nodeUpdaters = new ArrayList<NodeUpdater>();
    public Map<Billboard, TransformGroup> billboards = new Hashtable<Billboard, TransformGroup>();

have to be public ? it’s the opposite of information hiding…

Because of a Java OO flaw this is unfortunately necessary. In the OO concept “protected” means “accessable in the same package including subpackages and subclasses”, which is very important for good encapsulation (infromation hiding). Java says: “protected things are accessable only in subclasses and the very same package”.

But consider the render package as something not intended for user space at all except Renderer, Canvas3D and RenderPeerImpl(s). Maybe we could move some public fields to other classes not for user space. I’ll investigate and change that.

Marvin

Hi,

We can also use no-modifier classes, fields and methods that will be visible inside package only but not visible from outside.

Yuri

One disadvantage, that won’t bite us here, is that no-modifier methods are not visible in subclasses. I really don’t like non-modified fields or mothods, and it’s not an option here. As I sayd, I’ll consider moving these fields to another class.

Marvin