1
$\begingroup$

I have to teach an Intro to Programming class of students with some exposure to proccedural programming, arrays and loops etc. However, they have not taken any course in oop and templates. It is a requirement of the course to teach pointers. I felt teaching raw pointers only will be incomplete; it is appropriate to provide the students a fuller, mordern C++ Intro wrt pointers. This implies teaching smart pointers.

How do you explain the syntax of smart ptrs to these students without having to teach them first about classes, constructors & destructors dynamic memory and templates?

$\endgroup$
4
  • 1
    $\begingroup$ Smart pointers are a device to manage the automatic destruction of dynamically allocated objects... Talking about objects first seems unavoidable $\endgroup$ Commented Jan 25, 2021 at 4:29
  • 1
    $\begingroup$ If you have an established curriculum and/or textbook, I'd advise not going off on a totally different path from their sequence and scaffolding. The work to support and make it coherent may snowball surprisingly fast for you. Let some textbook maker do this switch first. $\endgroup$ Commented Jan 25, 2021 at 15:50
  • 1
    $\begingroup$ From what I remember the implementation in OO and or templates. But the usage is not. Therefore focus on the usage. Or even better, don't (I agree with Ben). $\endgroup$ Commented Jan 27, 2021 at 16:15
  • $\begingroup$ Yes, I can see now this may be not be the best course to follow. Heading your advises. Thanks folks & @Ben I. for the answer. $\endgroup$ Commented Jan 29, 2021 at 20:41

1 Answer 1

3
$\begingroup$

I hate giving advice like this, but my honest advice here would be not to do so. Or, at least, don't do it without consulting with your colleagues first.

Students (and your fellow teachers in future courses) depend on you getting through the required material in the course. If you find that you have extra time at the end of the semester, then by all means, go back and try to take a stab at smart pointers. But I wouldn't endanger your odds of getting to the end of the material that students will be expected to know in future coursework. That could create far larger problems for the students going forward.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.