[26] Learning OO/C++
(Part of C++ FAQ Lite, Copyright © 1991-2000, Marshall Cline, cline@parashift.com)


FAQs in section [26]:


[26.1] What is mentoring?

It's the most important tool in learning OO.

Object-oriented thinking is caught, not just taught. Get cozy with someone who really knows what they're talking about, and try to get inside their head and watch them solve problems. Listen. Learn by emulating.

If you're working for a company, get them to bring someone in who can act as a mentor and guide. We've seen gobs and gobs of money wasted by companies who "saved money" by simply buying their employees a book ("Here's a book; read it over the weekend; on Monday you'll be an OO developer").

TopBottomPrevious sectionNext section ]


[26.2] Should I learn C before I learn OO/C++?

Don't bother.

If your ultimate goal is to learn OO/C++ and you don't already know C, reading books or taking courses in C will not only waste your time, but it will teach you a bunch of things that you'll explicitly have to un-learn when you finally get back on track and learn OO/C++ (e.g., malloc(), printf(), unnecessary use of switch statements, error-code exception handling, unnecessary use of #define macros, etc.).

If you want to learn OO/C++, learn OO/C++. Taking time out to learn C will waste your time and confuse you.

TopBottomPrevious sectionNext section ]


[26.3] Should I learn Smalltalk before I learn OO/C++?

Don't bother.

If your ultimate goal is to learn OO/C++ and you don't already know Smalltalk, reading books or taking courses in Smalltalk will not only waste your time, but it will teach you a bunch of things that you'll explicitly have to un-learn when you finally get back on track and learn OO/C++ (e.g., dynamic typing, non-subtyping inheritance, error-code exception handling, etc.).

Knowing a "pure" OO language doesn't make the transition to OO/C++ any easier. This is not a theory; we have trained and mentored literally thousands of software professionals in OO. In fact, Smalltalk experience can make it harder for some people: they need to unlearn some rather deep notions about typing and inheritance in addition to needing to learn new syntax and idioms. This unlearning process is especially painful and slow for those who cling to Smalltalk with religious zeal ("C++ is not like Smalltalk, therefore C++ is evil").

If you want to learn OO/C++, learn OO/C++. Taking time out to learn Smalltalk will waste your time and confuse you.

Note: I sit on both the ANSI C++ (X3J16) and ANSI Smalltalk (X3J20) standardization committees. I am not a language bigot. I'm not saying C++ is better or worse than Smalltalk; I'm simply saying that they are different.

TopBottomPrevious sectionNext section ]


[26.4] Should I buy one book, or several?

At least two.

There are two categories of insight and knowledge in OO programming using C++. You're better off getting a "best of breed" book from each category rather than trying to find a single book that does an OK job at everything. The two OO/C++ programming categories are:

Legality guides describe all language features with roughly the same level of emphasis; morality guides focus on those language features that you will use most often in typical programming tasks. Legality guides tell you how to get a given feature past the compiler; morality guides tell you whether or not to use that feature in the first place.

Meta comments:

TopBottomPrevious sectionNext section ]


[26.5] What are some best-of-breed C++ morality guides?

Here's my personal (subjective and selective) short-list of must-read C++ morality guides, alphabetically by author:

Similarities: All three books are extensively illustrated with code examples. All three are excellent, insightful, useful, gold plated books. All three have excellent sales records.

Differences: Cline/Lomow/Girou's examples are complete, working programs rather than code fragments or standalone classes. Meyers contains numerous line-drawings that illustrate the points.

TopBottomPrevious sectionNext section ]


[26.6] What are some best-of-breed C++ legality guides?

Here's my personal (subjective and selective) short-list of must-read C++ legality guides, alphabetically by author:

Similarities: Both books are excellent overviews of almost every language feature. I reviewed them for back-to-back issues of C++ Report, and I said that they are both top notch, gold plated, excellent books. Both have excellent sales records.

Differences: If you don't know C, Lippman's book is better for you. If you know C and you want to cover a lot of ground quickly, Stroustrup's book is better for you.

TopBottomPrevious sectionNext section ]


[26.7] Are there other OO books that are relevant to OO/C++?

Yes! Tons!

The morality and legality categories listed above were for OO programming. The areas of OO analysis and OO design are also relevant, and have their own best-of-breed books.

There are tons and tons of good books in these other areas. The seminal book on OO design patterns is (in my personal, subjective and selective, opinion) a must-read book: Gamma et al., Design Patterns, 395 pgs, Addison-Wesley, 1995, ISBN 0-201-63361-2. Describes "patterns" that commonly show up in good OO designs. You must read this book if you intend to do OO design work.

TopBottomPrevious sectionNext section ]


[26.8] But those books are too advanced for me since I've never used any programming language before; is there any hope for me?

Yes.

There are probably many C++ books that are targeted for people who are brand new programmers, but here's one that I've read: Heller, Who's afraid of C++?, AP Professional, 1996, ISBN 0-12-339097-4.

Note that you should supplement that book with one of the above books and/or the FAQ's sections on const correctness and exception safety since these topics aren't highlighted in that book.

TopBottomPrevious sectionNext section ]


E-Mail E-mail the author
C++ FAQ LiteTable of contentsSubject indexAbout the author©Download your own copy ]
Revised Jul 10, 2000