how to learn cpp





[26] Learning OO/C++, C++ FAQ Lite







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

FAQs in section [26]:

[26.1] What is mentoring?
[26.2] Should I learn C before I learn OO/C++?
[26.3] Should I learn Smalltalk before I learn OO/C++?
[26.4] Should I buy one book, or several?
[26.5] What are some best-of-breed C++ morality guides?
[26.6] What are some best-of-breed C++ legality guides?
[26.7] Are there other OO books that are relevant to OO/C++?
[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?



[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").
[ Top | Bottom | Previous section | Next 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.
[ Top | Bottom | Previous section | Next 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.
[ Top | Bottom | Previous section | Next 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:

C++ legality guides — what you can and
can't do in C++.
C++ morality guides — what you should and
shouldn't do in C++.

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:

Neither of these categories is optional. You must have a
good grasp of both.
These categories do not trade off against each other. You shouldn't
argue in favor of one over the other. They dove-tail.

[ Top | Bottom | Previous section | Next 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:

Cline and Lomow, C++ FAQs, 461 pgs, Addison-Wesley, 1995,
ISBN 0-201-58958-3. Covers 470 topics in a FAQ-like Q&A format.
Meyers, Effective C++, Second Edition, 224 pgs,
Addison-Wesley, 1998, ISBN 0-201-93488-9. Covers 50 topics in a short essay
format.
Meyers, More Effective C++, 336 pgs, Addison-Wesley, 1996,
ISBN 0-201-63371-X. Covers 35 topics in a short essay format.

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 and Lomow's examples are complete, working programs
rather than code fragments or standalone classes. Meyers contains numerous
line-drawings that illustrate the points.
[ Top | Bottom | Previous section | Next 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:

Lippman and Lajoie, C++ Primer, Third Edition, 1237 pgs,
Addison-Wesley, 1998, ISBN 0-201-82470-1. Very
readable/approachable.
Stroustrup, The C++ Programming Language, Third Edition,
646 pgs, Addison-Wesley, 1998, ISBN 0-201-53992-6. Covers a lot of
ground.

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.
[ Top | Bottom | Previous section | Next 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.
[ Top | Bottom | Previous section | Next 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?
[Recently created (on 5/98). Click here to go to the next FAQ in the "chain" of recent changes.]
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 suplement 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.
[ Top | Bottom | Previous section | Next section ]


 E-mail the author
[ C++ FAQ Lite
| Table of contents
| Subject index
| About the author
| ©
| Download your own copy ]
Revised May 27, 1998




Wyszukiwarka

Podobne podstrony:
08 Learn How To Fall
Learn How To Play The Guitar
(Parenting) 3 Major Divorce Parenting Mistakes And Learn How To Avoid Them (Free Ebook)
E Book Art Anime How To Draw Iria
How to Debate Leftists and Win In Their Own Game Travis L Hughes
How to Make your Own Tracer Ammunition
How to Fake Fingerprints
HOW TO MAKE AN MESSENGE BOX
Audioslave Show Me How To Life
How to Install And Run Windows XP From USB drive

więcej podobnych podstron