I was just browsing the C++ tutorial on this site and was shocked that it doesn't even touch on STL containers and algorithms. It seems to me that an introduction to vector, iterators and simple algorithms should happen before the student even gets to arrays and dynamic memory. I would start introducing the STL right after control structures.
This tutorial is basically the way I was taught C++ ~mumble~ years ago (before the STL existed in the C++ library). I'm surprised to see it taught that way today.
I would love to hear what others think about the best way to teach C++.
I wouldn't actually call teaching the standard library teaching C++. Though the STL is a GREAT utility to use, it's not necessary to actually code in C++. The tutorial teaches basics that IS the C++ language. STL isn't the C++ language. It's just a utility pack.
As a result I think the tutorial is just fine as long as they make clear that the STL exists and that it should be used where needed. The exception of cout is made due to it's use in almost every application.
And though the tutorial doesn't cover the STL they have a decent reference to it.
*DON'T* get me wrong. I think the STL should be taught but not in a basic C++ tutorial.
LOL WUT? Teach the STL before arrays? Arrays, just like control structures, are an elemental construct of the language. Before being introduced to vectors, the student should understand that 0-based indexing is not out of whim. It's a willing lack of abstraction from the computer's internal addressing method.
God forbid we produce students who like to write their own vector classes with 1-based indexing.
IMO, the STL should be taught after polymorphism (i.e. very near the end of the course).
I agree with helios that students have to learn the basic building blocks before they tackle the higher-level concepts, because IMHO knowledge of the inner workings of things I think makes a person a better programmer. I certainly feel as though I'm more competent at C++ because I understand how the compiler works so I know why static_cast can generate code, for example.
On the other hand, I probably also share an opinion/frustration with PanGalactic (judging from the high quality of his posts) that fresh outs lack an understanding of things such as STL and algorithms, templates, boost libraries, etc, and this is directly because universities spend all their time teaching the fundamentals.
IMHO, universities should offer courses just on C++ (and/or Java and/or <insert your favorite language here that is in widespread use>) that focus entirely on the higher-level aspects. And taking at least one of these courses should be mandatory.
There isn't much more frustrating to me than maintaining someone's code who chose a 15-line algorithm to do what could have been done in 1-2 lines using an STL algorithm or a better choice of container.
Here's an article where Stroustrup expresses his views on this. He is getting more adamant about this. I'm sure I heard him talk about this at SD West a couple years ago.
BS: Actually, I'd like to see a ``student C++'' where built-in arrays wasn't used at all. Instead students would use vector, list, and string classes from a teacher-provided library (based on the standard library no doubt).
...
In teaching, C++ has been hurt by its close - and valuable - relationship with C. Because C++ is (almost) a superset of C, many think that they must learn (almost) all C features and techniques before approaching C++. This is not so, C++ is in many ways better behaved than C, and libraries can be used to avoid having the student face the complexities of C pointer manipulation, casting, arrays, etc. until the basics have been learned in an environment containing proper vectors, strings, etc.
My opinion of course but, I think the reason there isn't a STL tutorial is because once you've "learned the langauge" you can easily look everything up in the Reference section here. At least thats what I do, its how I got the hang of stacks, queues and vectors. No tutorial needed, just a list somethings methods and examples of their use. :-)
@PanGalactic It's interesting to see Stroustrup's opinion. I should show my CS professor that! If I didn't use C arrays he would subtract .5 points off my HW's! XD