Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (306)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Renderer - information hiding  (Read 1130 times)
0 Members and 1 Guest are viewing this topic.
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Posted 2006-10-28 12:12:39 »

why do these :
1  
2  
3  
    public static final int MAX_SHADER_TYPES = 30;
    public static final int MAX_SHADER_STATES = 1000;
    public static final int MAX_ATOM_TYPES = 20;


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

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #1 - Posted 2006-10-28 15:34:26 »

why do these :
1  
2  
3  
    public static final int MAX_SHADER_TYPES = 30;
    public static final int MAX_SHADER_STATES = 1000;
    public static final int MAX_ATOM_TYPES = 20;


1  
2  
    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
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #2 - Posted 2006-10-28 15:37:27 »

Hi,

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

Yuri

Yuri Vl. Gushchin
JProof Group
Games published by our own members! Check 'em out!
Try the Free Demo of Droid Assault
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #3 - Posted 2006-10-28 15:49:21 »

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

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
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
Jesse_Attard (13 views)
2013-06-18 22:03:02

HeroesGraveDev (57 views)
2013-06-15 23:35:23

Vermeer (57 views)
2013-06-14 20:08:06

davedes (55 views)
2013-06-14 16:03:55

alaslipknot (50 views)
2013-06-13 07:56:31

Roquen (71 views)
2013-06-12 04:12:32

alaslipknot (56 views)
2013-06-10 19:30:18

HeroesGraveDev (73 views)
2013-06-09 04:36:03

alaslipknot (60 views)
2013-06-09 03:40:19

CodeHead (60 views)
2013-06-09 02:55:41
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!