Re: Trouble with Java concepts
From: Gary Labowitz (glabowitz_at_comcast.net)
Date: 07/04/04
- Next message: julian maisano: "RE: frozen application"
- Previous message: Roedy Green: "Experiments with speech to text"
- Maybe in reply to: Michael Borgwardt: "Re: Trouble with Java concepts"
- Next in thread: Steve Horsley: "Re: Trouble with Java concepts"
- Reply: Steve Horsley: "Re: Trouble with Java concepts"
- Reply: Roedy Green: "Re: Trouble with Java concepts"
- Reply: Roedy Green: "Re: Trouble with Java concepts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 4 Jul 2004 02:41:17 -0400
"Steve Horsley" <shoot@the.moon> wrote in message
news:cbuv8i$tpu$1@news.freedom2surf.net...
> Roedy Green wrote:
> > On Tue, 29 Jun 2004 16:19:07 -0700, "P.Hill"
> > <goodhill.REMOVE@xmissionREMOVE.com> wrote or quoted :
<snip>
> I would try to explain to an incoming C/C++ programmer that passing
objects
> is functionally identical to passing pointers in C.
And at that point you would be wrong. Virtually everything you say beyond
that point is also wrong. You are starting with a nonsense concept of
"passing objects" in Java and go astray from there.
Unlike C++, Java does not pass objects. It passes variables. Period. This is
a change in mindset which causes some C++ programmers to think of Java as
"flawed" in some way. Perhaps some Java programmers think of C++ as "flawed"
in the opposite direction. The actually state of affairs is that they are
two different languages (just as C and C++ are) and cannot be thought of in
the same mindset.
I am amused/bemused/frustrated at one time or another trying to teach these
concepts in class and grow weary of arguing with some VB-student about
passing conventions in Java. The only saving grace is to be precise in the
programming language you are using and apply consistent terminology
regardless of which language one is using.
For example, you say
"I would try to explain to an incoming C/C++ programmer that passing objects
is functionally identical to passing pointers in C. Except that since the
use of pointers is implicit (you cannot have an Object, only a reference)
there is no need for the java syntax to constantly mention the fact that the
reference is being used. Thus, you could pretty-much convert java to C by
replacing "." with "->" and putting a "*" before all object (i.e. non-
primitive) variable definitions.
All java objects are on the heap."
This is a hodge-podge of terminology that will lead to a partial
understanding of what is going on, mixes up what a pointer is and isn't,
uses the term "object" in various ways, and drags in operators that don't
exist in one language and have multiple (context sensitive) meanings in the
other. The end result is a statement like
"All java objects are on the heap." which isn't strictly true either (unless
you consider the literal pool as part of the heap, another misnomer).
I prefer the straighter path of defining the terms and using them
consistently. Unfortunately, this takes more space than we are willing to
use in usenet postings, although there have been many and eventually they
all come to the same conclusion; namely, it ain't easy.
-- Gary
- Next message: julian maisano: "RE: frozen application"
- Previous message: Roedy Green: "Experiments with speech to text"
- Maybe in reply to: Michael Borgwardt: "Re: Trouble with Java concepts"
- Next in thread: Steve Horsley: "Re: Trouble with Java concepts"
- Reply: Steve Horsley: "Re: Trouble with Java concepts"
- Reply: Roedy Green: "Re: Trouble with Java concepts"
- Reply: Roedy Green: "Re: Trouble with Java concepts"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|