IDEA: Nested Packages in Java

R

Roedy Green


I think all you are saying is that you want to treat hierarchical
package names as being related by the hierarchical structure rather
than treated as totally independent as now.

You could do it so that leaves can see branches. I don't think you
should allow branches to see leaves. So basically you are relaxing
the package scope to allow subpackages to view their mother packages
as if they were directly part of them.

..
 
T

Tim Tyler

Davin Pearson said:
I have written an article explaining a
flaw in the design of Java packages
and a design pattern that gets
around this limitation...

Click on the following link to read my article:

http://www.geocities.com/davinpearson/research/2005/npij.html

So what do all the Java programmers out there
think of my proposal...

One of the last times we discussed Java's fake package heirarchy,
(on the "more granularity in class scoping" thread here back in 2003)
I doubted whether it would ever happen for Java.

That was a while ago now - and usually change gets more difficult
as you age.

The whole idea of packages and classes being different seems tied
in with Java's convention of mapping classes to files and packages
to directories.

However, it's a bit of a silly distinction from just about any other
perspective.

The result is two ways of making objects nest within each other -
when all that is really needed is one way.

IMO, future languages should not inherit Java's package/class split.

Instead they should only have objects - and they should have
much more flexible permission modifiers, to allow or restrict access
to ancestors, offspring, siblings and perhaps other kin and named
friends.
 
I

iamfractal

Davin Pearson skrev:
I have written an article explaining a
flaw in the design of Java packages
and a design pattern that gets
around this limitation...

Click on the following link to read my article:

http://www.geocities.com/davinpearson/research/2005/npij.html

So what do all the Java programmers out there
think of my proposal...

Hi,

I'm still working through the code example, but on first reading, I
can't help but notice the quote: "Importantly, we are looking at
package visibility applied to fields (methods and properties) but not
to classes."

Why not examine class visibility similarly? Then Java could be, " ...
re-engineered so that it no longer has this limitation," on
class-level, either.

For what it's worth, and precisely because of the containment
hierarchy, I think alpha.beta classes should be able to see alpha
classes, but not the other way round.

See: www.EdmundKirwan.com/servlet/fractal/frac-page50.html

..ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top