|
Practical C++ Programming is dedicated to teaching the
reader how to program in the C++ programming language. I make this
seemingly redundant statement because upon first hearing the title
I thought the book may have been intended as a guide for teaching
experienced C++ programmers how to avoid the pitfalls of bad
object oriented practices using the language. Quite the contrary,
this book is designed to teach anyone, from complete beginner to
experienced programmer, how to program in C++. The book has four
goals:
- Teach the reader C++.
- Instill good
programming style and practice (indeed, the book's subtitle is
“Programming Style Guidelines.”)
- Teach the
programmer basic software development concepts.
- Introduce
the reader to debuggers and the make utility.
Practical C++ Programming is a fairly large book: 549
pages organized into six “parts” containing 30
chapters and 5 appendixes. The parts are as follows: Part I –
The Basics, Part II – Simple Programming, Part III –
Advanced Types and Classes, Part IV – Advanced Programming
Concepts, Part V – Other Language Features, Part VI –
Appendixes. You will have to read most of the book in order to
learn C++, although there are a number of chapters you can avoid
if your goal is to learn only the language's mechanics.
I must start by saying that I like the book, I think it has
value. There are a number of things I really appreciate about the
book. There are also some problems that adversely impact the
book's use by beginners (more about those later.)
The book discusses all the essential elements of C++. Areas
covered include: Class definition, namespaces, scope definition
and resolution, operator and function overloading, object memory
allocation (i.e. new and delete,) type casting,
exceptions, inheritance, templates (including an introduction to
the Standard Template Library,) the Input/Output system (including
the C I/O library,) and pointers. All language operators are
discussed (i.e. relational, assignment, etc.) Also covered are
language elements that C++ has in common with C. The other areas
of instruction (programming style, software development concepts,
programming tools) are intertwined with the primary topic
throughout the course of the book.
One of the book's strong points is the author's excellent
conversational writing style. Its hard to find books that combine
good technical information with clear expository writing (O'Reilly
seems to publish most of them.) Practical C++ Programming
definitely succeeds in this area. The author frequently references
his own experience to reinforce concepts on programming style,
design and debugging. I found his anecdotes useful and
occasionally humorous. The book also contains small sections of
text that serve to warn the reader of pitfalls (these are marked
with a bear trap icon) and areas where caution should be exercised
(marked with bear paw tracks.) Also, some of the source code
examples contain intentional bugs, which the author explains at
the end of each chapter. Diagrams, tables and source code examples
are found on almost every page of the book, and these are used to
keep the reader engaged with the textual discourse. Some of the
diagrams are very well done.
The book contains some interesting programming examples. The
chapters on operator overloading and floating point math contain
source code illustrating how to deal with the numeric precision
problems that plague all computers and computer languages. The
chapter on the Standard Template Library contains a program
showing how to create and use objects that manage a simple roster
for enrollment and grading of students. The book also contains
several examples of linked-lists and trees, for the purpose of
teaching the reader how to use pointers, and to contrast such
traditional algorithms with the easier to use C++ Standard
Template Library.
Now to speak about the book's shortcomings. First, although the
book does a solid job of covering the important C++ topics of
classes, inheritance, and templates, it needs to explain more than
it does (especially the coverage of inheritance.) Also, the terms
instantiation, polymorphism and encapsulation
are not used in the book. It seems that the author doesn't want to
confuse the reader with object-oriented concepts. The book should
have provided more insight into object-oriented concepts, given
that C++ supports objects. This could have been done in a separate
chapter. Also, these areas of the book are sparsely diagrammed.
Second, source code errors and typos appear regularly enough to
frustrate an inexperienced reader (even experienced ones can get
aggravated with such problems.) I also found a couple of diagrams
to be inaccurate. Third, there are occasional misleading
statements that a beginner probably won't recognize as such.
Because of these problems, I cannot recommend the book to people
with no previous programming experience. I'm surprised that these
problems made it into a second edition.
I think that despite these problems, the book has value to
experienced programmers who want to learn C++. C programmers in
particular will have an easier time dealing with the source code
errors. The book can be used by beginning programmers in a
classroom environment, providing the instructor understands the
book's problems and is prepared to guide students around them. The
book should be particularly useful when read in conjunction with a
good C++ reference guide.
Practical C++ Programming is an ambitious work in its
breadth and depth. It covers more areas of software development
than other C++ books. It takes an interesting approach that some
readers will appreciate and others may not. I'm currently
undecided on the appropriateness of chapters on debuggers, the
make utility, and the code review process. These topics may
side-track many beginners.
I would like to have seen a more detailed and complete
explanation of the object-oriented aspects of C++ (including more
diagrams.) It would have been nice to include a table showing all
Standard Template Library containers and methods (the book does
make reference to two STL web sites.) Some mention of third-party
object libraries (such as Rogue Wave, Qt, etc.) and their uses
would have been helpful.
The lack of a detailed explanation of inheritance may not be
bad. I'm one of those who believe that heavy reliance on
inheritance causes serious maintainability problems. However, I
think the book should have covered this topic more fully, so the
reader would understand the issue.
O'Reilly & Associates is my favorite technical book
publisher. However, some of the books I've read from this
publisher contain numerous programming errors in the source code
examples. I've been able to overlook these problems because I'm an
experienced software developer and I appreciate the really
outstanding job their authors do in explaining subject matter.
Their book Pthreads Programming is a prime example of this.
However, these problems cause concern when I read one of their
books on a topic that I don't understand very well. It appears
that O'Reilly needs to improve the technical review of their books
before they go to press. I understand the difficulty of this when
few experts on a particular topic may exist (not the case with
C++.) Publishers may also be reluctant to hire outside editors due
to non-disclosure concerns.
In summary, Practical C++ Programming is a good book
that really shines in some aspects and is deficient in others.
With some improvement, it could be a great book.
|