Noted...
I took a quick look at that book. It's a piece of crap.
I looked at it too and, based on what I saw, I don't agree at all. I admit
that I only skimmed the first half-dozen chapters, but what I saw seemed
promising.
Put it this way. I would hate to find myself obliged to give an introductory
course on programming, I would hate even more to be obliged to use Java for
that course, but if the fates did conspire against me, then I'd take the time
to read Schmidt's (proto-)book very carefully, because I suspect that it could
for a sound basis for such a course. (And would be /much/ easier than writing
my own material ;-)
An advice I read once about choosing a good OO book is
to first look out for the definitions the book gives
for a few terms: type, class, inheritance, subtyping,
polymorphism, etc.
I doubt if there is even one book anywhere which gives a definition/explanation
of any of those terms which is both usable and complete/correct. (Note that
even such an abstruse theorist as Luca Cardelli got his mathematical model of
OO
semantics wrong -- OO is more subtle than it looks, and the terminology
/benefits/ from not being tied down too much).
Also note that Schmidt's book is not intended to be an advanced thesis on OO,.
but an introduction to programming from scratch. As such it is impossible for
it to take the same sort of line as a textbook for more advanced programmers
would.
The definition of inheritance from that book:
"Inheritance is often used when someone has written
a basic class that contains clever methods, and other
people wish to use the clever methods in their own
classes without copying the code."
I think you are being unfair. I haven't noticed that passage myself, but I
cannot at all believe that he intends that as any kind of definition of
inheritance, and I don't really even believe that he intends it as his primary
/explanation/ of inheritance. For instance the first mention of the term that
I noticed is:
============
Inheritance lets us add minor customizations to a class. For example, our
design of a basic CASHIER might need some customization to fit perfectly into
the Italian restaurant, say, perhaps the cashier must speak Italian. We
customize the CASHIER class by writing the new method, speakItalian, and
inventing new name, say, ITALIAN CASHIER, for the customized class that
possesses all the methods of the CASHIER plus the new method. The situation we
have in mind is drawn like this in class-diagram style:
The ITALIAN CASHIER inherits (or ``extends'') the CASHIER class, because it has
all the methods of the original plus the additional customizations. The large
arrowhead in the diagram denotes this inheritance.
The attractive feature of inheritance is that the customizations are not
inserted into the original class but are attached as extensions. Thus, several
people can use the one and only original class but extend it in distinct ways.
(For example, the basic CASHIER class might be extended into an Italian
restaurant cashier and extended also into a bank cashier. For that matter, a
restaurant might be built to have one CASHIER object (who does not speak
Italian) and one ITALIAN CASHIER object (who does)).
============
Which is not at all how I would express it to an audience of semantically
sophisticated programmers, but (considering that this is chapter 1 of a first
introduction to any kind of programming at all) I don't think it's a bad
statement.
"The classifying values into species prevents
inappropriate combinations of values..."
wtf!? Was there any editing done on that book?
Are you an author ? If so do /you/ pay for copy-editing of preliminary
drafts ?
It looks like this book is a compilation of notes
that the author took while he was discovering both
Java and OO for the first time.
That is /way/ unfair. Indeed, I don't see how anyone could possibly come to
that conclusion. The book may not always approach things in quite the way I
would prefer (though there is more good than bad, IMO) but it has clearly been
carefully considered and (as it were) /designed/.
-- chris