Re: programming concepts > specific languages
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Thu, 03 Nov 2005 15:37:48 GMT
"vishnuvyas" <vishnuvyas@xxxxxxxxx> wrote in message
news:1130969976.887665.187530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Take for example C, where you have pointers, that gives
> you immense control over the code you are writing and thats a concept
> you have to learn (things like indirection), however thats again C
> specific. You probably would never have to actually learn about
> pointers if you are just doing java all along.
Java has consistent, but non-intuitive, rules involving passing by
value/passing by reference. A lot of beginning Java programmers don't
understand why when they pass primitive types (int, float, char, etc.) they
seem to be passed by values, and yet when they pass objects, they seem to be
passed by reference.
Actually, everything is being passed by value; it's just that when
you're "passing an object", you're actually passing a reference to that
object (and you're passing that reference by value).
I find that it helps a lot to understand the underlying memory model of
a typical RAM machine to "get" Java's passing rules. You don't need to know
much, but you do need a concept of something like a giant array representing
RAM (i.e. each slot has an address), and that some locations in RAM don't
actually contain the desired value, but instead contain the address of the
desired value. An introductory course to machine architectures and "high
level" assembly would probably help a lot.
So I think it may actually be very helpful to learn about pointers if
you're a Java programmer.
- Oliver
.
- Follow-Ups:
- Re: programming concepts > specific languages
- From: Gerry Quinn
- Re: programming concepts > specific languages
- References:
- programming concepts > specific languages
- From: ryanoasis
- programming concepts > specific languages
- Prev by Date: Re: please check my homework
- Next by Date: Re: Java or C++?
- Previous by thread: Re: programming concepts > specific languages
- Next by thread: Re: programming concepts > specific languages
- Index(es):
Relevant Pages
|