As response to a question how to learn C++ and become a "pro", "not only using DOS commands, but also MFC"
The following is a roadmap to "Mastering C++" - how I would teach it.
Some people might want to reorder the list which is fine with me - it all
depends on the teacher and the tools.
Chapter (I) Learning the language
- basic language: type system, control structures, functions, scope.
- basic concepts: programming style, structuring your program using
functions, the difference between contract, declaration and implementation
- language: pointers.
pointer arithmetic, referencing, dereferencing, pointers vs. references,
pointer to pointer, adress of pointer, allocating raw memory, etc.
If you didn't succeed with (3): learn pointers
If you don't get it the third time, give up. Really. I am serious.*
- debugging. assert, trace, using a debugger, distrusting yourself,
acquiring some programming style.
- language: Function overloading.
- language: classes. Member functions, constructor, destructor
- concepts: encapsulation, simple object design, encapsulating state
- lanuage: learn exceptions **
- repeat concepts: good programming style, contract vs. declaration
- concepts: inheritance, polymorphy
- concepts: "enhanced" object design with the new knowledge
(exceptions and polymorphy)
- language: some refined points
const-correctness, default constructor, copy constructor vs. assignment
operator, how to make a class behave like a built in type (but skip operator
- language: templates: function templates, class templates, template
- get an introduction on the STL (standard template library, which
makes the biggest part of the C++ run time library)
- language: ok, now, just as sugar, operator overloading, and how to
make types truly act like built-ins
- libraries: refine your knowledge on the STL
NOW you are ready to leave the console window
Chapter (II) ...but also MFC
- Windows API basics: This helps understanding some of the
mumbo-jumbo and awkwardnesses in the MFC much better
Event Driven Programming, Windows, Window Handles, Window Messages
(you can omit *creating* windows here, since this is a painful task made much
easier by frameworks - but the rest is important to understand and makes
working with the MFC easier).
GDI, standard controls etc.
- Do the MFC "Scribble" tutorial, just following the main path (up to
"printing" or so). Don't try to understand everything, just get a feeling for
- Do the "Scribble" tutorial again, this time exploring the background
Chapter (II) Become a Pro
- Notice that, once you are here, you are the last remaining person on earth
- Learn enhanced concepts: Exception Safety, Patterns etc. and all the fine
parts I have forgotten above
- Learn "Industry Power" stuff: Automated Tests, Version Control,
Finalizing, and everything that belongs to running a larger project.
<b>Warning:</b> this course is a pain. In the ass, in the back, in your
fingers, everywhere. Yet, it's IMO one of the shorter routes to a pro. To be
true, you could start with th MFC stuff pretty much after (I)-(j), but this
makes you only half-a-programmer, and you might acquire some misfeats that are
hard to get rid of later.
The order of the list itself clearly shows some drawbacks of the C++ language,
namely, the position of exceptions, and especially the STLBoth are standard
tools that should be introduced much earlier, but require good understanding of
the basic language features.
*) I pretty much agree with the thought that understanding pointers
needs a certain "wiring" of the brain. All other stuff in C++ can be learned
by a decently intelligent person. Pointers are different, you either get them,
or you don't. If you can't do pointers, C++ will be a pain all the
**) that's really late, to late. They are an important tool for error
handling - and people should learn it as early as possible. However, it
doesn't make much sense wihtout a good grasp on scope and code flow. I would
do exceptions right after (b), but books/courses don't do it without classes.
we are here to help each other get through this thing, whatever it is Vonnegut jr.
sighist || Agile Programming | doxygen