Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (553)
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 1360 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 10: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 13: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 13: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!
Legends of Yore - The Casual Retro Roguelike
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #3 - Posted 2006-10-28 13: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.

 

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

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (32 views)
2014-08-08 02:01:56

Norakomi (42 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!