Advice on learning Java

L

Lee

I'm looking for some helpful comments on the relative merits of free (as
in beer) on line tutorials, or recommendation to good Java books
(not necesarily free books but cost is a consideration)

I'm not a beginner in the programming world in general. My first
language was FORTRAN II (yeah, yeah, we programmed by making marks in
wet clay bricks which were then baked to compile, and we dodged
dinosours and cave bears on the way to work)

I taught myself C by first reading K&R then programming a lot and
reading other peoples code. At some point someone showed me that I was
really writing Fortran in C, not idiomatic C, so I made an effort (more
code reading and some concious attention to style) to write real C.

I can do some damage in awk and perl and so on.

Lately I've not been writing in C, but I have been coding in PL/SQL
which is Oracle's proprietary procedural language.

It has "packages" which separate interface specification from
implememtation (something like Java interface objects) and also has an
exception handling system which, while not syntactically much like
Java's, seems conceptually similar to the try{}catch{} business.

I cant say I'm an expert at OO concepts or design, but I can quack
"polymorphism, data hiding, and late binding" as well as anyone else,
and I have a passing acquaintance with the idea of design patterns and
the "Gang of Four".


I'm looking first for material that can get me up to speed soonest, but
also for something that will get me into the OO world so that I dont
wind up writing C in JAva, if you know what I mean.

I find I can often decipher at a good part of an existing Java program,
but very often I recognize that I couldnt have written it, because who
knew you that there even was a "foozle" object, let alone that you had
to give it the "goosey" message to initialize the sytem.

I you knew the rules of C, but not the standard library, you'ld be "at
sea" no pun in writing a real program, so maybe there are a set of more
or less standard objects that everybody "knows" how to tickle; but since
I dont know 'em, I need a systematic introduction.

I dont need a "how to program in general" book (Or not any more than
everybody needs one actually. Amazing to see what some so called
professional programmers are churning out. Eek!)

I suppose my ideal title is "So you want to program in JAva, eh, Binky?"

i.e. dont need sermons on why data hiding is "a good thing" or a long
exposition about control structures or data types or whatever, just a
whole lot of "Here's what you need to know first, with plenty example code".


What do people here think of "Thinking in JAva" ?
What about the "Head First Java" thing?

Any favorite books? What about anti-favorites ?

Anything to particularly stay away from?
 
O

Oliver Wong

Lee said:
I'm looking for some helpful comments on the relative merits of free (as
in beer) on line tutorials, or recommendation to good Java books
(not necesarily free books but cost is a consideration)

I'm not a beginner in the programming world in general.
[Fortran, C, Awk, Perl, etc.]

Try Sun's free tutorial: http://java.sun.com/docs/books/tutorial/ The
fact that you've actually programmed before will be helpful.

If that doesn't work, post again letting us know where you got stuck,
and we'll either help you get through that part of the tutorial, and/or
recommend dead-tree books.

- Oliver
 
W

Wojtek

Lee wrote :
I'm looking for some helpful comments on the relative merits of free (as in
beer) on line tutorials, or recommendation to good Java books
(not necesarily free books but cost is a consideration)

I'm not a beginner in the programming world in general. My first language was
FORTRAN II (yeah, yeah, we programmed by making marks in wet clay bricks
which were then baked to compile, and we dodged dinosours and cave bears on
the way to work)

You had ovens? We had to wait for the sun...

I find the O'Reilly cookbook series to be helpful.
 
M

Mark Space

Lee said:
I'm looking for some helpful comments on the relative merits of free (as
in beer) on line tutorials, or recommendation to good Java books
(not necesarily free books but cost is a consideration)

Oliver's advice is good. The online tutorials are free, and immediately
available. You might as well start there.

I had a similar experience starting Java as your own. Good C
programmer, bad C++ programmer. Although I'd managed to miss actually
writing Fortran production code, and punch cards too.

Here's what worked for me:

1. Read O'Reilly's _Learning Java_. I've looked at _Head First Java_ a
couple of times as it sits on the bookstore shelf. The book seems a
little thin to me, and doesn't cover much for the number of trees it
kills. _Learning Java_ is a little harder to read but more useful in
the long run. Along with the online tutorial, Google searches and the
language reference, you can get most anything done.

Do some small projects with the command line. Make sure to attempt at
least two small projects using Swing and AWT.

2. After trying out some command line versions of your code, get
NetBeans and try it out. Java can really benefit from an IDE, unlike C
and C++ where an IDE mostly exists to obfuscate the actual build
process. The advantages of the IDE won't be fully apparent at first,
but at least learn the basics.

3. Download the Matisse plug-in for NetBeans. Matisse is a GUI builder
for Swing and AWT. Read the Matisse tutorials, and re-implement your
simple Swing and AWT projects from step one. The OO light should go on
and a sign reading "I GROK JAVA!!" should appear over your head. A lot
of questions I personally had regarding "but why go around your elbow to
get from your thumb to your little finger" about Java and the way stuff
is implement suddenly made sense when a productivity enhancing tool is
involved.

Good luck!
 
S

Stefan Ram

Lee said:
What do people here think of "Thinking in JAva" ?

Recently someone claimed that "Thinking in Java 3", 8
contained this sentence:

|If you're defining an anonymous inner class and want to use an
|object that's defined outside the anonymous inner class, the
|compiler requires that the argument reference be final, like
|the argument to dest().

Here, Eckel writes:

»object that's defined«.

Objects, however, are not "defined", they are /created/ at
run-time. Names of reference variables are being /declared/
in the source text, not "defined".

http://java.sun.com/docs/books/jls/third_edition/html/statements.html#5920

Then, he continues to write

»argument reference be final«.

This might intend to say that a reference parameter was
declared with "final". "final" is not an attribute of a,
/reference/, but of a variable.

However, this is not about /arguments/ (the reference
arguments do not have to be declared "final" here), but
about /parameters/. The distinction between these to
Java terms seems to be unknown to Eckel.

parameter:

http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.8.7

arguments:

http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.12

He also writes:

»the compiler requires«.

It might be the case that the compiler of Mr Eckel indeed
requires this, but he should teach a language instead of an
implementation, so it might be preferable to write
"the language specification requires«.

Also, anonymous inner classes are not being /defined/ in
Java, as Eckel writes at the beginning of the quotation, but
they are being /declared/.

Moreover, "anonymous" is an unnecessary restriction, because
the assertion is valid for /all/ inner classes. Someone
learning by this sentence thus needs to learn anew at another
time that this is also valid for non-anonymous inner classes,
or he might believe erroneously for an indetermined amount of
time, that it is only valid for anonymous inner classes.

Is there a way to improve the sentence? One attempt by me:

A parameter to be used within an inner class of its method
needs to be declared »final«.

Even the Java Language Specification itself is easier to
read than Eckel (and of course, much more correct):

Any local variable, formal method parameter or exception
handler parameter used but not declared in an inner class
must be declared final.

http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.3

All the reported faults have been found by me within a single
sentence chosen at random (I did not read the book, but
discovered the sentence in another posting, claiming to quote
this sentence from "Thinking in Java".) If one extrapolates the
error quotient to the whole TIJ, it gives a horrid impression.

Some books might sell chiefly because the buyer wants to
express agreement with their title. When one is learning a
foreign language one does not want to think everything in
English first and then painfully translate it word-by-word.
So one might choose "Thinking in Java" instead of a
garden-variety "Introduction to Java", because one longs for
the promise given by its title, not suspecting that the author
Eckel himself might be far from "thinking in Java".
 
A

alexandre_paterson

What about the "Head First Java" thing?

Didn't read it. Can't comment.

Any favorite books?

An (already old) classic:

"Effective Java" by Joshua Bloch. Best Java book ever in my opinion.

"Java puzzlers" by Joshua Bloch and Neal Gafter. A book about
many small Java gotchas.

(not as good as Effective Java but I find it still excellent)


Anything written by Doug Lea on Java is probably solid.

Next one on my list to buy is "Java Concurrency in Practice"
(by Bloch and Lea, amongst other)... Even though I'm
programming in Java since years (and using Doug Lea's
java.util.concurrent package since years too) these are
simply authors I enjoy reading.

These guys are (or were) Sun engineers working on the JVM
and/or the APIs.

What about anti-favorites ?

All these books out written by authors who discovered
OO and Java at the same time... For they're giving a
very distorted view of what OO is and are helping to
spread misconceptions and bad practices.

But then Chris Uppal noted that I was being "unfair" by
saying such a thing recently about one particular book
and he definitely had a point (and Chris if you're reading
this : yes, I'm a writer... but I write in french and, no,
I don't pay for the proofreaders, that has always been
paid by the editor and, no, it's not about computing ;)

"Thinking in Java"

I dislike that book for one reason: way too verbose for
a non-beginner. Some people like this book but I really
side with Stefan Ram on this one: the JLS (Java Language
Specification) is easier to read... In my opinion.


And a good old blog about why there aren't that much
good Java books :

http://fishbowl.pastiche.org/2003/07/08/where_are_the_writers

:)

Talk to you very soon on c.l.j.p.,

Alex
 
O

Oliver Wong

"Java puzzlers" by Joshua Bloch and Neal Gafter. A book about
many small Java gotchas.

(not as good as Effective Java but I find it still excellent)

I like the "Java puzzlers" book too, but I wouldn't recommend it for
*learning* Java. Instead, I think the book is for people who are already
very familiar with Java (having written at least a couple of "real world
projects"). It's a book for people who already know their way around most
of Java, with the book highlighting rarely explored regions with "Here's
something you might not have known about Java" type factoids.

- Oliver
 
L

Lee

"Effective Java" by Joshua Bloch. Best Java book ever in my opinion.

"Java puzzlers" by Joshua Bloch and Neal Gafter. A book about
many small Java gotchas.

(not as good as Effective Java but I find it still excellent)


Anything written by Doug Lea on Java is probably solid.

Next one on my list to buy is "Java Concurrency in Practice"
(by Bloch and Lea, amongst other)... Even though I'm
programming in Java since years (and using Doug Lea's
java.util.concurrent package since years too) these are
simply authors I enjoy reading.

These guys are (or were) Sun engineers working on the JVM
and/or the APIs.





All these books out written by authors who discovered
OO and Java at the same time... For they're giving a
very distorted view of what OO is and are helping to
spread misconceptions and bad practices.
"Thinking in Java"

I dislike that book for one reason: way too verbose for
a non-beginner. Some people like this book but I really
side with Stefan Ram on this one: the JLS (Java Language
Specification) is easier to read... In my opinion.


And a good old blog about why there aren't that much
good Java books :

http://fishbowl.pastiche.org/2003/07/08/where_are_the_writers
THanx. I'm working my way through the Sun tutorial. Seems a bit slow,
but in part that may have something to do with my personal learning
style. I'm not used to absorbing sustained material on line. For me, on
line resources for info that's relatively short and very focused are
great, but after more than a few screens full of info, I'm longing for a
real printed book. Still, hitting the web for short bursts has its uses.
ACtually, I think the latest received wisdom in learning theory is that
you're better off with many short jolts than with one long slog; so
we'll have to see how it works out after a while. Meanhwile I'm still
looking for a good book.

"Thinking in Java" does seem a bit verbose, (where's the code, guys!)
but I notice that it has a section on design patterns, so that makes me
think good thoughts about the book.

I imagine that "JAva Puzzles" would be like "The C Puzzle book". At
least for C, the puzzle book isnt where you'ld go to for the basic info,
but a way to challenge you knowlege of the "gotchas". So you think you
understand pointers, eh binky? What does THIS do. Ulp! You wouldnt
actually program most of the stuff in the Puzzle book, unless you were
going for the obfuscation prize.

On the existence or non existance of good books, I remember it being
said that one of the reasons for the rise of Fortran was McCrackens book
on Fortran II.
 

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,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top