AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

additional visibility restriction for variables?

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> comp.lang.java.developer
View previous topic :: View next topic  
Author Message
Mike Kamermans
Guest





PostPosted: Mon Feb 26, 2007 6:46 pm    Post subject: additional visibility restriction for variables? Reply with quote



A good day to all,

I was looking at the visibility levels for variables in JAVA, and
realised that the current approach to variable visibility is incomplete:
while an object oriented programming langauge, the visibility issue has
been defined from a class oriented perspective. While class definition is
an aspect of object definition, it's not the whole story, leading me to
conclude that a proper object-level visibility definition is missing.

How much animo would there be for a fourth visibility marker that marks a
variable as accessible by "this" object only, rather than objects that
share the same class as "this"? It would basically lead to the following
"hierarchy":

public - full visibility
protected - visible to any object being or extending "this" class type.
private - visible to any object being of "this" class type
restricted - visible only to the object in which it is defined

I ran across this when I was making copy constructors and realised that
if I'm really programming object oriented I should not be able to
directly access variables from a sibling object. From a design point of
view it should not be possible for any object to mess with the internals
of another object if these internals are to be truly considered
"private" in the linguistic sense of the word.

I picked the word "restricted" mostly because "owned" seemed an odd word
to use (especially given its meaning in the coder community), but any
word that in some way implicates object-level visibility, rather than
class-level visibility, would do.

Thoughts anyone?

Sincerely,

Mike Kamermans
(Programming for the University of Amsterdam)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> comp.lang.java.developer All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.