I\'m currently redesigning a college level first semester graduate course on Int
ID: 655053 • Letter: I
Question
I'm currently redesigning a college level first semester graduate course on Intro to Programming, in C++. Note the comma; the course is introduction to programming, and C++ just happens to be the vessel used to teach it. Note that I don't have any decision power at the moment over the language selection, so arguments about whether or not C++ is a good introductory language are moot.
Over the past 3 years, I've taught this class as a intro to C++ course, which is how the course was taught previously. However, I have come to realize that teaching things like pointers, C-style strings and arrays, and etc. early in the course does a disservice to the students, who will very likely go on to program in other languages.
This semester, I am leading with references, smart pointers, C++ strings, and vectors, and only covering raw pointers, C strings, and C arrays towards the end of the course as "advanced C++." The goal is to teach programming concepts first, not the intricacies of C/C++.
However, I'm hung up on casting. Based on my previous statement, it would seem logical to dump C-style casts until the end of the semester (if at all, since Stroustrap has indicated they're to be avoided) and to introduce static_cast up front, dynamic_cast when we get to polymorphism, and reinterpret_cast when we're dealing with raw pointers. However, given that most C-derived languages such as C# and Java perform casting using syntax similar to C-style casts, am I preparing students to be confused when they try to work in another language? (Although, the C# as operator does do approximately the same thing as a C++ dynamic_cast.)
Explanation / Answer
You might consider explaining static, dynamic and reinterpret casts and then having a brief digression on regular C-style casts.
Since regular casts are equal to trying out a range of sequences of C++ casts (more powerful but potentially unsafe), it seems logical to introduce the bricks that make up the whole before explaining it.
Not strictly C++ related but nonetheless useful: give the kids the tools and advice them not to use the hammer on their fingers.
Just my opinion though.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.