REVIEW - Schildt's Expert C++


Title:

Schildt's Expert C++

Author:

Herbert Schildt

ISBN:

Publisher:

McGraw-Hill Osborne Media (1996)

Pages:

402pp

Reviewer:

Zvezdan Petkovic

Reviewed:

December 1998

Rating:

★☆☆☆☆


Reviewed by Zvezdan Petkovicmailto:zpetkovic@acm.org The book review section on our website is beginning to collect quite a following. One result is extra reviews being volunteered by non- members. Obviously I cannot guarantee to publish unsolicited reviews just as I cannot guarantee to review unsolicited books. However here is another opinion on Expert C++ - Francis Glassborow. I think that this book has a serious attitude problem. The title of the book and the invitation on the back cover: Unlock the Power of C++ with Expert Advice from the Master promise much. It pretends to be more important than it actually is. The introductory pages explain that Herbert Schildt is the world's leading programming author. He is an expert on the C and C++ languages and Windows programming. Then you learn about his other 16 books on the same subject, and you are advised: When you need solid answers, fast, turn to Herbert Schildt, the recognized authority on programming. The programs from the book are offered on the diskette at $24.95. Mr Schildt obviously does not believe in posting his software on the Internet for free. Thus, one is given the impression that this book is a major source of knowledge.

Unfortunately, this is just another book on basic data structures and some software tools. There are (much) better books. Let us see why.

The first chapter describes function templates and explains reasons for their use comparing them to the early methods of generalisation - macros and standard C library functions such as

bsearch()
and
qsort()
. The templates are applied to sorting and searching algorithms: bubble, selection, insertion, shell, and quicksort; sequential and binary search. Schildt uses arrays of characters instead of strings in this chapter. The introduction of strings is postponed till Chapter 6.

Template classes are described in Chapter 2. The classic container classes are built here: bounded array, queues, stack, linked list, and binary tree. Here begins our suspicion in the authors expertise:

Special terminology is needed when discussing trees. Computer scientists are not known for their grammar, and terminology for trees is a classic case of a confused metaphor. The root is the first item in the tree. Each data item is called a node (or sometimes a leaf) of the tree, and any piece of the tree is called a subtree. A node that has no subtrees attached to it is called a terminal node. The height of the tree is equal to the number of layers deep that its roots grow.

I do not see this as an improvement. Firstly, I do not know what grammar has to do with terminology. Secondly, that sentence could have been spent on explaining that computer science looks at the tree upside down, similar to a family tree that is drawn starting from a distant ancestor. That is not a confused metaphor but a familiar example. Furthermore, the definition is imprecise, and precision is one of the traits of scientists. It is not clear from Schildt's definition that only terminal nodes are called leaves, and all others are internal nodes. Finally, a tree has only one root, not several of them that grow in layers. The tree grows by adding more terminal nodes (leaves) to the existing nodes of the tree. Similarly, a real tree grows by sprouting new branches from the existing ones.

The code for a binary tree template class is even more confusing. The root is a

public
variable. The class function for insertion of objects into the tree has three parameters: root, previous root, and item to be inserted. Decent implementation would always keep root as a
private
variable and an insertion function would need only one parameter - item to be inserted. It would take to much space to explain in detail what is wrong with Schildt's implementation.

At the end of this chapter the author suggests that the reader creates his own library of templates similar to these, without even mentioning that all of them exist in the STL (and much better implemented). In the whole book, he mentions (without any explanation) STL just three times.

The third chapter describes a generic recursive-descent parser. Schildt recommends the use of

setjmp()
and
longjmp()
as the best way to implement the error function in syntax checking. He says that
try, catch,
and
throw
may also be beneficial. And this man has the audacity to claim to be a C++ expert!

Chapter 4 covers Sparse Arrays C++ style. Approaches with a linked list, binary tree, pointer array, and hashing are described. Understanding and using run-time type information is the topic of the fifth chapter:

typeid
and
dynamic_cast
are described.

Chapter 6 finally covers standard string class and uses it for a line- oriented editor. Let us take a look at Schildt's code in class function

load(string fname)
where
string text
is a
private
class variable:

while (!in.eof()) {
in.get(ch);
if (!in.eof()) text += ch;
}

Perhaps a small rearrangement would make the code more efficient the repeated tests in the

while
and
if
conditions. However, there is a more important practical question: How sensible is it to load an entire file into a single string?

In the seventh chapter he explains basic cryptography: substitution, transposition, and bit-manipulation ciphers. Basic data compression techniques, 8 into 7 and 4 into 3, are explained after that. Schildt suggests the reader try the Lempel-Ziv algorithm. I think that book with this title should have implemented Lempel-Ziv algorithm instead of the naive ones listed above.

Interfacing with assembly language is described in Chapter 8. Here is one of Schildt's reasons you might need that:

For example, relative to C++ source code,
private
members of a class can only be accessed by other members of that class. However, when using assembly language,
private
members are as easily accessible as
public
ones! Most of the time you would not want to tear down the wall of encapsulation, but in an emergency, you might. (One such case might occur after a system crash, when you are trying to recover valuable data.)

No comment.

Chapter 9 discusses implementation of new data types in C++, and implements the Set type. In Chapter 10, he implements an interpreter for a subset of BASIC. Finally, the last, eleventh chapter, covers basics of Java and appendix of the book gives the (incomplete) summary of C++ keywords. The review of Java is too short and has several vague generalisations similar to these:

When the chronicle of computer languages is written, the following will be said: B spawned C, C evolved into C++, and C++ transmuted into Java.

While it is beyond the scope of this overview to give an example, it is sufficient to say that interfaces in Java serve (more or less) the same purpose as virtual functions and abstract classes in C++.

I must admit that Schildt writes well, but, overall, the book mostly covers the basic topics from data structures. The rest of the topics are hardly advanced, only the simplest algorithms are implemented. Hence, the title is exaggerating, and as far as Schildt's expertise is concerned I think it is evident from the quotes. The same choice of topics with appropriate, less ambitious title, and better honed implementations could make a good book. However, if you want to learn the above topics, I recommend you to take a good book on data structures, and read old but still good

Software Tools by Kernighan and Plauger, especially chapters about
ed
line editor and
RATFOR
translator. That would be a real investment. And they do not repeat the code from previous chapters to make the book thicker and justify greater cost.

Book cover image courtesy of Open Library.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.