Re: How to learning java without pay money?
On Fri, 23 Apr 2010, Lew wrote:
Tom Anderson wrote:
You can download Thinking In Java for free, and people tell me that's
pretty good:
http://www.mindview.net/Books/TIJ/
Lew wrote:
I somewhat disagree that it's a good book.
I got a lot out of it when I first learned Java, so in that it might
help the OP. However its approach diverges somewhat from mainstream
Java best practices, so it could engender bad habits that are hard to
correct later on.
Tom Anderson wrote:
Could you expand on that? In what ways does it diverge?
Well, it's been a lot of years since I read it, so I had to go back and look
at it again. I notice right away that he plunges into a discussion of
inheritance with a section entitled "Inheritance: reusing the interface" in
which he does not mention interfaces as such, but talks about base classes.
Yes, concrete classes. That isn't thinking in Java at all.
He comes around to interfaces as an afterthought, and presents them as
something that "takes the concept of an abstract class one step further".
This is backwards - the presentation should begin with interfaces and flow to
concrete classes and instances.
Hmm. I think if you're teaching someone from the beginning, you need to
start with the simplest possible set of syntax and semantics, and you need
to start with programs that actually do something. That means you do have
to start with concrete classes.
If you then grow the set of semantics you're working with incrementally,
abstract classes would seem to naturally come before interfaces. I'm not
sure about that, though; if you talked about polymorphism (which is really
what we're talking about when we talk about the concept of interface, and
programming to an interface - the idea that a single method might have
multiple implementations that do different things) before inheritance,
then you could introduce interfaces before abstract classes.
I guess Eckels is writing in the traditional mode of OO thought, in which
inheritance was much more important than it is today. Given that his
background is in C++, that's not surprising. I wouldn't go so far as to
say that it's not "thinking in java", but it does seem a mistake to
describe only the traditional approach, and not the more modern one.
tom
--
DO NOT WANT!