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


FAQs in section [28]:


[28.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 sectionSearch the FAQ ]


[28.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 sectionSearch the FAQ ]


[28.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 sectionSearch the FAQ ]


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

At least three.

There are three categories of insight and knowledge in OO programming using C++. You should get a great book from each category, not an okay book that tries to do an okay job at everything. The three 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:

In addition to these (emphasis on "addition"), you should consider at least one book in each of two other categories: at least one book on OO Design plus at least one book on coding standards. Design books give you ideas and guideliens for thinking at a higher level with objects, and coding standard books establish best practices across your organization, plus help make sure everybody can read each others' code (e.g., so you can move people around if one of the teams falls behind).

TopBottomPrevious sectionNext sectionSearch the FAQ ]


[28.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 sectionSearch the FAQ ]


[28.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 et al'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 sectionSearch the FAQ ]


[28.7] What are some best-of-breed C++ programming-by-example guides?

Here's my personal (subjective and selective) short-list of must-read C++ programming-by-example guides:

TopBottomPrevious sectionNext sectionSearch the FAQ ]


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

Yes! Tons!

The morality, legality, and by-example 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 sectionSearch the FAQ ]


E-Mail E-mail the author
C++ FAQ LiteTable of contentsSubject indexAbout the author©Download your own copy ]
Revised Mar 1, 2006