Practical C++ Programming, Second Edition
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:
- The Basics
- Simple Programming
- Advanced Types and Classes
- Advanced Programming Concepts
- Other Language Features
- Appendixes.
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 one segment of the book's intended audience (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. It's 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. My favorite diagram is Figure 7-1. "Software life cycle," on page 88; I emphasize with the dinosaur.
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 also show the reader the power and usefulness of the Standard Template Library.
Now to speak about the book's shortcomings. First, although the book does a good job of covering the important C++ topics of classes, inheritance, and templates, I think it falls a bit short in these areas (especially the coverage of inheritance). Also, the terms instantiation, polymorphism and encapsulation are not used in the book. The book could have provided a bit more insight into object-oriented concepts. Also, these areas of the book are sparsely diagrammed. Second, source code errors and typos appear regularly enough to frustrate an inexperienced reader. I also found a couple of diagrams to be confusing. 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. Also, I think that 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 would like to have seen a more detailed and complete explanation of the object-oriented aspects of C++ (including more diagrams). A table showing all functions for Standard Template Library containers would have been nice (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 this issue.
In summary, Practical C++ Programming is a good book that really shines in some aspects and falls short in others. With some improvement, it could be a great book.
You can purchase Practical C++ Programming, Second Edition from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
1) Write practical C++ programming book 2) Get it published 3) Have it reviewed on Slashdot 4) ??? 4) Profit!!!
...should, I have decided, always involve the text Accelerated C++, by Koenig and Moo. They have been working with C++ since its inception, down the hall from Stroustrup.
The book takes two relatively new approaches to teaching C++: 1) don't teach C first, and 2) assume that the standard C++ library is there. So, they introduce "Hello, World" using std::string and std::cout, and they keep using std::string without trying to first teach template classes with default template parameters. The resulting intro programs are very clean and simple, easy to follow.
The word "pointer" isn't even mentioned until chapter 9. By that point, they're using strings and vectors to solve useful programs, and since both of those containers manage memory themselves, the user needs to know nothing about dynamic memory management (and thus, pointers) before doing the exercises.
Pointers and user-defined types are introduced, of course, but they don't need to be introduced before showing the reader how to use the basic library features. You don't need to know how an internal combustion engine works before learning how to drive, although going back later and learning what's under the hood will always reward the observant driver.
This approach has gotten rave reviews, and from actual C++ people, not just fluff reviewers. It's the produce of years of teaching C++ courses.
Final note: the book is one of the fantastic "C++ In-Depth" series, of which Stroustrup is the series editor. All are very high quality. One of the series' rules is that the main body of the book can be no more than 300 pages, so "make your point, make it simple, make it clear" rules the day.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
This was terrible.
My favorite diagram is Figure 7-1. "Software life cycle," on page 88; I emphasize with the dinosaur.
Ok, if I own the book, I'm not going to take the time to read this "review". If I don't own the book I obviously have NO FREAKING clue what figure 7-1 looks like! Also, does "Emphasizing with a dinosour" involve time travel and a shitload of highlighters or what? Or does it mean you hire a dinosour to stand next to you for emphasis? I don't get it...
They who would give up an essential liberty for temporary security, deserve neither liberty nor security
... is reviewed here, at the 'net's largest C++-oriented book review site. This review is decidedly in the negative, although Steve Oualline is given a chance to issue a response which is worth reading.
It seems that the 2nd edition of this book may have brought forward some previous problems. I have the first edition but never liked it, never thought it really achieved it's goals.
If you're looking for an uncompromisingly amazing first book on C++, please check out Accelerated C++ by Andrew Koenig and Barbara Moo. This is how I learned C++ and, by using the concepts of teaching core language skills alongside library concepts and best practices in OOP, it truly accelerates the process. Amazing.
Chr0m0Dr0m!C
C++ encourages you to avoid solving the problem by trying to introduce abstractions
No it doesnt, it allows you more abstractions that you an use as tools, if they're appropriate. When they're overused or used inappropriately, they detract.
It's like my neighbour who recently bough one of those power spray painter things. He runs around power-painting everything from lawnchairs to his fence - with often terrible results. But he's a guy with a new tool and wants to use it as often as possible, even though it's really only suitable to use in certain niche applications.
Or closer to home, observe the student who just learns recursive techniques. They want to write everything recursively - though it's rarely the best solution and just makes for obscure code. They ubiquitously teach it using factorial as an example, when a for loop is a much better tool.
Such is the way with C++. Not every solution is conducive to an object oriented approach, but it's worth having the tools for the ones that do. The ability to mix and match in large projects is a boon.
If you cant pick the right tools for the right job, then you're a poor craftsman.
I don't need no instructions to know how to rock!!!!
Without debating the whether C++ is the best choice for beginners, I wish new books on the subject would stop rehashing the same old concepts and methods - not everyone is a C programmer trying to transition to C++. There are a lot of areas that merit greater attention and that will get beginners started on the right foot - and messing with raw pointers isn't one of them.
On top of trying to get the basic OO mindset accross (yes instantiation, polymorphism and encapsulation are big words but the concepts are essential and not that difficult to explain), I'd like to see some more modern and useful concepts explored in depth. For instance:
Just my $0.02 for potential authors out there.