Slashdot Mirror


Practical C++ Programming, Second Edition

adrienlamothe writes "Practical C++ Programming is dedicated to teaching the reader how to program in the C++ programming language. The book actually has four goals: 1) Teach the reader C++. 2) Instill good programming style and practice (indeed, the book's subtitle is 'Programming Style Guidelines.') 3) Teach the programmer basic software development concepts. 4) Introduce the reader to debuggers and the make utility. 4) The author encourages the reader to use a computer to enter, run and debug the book's programming examples. I concur with this advice, though it isn't absolutely necessary." To see how well the book meets its own goals, read on for the rest of Lamothe's review. Practical C++ Programming, Second Edition author Steve Oulline pages 549 publisher O'Reilly & Associates rating 7 reviewer Adrien Lamothe ISBN 0596004192 summary Guide to learning C++ and programming style.

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:

  1. The Basics
  2. Simple Programming
  3. Advanced Types and Classes
  4. Advanced Programming Concepts
  5. Other Language Features
  6. 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 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.

25 of 266 comments (clear)

  1. Great opening. by stratjakt · · Score: 4, Funny

    Practical C++ Programming is dedicated to teaching the reader how to program in the C++ programming language.

    No shit, I thought it was the next in the Harry Potter series. My kids are going to be disappointed.

    Sorry, it's just that thats the kind of retarded formula-generated opening statement you'd expect from an 8th grader with no interest in the material. Ie; "The Treasure of Pirate Cove is about a treasure in a place called Pirate Cove"

    By the way, I love iPods, so mod me up up up!

    --
    I don't need no instructions to know how to rock!!!!
    1. Re:Great opening. by cK-Gunslinger · · Score: 3, Funny

      Not only that, but "The author encourages the reader to use a computer..."

      Man, talk about "Practical Programming!"

  2. Debugging by rf0 · · Score: 4, Funny

    All you need for debugging is print statements everywhere. Always works :)

    Rus

    1. Re:Debugging by saddino · · Score: 2, Funny

      Even better debugging tool:

      putchar('\007');

    2. Re:Debugging by connsmythe96 · · Score: 3, Funny

      What does James Bond have to do with debugging??

      --
      if(!cool) exit(-1);
    3. Re:Debugging by mofochickamo · · Score: 2, Funny
      All you need for debugging is print statements everywhere. Always works :)

      Of course it always works. But since you put print statements everywhere your program probably doesn't do much besides print out the same thing every time you run it ;)

      Actually now that I think about it, your program doesn't even compile. You cannot call a print function without first declaring or defining it, but since you used print statements everywhere you obviously haven't defined it.

      No wait! Since you use print statements everywhere you will get a syntax error because your print statement is not inside of another function, but you have no functions because you use print statement everywhere!

      Ok, I'm done being a jackass for today.

      --
      Honk if you're horny.
    4. Re:Debugging by Viking+Coder · · Score: 2, Funny

      Yeah, printf works real great for coding in OpenGL 2.0 Shading Language.
      </sarcasm>

      --
      Education is the silver bullet.
  3. Sweet by Karamchand · · Score: 2, Funny

    That's sweet, four goals: 1.) 2.) 3.) 4.) 4.) ;-) Otherwise, good review! Thank you!

  4. oxymoron by Anonymous Coward · · Score: 1, Funny

    Practical C++ Programming

    it goes together like linux and microsoft

  5. Re:ObOldeQuote by grub · · Score: 2, Funny

    gah I mean "..as Lung Cancer is to Lung"
    I'm a retard.

    --
    Trolling is a art,
  6. Obvious, ignore by Anonymous Coward · · Score: 5, Funny

    1) Write practical C++ programming book 2) Get it published 3) Have it reviewed on Slashdot 4) ??? 4) Profit!!!

  7. I don't usually bitch about slashdot "reviews" but by captain_craptacular · · Score: 5, Funny

    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
  8. ghramor roolez by neutrino_man · · Score: 2, Funny
    Ok, maybe I'm being a bit harsh...but reviews really should be edited a bit more before posting.

    As for me...I'm never going to "emphasize" with a dinosaur...I might "empathize" with one (if I met one in a deplorable condition)...who knows?

    Now to speak about sentence fragments.

    In summary, this review is a good review that really shines in some aspects and falls short in others. With some improvement, it could be a great review. Of course...if you improve anything, it gets better, now doesn't it?

    Ack.

  9. C++ bad-Villians. by Anonymous Coward · · Score: 1, Funny

    "C++ has probably set back the computing industry by 10 years."

    Damn! I thought it was Microsoft. Guess I lost that bet.

  10. Re:free on safari.oreilly.com by ihummel · · Score: 4, Funny

    Safari is great, especially for O'Reilly books. But some of us prefer to have the feel of dead trees in our hands when we're learning how to program.

  11. Changes from the first edition ... by Frater+219 · · Score: 2, Funny
    4) The author encourages the reader to use a computer to enter, run and debug the book's programming examples. I concur with this advice, though it isn't absolutely necessary.

    I remember the first edition of Practical C++ Programming. Readers who wished to get something out of that book should've noticed that it was absolutely necessary to debug the book's programming examples first.

    Errata? 'Er sure smella like it!

  12. How comprehensive? by mgs1000 · · Score: 2, Funny
    You forgot to talk about the most important chapter, with the information every C++ programmer needs to know:

    Chapter VII: How to sign up for unemployment benefits.

  13. Don't forget by MSG · · Score: 2, Funny

    Goal 4) teaching proper iteration.

  14. why bother? by Rumagent · · Score: 2, Funny

    When we can steal it all from SCO...

  15. Re:C++ bad by pommiekiwifruit · · Score: 2, Funny

    You mean you can calculate factorials without using template meta-programming?

  16. Re:free on safari.oreilly.com by phurley · · Score: 4, Funny

    "Learning to program," oh is that we are calling taking a dump these days?

    --
    Home Automation & Linux -- now I know I'm a geek
  17. The Third Edition by tds67 · · Score: 2, Funny
    The book actually has four goals: 1) Teach the reader C++. 2) Instill good programming style and practice (indeed, the book's subtitle is 'Programming Style Guidelines.') 3) Teach the programmer basic software development concepts. 4) Introduce the reader to debuggers and the make utility.

    ...and in the next edition, the book will have the additional goals of 5) Introduce the reader to US Copyright law 6) How to stay out of prison after violating the DMCA and 7) Learn how to pick the best copyright lawyer to defend against SCO lawsuits.

  18. Full of bad code by WebMasterJoe · · Score: 2, Funny
    The reviewer says the examples have lots of errors, and I couldn't agree more. Here's just one example:

    for (bp = mapstart(mp); bp->m_size; bp++) {
    if (bp->m_size >= size) {
    a = bp->m_addr;
    bp->m_addr += size;
    if ((bp->m_size -= size) == 0) {
    do {
    bp++;
    (bp-1)->m_addr = bp->m_addr;
    } while ((((bp-1)->m_size) = (bp->m_size)));
    mapsize(mp)++;
    }

    ASSERT(bp->m_size

    Can you believe that this kind of code could make it in here? It's the kind of thing that developers would call "ugly."
    --
    I really hate signatures, but go to my website.
  19. no real errors in the book by calethix · · Score: 2, Funny

    "Second, source code errors and typos appear regularly enough to frustrate an inexperienced reader."

    but earlier you said

    "4) The author encourages the reader to use a computer to enter, run and debug the book's programming examples"

    Everyone that's ever had a programming class knows all of those errors were intentionaly put there to test you. At least that's what my profs always told me when they gave the class buggy code.

  20. Programming with computers? Bah! by MonkeyCookie · · Score: 2, Funny

    You youngins and your fancy schmancy computer thingies. Back in my days we didn't have no fancy "computers" and we were grateful! We all did are programming using pseudocode. We never had to deal with memory or speed restrictions! The sky was the limit! Things have gone downhill since they made the switch to those fancy computers. So show some respect, sonny!

    Yes sir, those were the good ol' days.