some personal rambling on java the lang

X

Xah Lee

This month, my Java tutorial become quite popular. Here's the most
popular pages, with number of page views in the past 30 days.

The “static†Keyword In Java 5.803k
Java Tutorial: “this†Keyword 5.589k
Interface in Java 4.627k
Java Tutorial: The “extend†Keyword 4.402k
Java's Access Specifiers 2.935k
Java Tutorial: Arrays 2.673k
Java Tutorial: Defining a Function 2.596k
The “abstract†Keyword In Java 2.316k
Xah's Java Tutorial 2.168k

There are several links to them from stackoverflow.com.

Java is the most inane language. I did Java for half a year in a day
job in 2000. At the time, i was not really sure what i was doing.
(this is a typical situation when coding in a day job on someone
else's project.) Then, in 2005 i studied Java in some detail, and
wrote my tutorial. However, i actually don't code Java, am not good at
it, and will never code anything in Java. (am rather sad that Google
choose it as its main lang. (but, it's still much better than C or C+
+.))

Also, of all big software companies, i HATE Sun Microsystems with
passion. It is the company with the most despicable marketing ****,
and loves to create random meaningless jargons and abuse established
terms. For detail on the jargon part, see:

* Jargons of Info Tech Industry
* Interface in Java
* What are OOP's Jargons and Complexities

Of all the 2 thousand tech tutorials and essays i wrote about
computing in the past 10 years, the “What are OOP's Jargons and
Complexities†one actually among the top 5 i consider most
significant. Am proud of it.

for links, see:
http://xahlee.blogspot.com/2010/10/inanities-of-java.html

Xah ∑ http://xahlee.org/ ☄
 
R

RedGrittyBrick

This month, my Lisp tutorial become quite popular. ....
Lisp is the most inane language. ....
However, i actually don't code Lisp, am not good at it,


For Java to succeed, surely it is not necessary to sow disinformation
and confusion amongst Lisp newbies?
 
M

Mayeul

This month, my Java tutorial become quite popular. Here's the most
popular pages, with number of page views in the past 30 days.

The “static†Keyword In Java 5.803k
Java Tutorial: “this†Keyword 5.589k
Interface in Java 4.627k
Java Tutorial: The “extend†Keyword 4.402k
Java's Access Specifiers 2.935k
Java Tutorial: Arrays 2.673k
Java Tutorial: Defining a Function 2.596k
The “abstract†Keyword In Java 2.316k
Xah's Java Tutorial 2.168k

There are several links to them from stackoverflow.com.

[...]
>
for links, see:
http://xahlee.blogspot.com/2010/10/inanities-of-java.html

Out of sheer curiosity I checked a few links.

Your problem with Java is that it is an OOP language, and you hate OOP.
OOP indeed isn't a one-size-fits-all tool. If you are unconfortable with
it or if it just simply does not serve your purpose it is quite okay to
leave it alone.

Case closed.
 
N

namekuseijin

Out of sheer curiosity I checked a few links.

Your problem with Java is that it is an OOP language, and you hate OOP.

that can't be right. OOP feels so friggin' sweet in an apt language
such as Ruby (which is even far more OO than java)...
 
J

Joshua Maurice

Also, of all big software companies, i HATE Sun Microsystems with
passion. It is the company with the most despicable marketing ****,
and loves to create random meaningless jargons and abuse established
terms.

I just wanted to pipe in because I have a huge pet peeve on this. Java
has these things which Java calls "references". In any other context
besides Java, such things would be called pointers. Java has pointers
and does not have references using the technical language agnostic
terms. It's highly frustrating and annoying that Java decided to reuse
an existing concept and existing name, but the name formerly described
a related but very distinct concept. The only thing they did was
remove all forms of pointer arithmetic, but it's still pointers.

Related: Java only has pass by value - its functions pass its pointers
(which it calls references) by value.

So, now I'm stuck calling them references in most situations when
they're most clearly not, all because that's what the language
standard calls them.
 
T

Tom Anderson

I just wanted to pipe in because I have a huge pet peeve on this. Java
has these things which Java calls "references". In any other context
besides Java, such things would be called pointers. Java has pointers
and does not have references using the technical language agnostic
terms. It's highly frustrating and annoying that Java decided to reuse
an existing concept and existing name, but the name formerly described
a related but very distinct concept. The only thing they did was
remove all forms of pointer arithmetic, but it's still pointers.

Related: Java only has pass by value - its functions pass its pointers
(which it calls references) by value.

So, now I'm stuck calling them references in most situations when
they're most clearly not, all because that's what the language standard
calls them.

Joshua, OF COURSE java doesn't have pointers. How else do you explain the
fact that we get NullPointerExceptions all over our code? It's the
complete lack of pointers!

tom
 
P

projectmoon

Joshua Maurice said:
Related: Java only has pass by value - its functions pass its pointers
(which it calls references) by value.

Do you mean Java only has pass by copy? All parameters to methods In
Java are copied, whether they be primitives or object pointers. For
pointers, the method receives a new pointer to the same object.

That is why you can do things like setting an object parameter to a new
instance and it won't affect the reference that was passed in from
outside method scope.
 
P

projectmoon

And after i sent that, I realized that's exactly what you're saying...
So just ignore my little essay in my first reply...
 
A

Arne Vajhøj

Do you mean Java only has pass by copy? All parameters to methods In
Java are copied, whether they be primitives or object pointers. For
pointers, the method receives a new pointer to the same object.

That is why you can do things like setting an object parameter to a new
instance and it won't affect the reference that was passed in from
outside method scope.

2 x yes

Arne
 
A

Arne Vajhøj

The term "pointer" does have a PR problem - they have caused any number
of bugs in apps written in C and its relatives. Such bugs are typically
the result of careless programming - like all bugs, really - but pointers
got a reputation as a "dangerous" feature nonetheless. So I can under-
stand why Sun wanted to avoid using the dreaded "P word." But Joshua is
right - they chose the wrong replacement for it.

One could argue that constructs that make small mistakes result in
serious problem to be a very good definition of dangerous when
it comes to programming languages.

Arne
 
A

Arne Vajhøj

I just wanted to pipe in because I have a huge pet peeve on this. Java
has these things which Java calls "references". In any other context
besides Java, such things would be called pointers.

Wrong.

C# use the term reference as well.
Java has pointers
and does not have references using the technical language agnostic
terms. It's highly frustrating and annoying that Java decided to reuse
an existing concept and existing name, but the name formerly described
a related but very distinct concept.

http://en.wikipedia.org/wiki/Reference_(computer_science)

"For this reason, a reference is often called a pointer or address"
So, now I'm stuck calling them references in most situations when
they're most clearly not, all because that's what the language
standard calls them.

You should not expect all language to use C++ terminology.

Arne
 
X

Xah Lee

that can't be right.  OOP feels so friggin' sweet in an apt language
such as Ruby (which is even far more OO than java)...

Yes, that's my feelings as well. I don't think i like OOP at all, but
as example, i don't have a problem using it in perl, javascript. And
i know it's in python and ruby too. Even i hardly ever use them. I can
understand that oop is quite useful in some programing tasks, and or
that it is a alternative valid way of modeling software other than
functional programing.

i think, if i were to summarize my hatred of java by single sentence,
it would be more to it being a low level, or system lang. (in the same
way, i hate C, C++, even though i don't even have a working knowledge
of these) Sun Micro's tremendouly marketing shit piled onto Java just
made my hatred of java far far worse.

Xah ∑ http://xahlee.org/ ☄
 
X

Xah Lee

I just wanted to pipe in because I have a huge pet peeve on this. Java
has these things which Java calls "references". In any other context
besides Java, such things would be called pointers. Java has pointers
and does not have references using the technical language agnostic
terms. It's highly frustrating and annoying that Java decided to reuse
an existing concept and existing name, but the name formerly described
a related but very distinct concept. The only thing they did was
remove all forms of pointer arithmetic, but it's still pointers.

Related: Java only has pass by value - its functions pass its pointers
(which it calls references) by value.

So, now I'm stuck calling them references in most situations when
they're most clearly not, all because that's what the language
standard calls them.

btw, what's the tech diff between pointer and ref? is the diff of term
mostly due to just C++ using them both and distinguish them?

i scan'd Wikipedia
http://en.wikipedia.org/wiki/Pointer_(computing)
http://en.wikipedia.org/wiki/Reference_(computer_science)

but isn't much helpful.

--------------------------------------------

in any case, this is not the type of jargon abuse i hated about Sun
Micro though. The “pointer†and “reference†type of terminologies are
i think oldish classical comp sci of 1960 or 70s. Lots of those term's
meaning changes over time. e.g. data structure once meant low level
stuff as in C's struct, or linked list, at the hardware level, but
today, people don't even know what's a “structâ€. To most programers
today, “data structure†more means dimention or shape of nested list/
hash etc.

similiar, the term “listâ€, means entirely different things in
different langs. Classically, in C era, they usually always mean
linked list at the level of what we'd say in compiler implementation.
But today, most lang are high level (or called scripting langs), and
“list†simply means what java calls Collection interface.

Xah ∑ http://xahlee.org/ ☄
 
J

Joshua Maurice

Wrong.

C# use the term reference as well.


http://en.wikipedia.org/wiki/Reference_(computer_science)

"For this reason, a reference is often called a pointer or address"


You should not expect all language to use C++ terminology.

Arne

First, C# is widely known to be a Microsoft "copy" of Java, so it is
no surprise that it copies the Java terminology, so that example isn't
particularly illuminating example.

Second, do I really have to argue when Java throws
'NullPointerException's?

Third, you're quoting wikipedia, not the most reliable of sources.
Admittingly, I also went there looking for sources.

Let me put it another way. At the very least, I can claim that the
definitions of "pointer" and "reference" were quite clear in the
context of the extended family of C-like languages before Java. It is
my understanding that C effectively defined the term "pointer". Later C
++ defined an additional concept which it called "references".

Java is a member of the extended family of C-like languages.
Specifically, Java was designed as a "better" C++, itself a derivation
of C. It shares much of the same syntax and semantics, and the
designers of Java had C++ in mind as the starting point for their new
language. As it is clearly based off of C++ and C, and shares much of
the same syntax, semantics, and nomenclature, it is a horrible
disservice that it should take two pre-existing names of terms and so
conflate and confuse them.

So yes, I expect that when Java takes from C++, it should use the C++
terminology. At the very least, it should not have taken from C++ two
very related but distinct ideas, taken the semantics of one but the
name of the other. It just confuses people. Yes it's not that
confusing, and yes it's not that bad - that's why I called it a pet
peeve. It's still annoying.

I also suspect as Sherm Pendley does else-thread that this decision
was taken because "pointer" was a dirty word with regards to their
design goals for Java, but that doesn't excuse them on this.
 
G

Gene

I just wanted to pipe in because I have a huge pet peeve on this. Java
has these things which Java calls "references". In any other context
besides Java, such things would be called pointers. Java has pointers
and does not have references using the technical language agnostic
terms. It's highly frustrating and annoying that Java decided to reuse
an existing concept and existing name, but the name formerly described
a related but very distinct concept. The only thing they did was
remove all forms of pointer arithmetic, but it's still pointers.

Related: Java only has pass by value - its functions pass its pointers
(which it calls references) by value.

So, now I'm stuck calling them references in most situations when
they're most clearly not, all because that's what the language
standard calls them.

The term "reference" has been used to describe Lisp and similar
languages since the 60's. References aren't the same as pointers.
Pointers must have a dereferencing operator to access elements. In C
these are prefix * and the abbreviation ->, as in p->a, which is short
for (*p).a. Pointers and pointer arithmetic are not connected at the
hip. Pascal and Ada have pointers but no pointer arithmetic.
References are present along with pointers and values in C++ (which
predates Java, I believe). Many languages include both references and
values: Javascript, Perl, Python, and Lisp are a few. All this is to
say that your anger is probably misplaced. References really aren't
pointers. Java wasn't first or last to use the term. The
NullPointerException is not too surprising if you consider that JVM's
are normally implemented in C or C++.
 
T

TheFlyingDutchman

Related: Java only has pass by value - its functions pass its pointers
(which it calls references) by value.

I believe that is the only way to pass parameters in Python - by
"value of a reference".
So, now I'm stuck calling them references in most situations when
they're most clearly not, all because that's what the language
standard calls them.

You can't increment/decrement them and you can't assign an arbitrary
memory location (including invalid memory locations) as you can C/C++
pointers. They can only "point" to controlled areas of memory where an
object of a specific type exists. They aren't the same as C/C++
pointers which I think is why they didn't call them pointers. But I
have no idea why they used NullPointerException instead of
NullReferenceException.
 
J

Joshua Cranmer

btw, what's the tech diff between pointer and ref? is the diff of term
mostly due to just C++ using them both and distinguish them?

A pointer is a datatype whose value is the address of some other object
(or possibly itself, if you really want to blow your mind). References,
can have a few different meanings, but the general gist of references
(think `pass by reference') is that it is a source-level alias for a
variable. Hence why C++ references are lvalues.

What Java calls object references is perhaps most well-described as
pointers, but pointers have a somewhat bad rap do to the memory safety
problems inherent in pointer arithmetic.
 
J

Jukka Lahtinen

Xah Lee said:
wrote my tutorial. However, i actually don't code Java, am not good at
it, and will never code anything in Java. (am rather sad that Google

Hmm.. a tutorial written by somebody who is not good at the thing the
tutorial is about and doesn't like it.
Somehow this sounds funny to me.
Doesn't make it sound like a tutorial to be recommended.

Disclaimer: I haven't looked at the tutorial itself, these are just
thoughts that came up after reading your posting.
 
G

George Neuner

First, C# is widely known to be a Microsoft "copy" of Java,
no surprise that it copies the Java terminology

No ... C# is widely misperceived (mainly by Java users) to be a
derivative of Java. However, beyond minor syntactic differences lie
much greater semantic differences. C# and Java are, in fact, quite
different languages that only superficially look similar.

OTOH, J# definitely is a virtual clone of Java with nearly identical
syntax and semantics.

What really makes C# most similar to Java is that it is yet another
attempt at dumbing down C++ for use by - to put it charitably - those
who probably should not be programming in the first place.

Moreover, the .NET CLR was not a copy of the JVM ... it evolved from a
fusion of COM with the managed environments of Visual Basic and Foxpro
(all of which predate Java). Microsoft's IL byte code evolved from
the Visual Basic pcode engine which itself evolved from prior versions
going back at least to 1985 and Microsoft C 3.0.
[I can't locate a cite for the introduction of the M$ pcode compiler,
but I know from personal experience with C 3.0 in 1987 that some
version of it was included. What I remember most about it was that
there was absolutely no floating point support.]

There is little doubt that there was cross pollination of CLR from the
MSJVM which was an incompatibly extended 1.0 JVM that Sun sued to
exterminate. But feature and implementation wise, CLR and JVM were
going in parallel but different paths almost from the start.
[Similarities between the JDK and .NET programming frameworks are for
a different discussion.]
Let me put it another way. At the very least, I can claim that the
definitions of "pointer" and "reference" were quite clear in the
context of the extended family of C-like languages before Java. It is
my understanding that C effectively defined the term "pointer".
Later C++ defined an additional concept which it called "references".

No, Algol 68 introduced both the concept of an address container
variable of and by-address parameters, and the distinction between
maybe-NIL (NULL) and never-NIL usages.

Algol called them all "references" and used the keyword "REF" to
designate both address containers and by-address parameters. C's
pointers and Java's references are semantically equivalent to Algol's
REF variables ... C++ references combine semantics of both Algol's REF
variables and REF parameters.

AFAIK, C introduced the term "pointer" into popular usage and also
introduced the explicit dereference operator ... Algol REF types were
implicitly derefenced in most common uses - they required a type cast
for uncommon uses. (Algol also introduced type casting as we know it
in C.)

[Algol 60 had a POINTER keyword ... at least the Burroughs
implementation did ... but I don't recall specifics of its use. Algol
68 had only REF and mainly is responsible for pointer and reference
semantic as we recognize them today.
The B language from which C evolved also had a dereference operator
but no identifiable pointer type - data in B was just "bits" collected
into "words".]

Java is a member of the extended family of C-like languages.
Specifically, Java was designed as a "better" C++, itself a derivation
of C. It shares much of the same syntax and semantics, and the
designers of Java had C++ in mind as the starting point for their new
language.

Not really. Gosling wanted to use a familiar syntax (for some notion
of "familiar"), but semantically he wanted to move away from C++ ...
he has written at length about his motivations for the differences in
object models and the elimination of pure procedural features.

C++ allows OOP whereas Java requires it ... it is not possible to
write Java code that does not somehow use objects. In contrast, it is
perfectly possible to write C++ code that uses no objects at all.
[And yes, I am aware that structures *are* objects in C++.]

Some people claim that C++ code that avoids objects is just C code -
sometimes they qualify it as "better C". But C++ is not a C superset.
C overlaps the procedural subset of C++ to a very large extent (about
99%), but each has semantics which are not supported by the other.
This is true regardless of which standard you choose for either
language. Because of this, I maintain that one can write purely
procedural code which is uniquely C++.

As it is clearly based off of C++ and C, and shares much of
the same syntax, semantics, and nomenclature, it is a horrible
disservice that it should take two pre-existing names of terms and so
conflate and confuse them.

There is some semantic overlap between Java objects and C++ objects,
but much less than people logically might assume given the similarity
in syntax.

So yes, I expect that when Java takes from C++, it should use the C++
terminology. At the very least, it should not have taken from C++ two
very related but distinct ideas, taken the semantics of one but the
name of the other. It just confuses people. Yes it's not that
confusing, and yes it's not that bad - that's why I called it a pet
peeve. It's still annoying.

I applaud any attempt toward establishing a canon of terminology. I
despise authors who use acronyms without first defining them, who give
new meaning to an existing acronym (within the same field) and who
invent new acronyms for things that already have acronyms - all common
occurrences in CS related papers which are not so common in papers
from other fields.

I also suspect as Sherm Pendley does else-thread that this decision
was taken because "pointer" was a dirty word with regards to their
design goals for Java, but that doesn't excuse them on this.

I suspect you are correct, but offer this pointer to the reference
discussion above :cool:

George
 
M

Mike Schilling

George Neuner said:
No ... C# is widely misperceived (mainly by Java users) to be a
derivative of Java. However, beyond minor syntactic differences lie
much greater semantic differences. C# and Java are, in fact, quite
different languages that only superficially look similar.

C# has evolved to become a much bigger language than Java, and significantly
different, e.g. the two took very different approaches to generics. But C#
1.0 was very much Java with slightly different syntax, and a few added bits
of syntactic sugar (events, delegates, stc.)
 

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,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top