|
Authored by: BitOBear on Sunday, May 06 2012 @ 07:12 AM EDT |
Sorry to call you wrong like its a hobby.
The point I was trying to make is that the -box- (the package) doesn't give
"objects in it" -any- properties at all.
The -packages- do nothing for the classes they define.
Nothing.
Nothing.
and still....
Nothing.
Classes inherit from Classes. Classes get nothing from the the packages. And
packages do not "inherit" from packages. java.lang.package is a
sub-directory of java.lang. PERIOD.
If it write
package com.whiterc;
class stuff {
public static int some_number;
};
The -box- "com.whiterc" did -nothing- for the integer
"some_number" except give it a location
"com.whiterc.stuff.some_number".
It's in a box.
package com.whiterc.project1 has nothing in common with package
com.whiterc.project2 and so would want -nothing from project com.whiterc.
They will end up in directories /my/class/path/com/whiterc/{project1,project2}
on my hard drive, but that's it.
Seriously, nothing you have read in context of this trial and the word
"package" is correct.
Go follow that link in my post to java.lang.package and show me the java method
that gives one package the properties of another.
Read This: http://www.artima.com/objectsandjava/webuscript/PackagesAccess1.html
There is -ONE- exception to this "rule of nothing" and it has nothing
to do with "inheritance".
The box that is the package is a barrier of sorts. The "protected"
things inside a box can be accessed by the other things inside the same box but
not from things inside other boxes. This is the guy in the shipping
container" being able to, say, punch another guy but only if that other guy
is in the same container, otherwise there is all this steel in the way.
This semantic barrier to access exists -only- to prevent -accidental- misuse.
If there is a protected member of java.lang.thingy that I want to access I can
just add a proxy class by typing:
package java.lang.thingy; class my_proxy { public static do_very_bad_thing();
}.
When I compile that with javac, a directory will appear in
/my/class/path/java/lang/thingy with the .class file. That thing in
/my/class/path/java/lang can get to /distributed/java/runtime/java/lang and do
bad things because -I- -PUT- -IT- -IN- -THAT- -BOX- where it could do mischief.
But my_proxy didn't suddenly get any magical methods from being in java.lang.
At least nothing that wouldn't be given to a mouse if I put it in my box of
cookies.
[ Reply to This | Parent | # ]
|
|
Authored by: BitOBear on Sunday, May 06 2012 @ 09:44 AM EDT |
If I put an Oreo Cookie into a box marked Carrots it doesn't become a
vegetable.
When I put a class into a package it doesn't change the class at all.
---
If I put a fox in a hen-house the fox gains access to the hens but it doesn't
become a rooster.
If I put a class into a package it gains access to any "protected
classes" in the package, but if the new class isn't explicitly written to
look for and do something to those protected classes before it went in, then it
isn't suddenly going to notice them when it is there.
---
Why does peanut butter come in jars?
Because scooping up a pound of peanut butter with your hands, walking home, and
plopping it on your counter is impractical.
---
If I put a birthday cake in a box and you pour in three quarts of used motor
oil, what is the culpability of the box in the spoliation of the cake?
---
Packages in computer science are not magically different than packages in the
real world. They contain and exclude, but not with much strength and do not
stand up against deliberate mis use. They do not alter or imbue their contents
with anything. There sole purpose is convenience of reference and demarcation.
Field wide, they are optional. They don't exist at all as a feature of the C
language, but they are mandatory in Java, and optional in Perl.
Like anything they can be used well or used poorly, and they can be easily
misused or misunderstood if they are treated like magic.
Oracle's API theory, where they treat the packages as if they were real points
of demarcation, is high magic most foul.
Calling the 37 packages "37 APIs" is criminal misrepresentation. It
isn't even _provisionally_ accurate. It's like saying 14 bags of trash are the
result of exactly 14 trips to the supermarket even when one of those bags is
just full of lawn clippings and another is obviously full of junk mail. There is
-no- relationship caused by or requisite to membership in a package -except-
that someone decided to put each thing in that package for some, or no, reason
at the time it was put in.
[ Reply to This | Parent | # ]
|
|
|
|
|