Answers.Body: <p>I think in this day and age it's unavoidable.  Short of cutting off the internet, students are going to look things up when stuck.  And heck, even the pros will sometimes resort to getting ideas from StackOverflow once in a while.</p>
  <p>In my class, I have a &quot;Many Small Programs&quot; approach which takes the form of mini-projects that have to be done in groups.  I teach an elective that meets 3 times a week.  Each project is broken up into modules that an individual student can do in 30-40 minutes.  Before they turn on their computers they'd at least have to write down the task in pseudocode using paper and pencil, if for nothing else to show that they've planned it out before actually coding.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-26T11:23:14.550Z
Answers.Text: Right, if you can't even write out a plan, all the searching in the world won't really help. I would illustrate successful search habits by looking things up in class and showing the many wrong turns and dead ends that obscure the useful answer. I've seen code that involves importing entire libraries and rewriting everything when all I needed was two statements in the right place.
Answers.UserDisplayName: Scott Rowe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-02-03T02:27:25.233Z
Answers.LastActivityDate: 2024-02-03T02:27:25.233Z
Answers.UserDisplayName: Dave
Answers.Body: <blockquote>
  <p>&quot;How about I conclude lectures with &quot;Idioms to avoid and that will be
  downgraded&quot;?&quot;</p>
  </blockquote>
  <p>This is very much the heart of the matter.  The majority of students are very focused on getting good marks on assessments, rather than on gaining a good understanding of the material.  This is a shame because the easiest way (in the long term) to get good marks on (well designed) assessments is to have a good understanding of the material.  Sadly in the short term, the easiest way is to settle for a shallow understanding of the material and make do with googling things to cobble something together at the last moment.  It is about balancing long term and short term costs and investments - sadly it is human nature to avoid investing for the long term.</p>
  <p>Students also tend to be very goal oriented, they tend to care a lot more about getting the code working than writing good quality code (again this comes down to long term investment of energy for a deferred benefit).</p>
  <p>So, the first thing to do is to explain that the assessments are designed to test your understanding of the material, and that the easiest way to get good marks is to have understanding to demonstrate.  Also point out that assessments tend to build on previous assessments, so understanding the current assessment will make the next assessment easier (and likely to result in higher marks), and this is done on purpose.  It is possible that nobody has told them this yet!</p>
  <p>It is also worth pointing out that if you can only program by looking things up on Google, ChatGPT and CoPilot are already better at that than you are.  If you want to be employable in the not too distant future as a programmer you will need to be able to do something that ChatGPT can't do, namely understand the code and be able to make judgements about whether it is good code or likely to lead to maintenance problems later on.  That requires understanding of the material and isn't something that can be googled - it requires thoughtful practice.</p>
  <p>For the nuclear option:  Design assessments that can be done in exam conditions in the lab with the WWW switched off (except for selected referene materials).  Give them the specification ahead of time, so that they can develop ideas, try things out, research library functions, or even implement the whole thing before the exam.  However, when they get to the programming exam, they have to re-implement it all from scratch without google or ChatGPT.  Except for students with eidetic memories, remembering unconnected arbitrary pieces of information (e.g. verbatim code) is <strong>very</strong> hard, but if the understand the material and they understand the code they have developed before the exam, then reproducing it in exam conditions will be much easier.  I have done this in the past (about 20 years ago) for reassessment (which was pass/fail at the time) and it worked well, but it is logistically difficult for large classes.  If the students know they will have to write code without Google, that will be a big incentive for them to learn to program without it.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-07-03T08:52:31.767Z
Answers.LastActivityDate: 2024-07-03T08:52:31.767Z
Answers.UserDisplayName: Dikran Marsupial
Answers.Body: <p>TL;DR Alas, that won't happen.</p>
  <p>It's very hard for authors to make their information as accessible as Google or ChatGPT results. So, when competing with these resources, you'll always loose in the typical lazy student/developer mindset. The radical conclusion would be to give up on lecture slides or books <strong>as a reference resource</strong>.</p>
  <p>Better embrace Google &amp; Co and have some lectures about how to best use them. Teach your students how they can decide whether an example found online matches the current task.</p>
  <p>Insist that software has to fulfill requirements, and e.g. random number generators have to produce a nice distribution of values if called multiple times. Provide a testbed that checks whether the students' random number generators fulfill at least the most basic properties.</p>
  <p>Teach them what to do if their solution attempt fails, i.e. analyzing and debugging their programs.</p>
  <p>And regarding random number generators:</p>
  <ul>
  <li>Is it important for a professional developer to be able to write a good random number generator? I don't think so. Never written one in my 30+ yrs developer career.</li>
  <li>Is it important to understand what properties a good random number generator should have? Absolutely. Especially important is the ability to switch between two different usages: an unpredictable behaviour in production code, and a reproducible one for testing purposes.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-19T14:23:14.520Z
Answers.Text: Random numbers are a subtle issue that I'd rather not focus on. Students in their first semester are barely able to use them, certainly not to assess them. Btw, I'm not asking them to write one: only to use it properly.
Answers.UserDisplayName: Victor Eijkhout
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-26T11:27:53.543Z
Answers.Text: Random numbers have a fascination, so I would use it as an example of how to employ system functions well or badly and how to substitute a library function for a built-in function. Things like that. I have seen these images that clearly show flaws in random number generators, see if you can locate or generate those. It would be humbling for students who try to construct a random function to see the failings on a big screen in color.
Answers.UserDisplayName: Scott Rowe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-19T09:52:55.910Z
Answers.LastActivityDate: 2023-12-19T09:52:55.910Z
Answers.UserDisplayName: Ralf Kleberhoff
Answers.Body: <p>How about carrots in addition to the sticks? I assume you downgrade solutions that use idioms which your course materials say are not to be used. That's the stick. In addition, you could try adding a carrot by way of extra credit.</p>
  <p>For example, during the week that the students are supposed to read those materials that talk about C style vs smart pointers, have a low-stakes (one or two point) in-class extra credit exercise to be completed in five minutes or less. Something like:</p>
  <ul>
  <li>Give them some easy code that uses a C pointer and tell them to replace it with a smart pointer, or</li>
  <li>Give them an easy problem and ask them to implement the solution with a smart pointer, or</li>
  <li>a multiple choice question saying, &quot;which is the proper way to use pointers for your class assignments?&quot; and providing a few code snippets, only one of which correctly uses the smart pointer, or</li>
  <li>A one-sentence or multiple-choice question: &quot;Why should you use a C++ smart pointer rather than a C pointer in your code for this class?&quot;</li>
  </ul>
  <p>For the coding type questions, it doesn't have to be a perfect solution, just one that shows they know how to use smart pointers as opposed to C style pointers. Those who provide an answer along the lines you want get a small amount of extra credit.</p>
  <p>Similarly, for the random number generator reading, you could have extra credit questions such as:</p>
  <ul>
  <li>What could go wrong if in your assignments, you use this code as given?</li>
  <li>If you use this code as given, the generator is re-seeded every time you call the function. How should you solve this problem?</li>
  </ul>
  <p>Since they won't know how to do the extra credit exercise without having done the reading, this will be some motivation to do the reading. It will have the side effect of reinforcing the coding practices you want.</p>
  <p>Over the course of the term, such extra credit might add up to maybe one or two percentage points of their total course grade—enough maybe to bump a student up from a B to a B+, or an A minus to an A. So it's low-stakes but sufficient incentive. Personally I would tell the students in advance about each such extra credit opportunity. (Not the actual question, just &quot;there will be a two point extra credit question based on the reading.&quot;) There's no point in springing the question on them without warning, as it's too late for them to do the reading then, and the goal is to get them to do the reading! Yes, by missing these easy extra credits, they will learn that you want them to use smart pointers, but that will simply be another stick. To make it a carrot, let them know that there is a potential reward for reading the materials.</p>
  <p>Of course this assumes a class that meets in person (or at least online synchronously), a setup where you are fully in charge of students' grades, and sufficient resources/small enough classes to be able to withstand the added burden of grading. So YMMV.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-06-23T05:10:57.890Z
Answers.LastActivityDate: 2024-06-25T06:28:29.897Z
Answers.LastEditDate: 2024-06-25T06:28:29.897Z
Answers.UserDisplayName: verbose
Body: <p>In general I don't mind them looking up stuff online, but the other day a bunch of them really ticked me off when they found a solution online that was pretty much explicitly marked as &quot;bad idea&quot; in the lecture slides &amp; book. What explains this tendency to search for everything online and what do I do against it?</p>
  <p>In case you're interested: the problem was &quot;how to generate random numbers in C++&quot;. ChatGPT and other sources give you a nice bit of code with a modern Mersenne Twister generator, properly seeded. ChatGPT gives you a suitable main program that demonstrates it. Sure. But don't put those lines in a function because then you re-seed the generator every time you call the function, and you basically use the seed function as the generator. Solution: declare everything <code>static</code>. It's in my notes.</p>
  <p>Other example. They do several exercises about C++ &quot;smart pointers&quot; which are (repeatedly) told are better than old-style C pointers, which I in fact don't teach. Still the latter show up in project code. Not in homework code, because there I explicitly tell them what to do.</p>
  <p>How about I conclude lectures with &quot;Idioms to avoid and that will be downgraded&quot;?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-12-19T16:33:57.283Z
Comments.Text: Can you come up with a test case where the results differ depending on whether they follow your notes or use the online solution? If so, a failed test case might get the students attention.
Comments.UserDisplayName: Fritz Sieker
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-12-19T16:56:40.630Z
Comments.Text: @FritzSieker That can be very hard in the case of random (testing a rng is tough!) or impossible/irrelevant if they have a working code using "unapproved" style.
Comments.UserDisplayName: Victor Eijkhout
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-12-19T19:41:16.470Z
Comments.Text: 'How about I conclude lectures with "Idioms to avoid and that will be downgraded"?' [it's going to be hard to list them all](https://dynomight.net/teaching/). It's difficult to grade code style since it's somewhat subjective, but that's a different problem than trying to get students to use textbooks rather than ChatGPT, which is also difficult.
Comments.UserDisplayName: ggorlen
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-07-03T09:28:26.610Z
Comments.Text: Very few students seem to read books these days as well, which is a shame as you get a deeper/broader understanding from reading a book than you do searching a particular question on Google.
Comments.UserDisplayName: Dikran Marsupial
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-07-07T13:42:12.217Z
Comments.Text: Re, "...declare everything static..." If any of your students hope to become software developers, then that is horrible advice. I'd gladly spend a lot of code lines in a project to get rid of one `static` variable. `static` is the enemy of testability, the enemy of extensibility and maintainability, and maybe the enemy of some other "ilities" as well. Instead of declaring `static` variables to hold the state of a PRNG, a competent software engineer would declare a _class_ whose instance variables/fields hold a PRNG state.
Comments.UserDisplayName: Solomon Slow
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-07-08T05:31:47.627Z
Comments.Text: @SolomonSlow that was in the context of random number generators. Otherwise I do tell my studnets very strongly never to use statics.
Comments.UserDisplayName: Victor Eijkhout
Tags: <c++><online><pointers>
Title: How do I get students to look at course materials, rather than google?
ThreadText: # How do I get students to look at course materials, rather than google?
  
  (Asked by: username_0 on 2023-12-18)
  
  In general I don't mind them looking up stuff online, but the other day a bunch of them really ticked me off when they found a solution online that was pretty much explicitly marked as "bad idea" in the lecture slides & book. What explains this tendency to search for everything online and what do I do against it?
  
  In case you're interested: the problem was "how to generate random numbers in C++". ChatGPT and other sources give you a nice bit of code with a modern Mersenne Twister generator, properly seeded. ChatGPT gives you a suitable main program that demonstrates it. Sure. But don't put those lines in a function because then you re-seed the generator every time you call the function, and you basically use the seed function as the generator. Solution: declare everything `static`. It's in my notes.
  
  Other example. They do several exercises about C++ "smart pointers" which are (repeatedly) told are better than old-style C pointers, which I in fact don't teach. Still the latter show up in project code. Not in homework code, because there I explicitly tell them what to do.
  
  How about I conclude lectures with "Idioms to avoid and that will be downgraded"?
  
  **Tags:** c++, online, pointers
  
  > **Comments:**
  > **username_1**: Can you come up with a test case where the results differ depending on whether they follow your notes or use the online solution? If so, a failed test case might get the students attention.  
  > **username_0**: @username_1 That can be very hard in the case of random (testing a rng is tough!) or impossible/irrelevant if they have a working code using "unapproved" style.  
  > **username_2**: 'How about I conclude lectures with "Idioms to avoid and that will be downgraded"?' [it's going to be hard to list them all](https://dynomight.net/teaching/). It's difficult to grade code style since it's somewhat subjective, but that's a different problem than trying to get students to use textbooks rather than ChatGPT, which is also difficult.  
  > **username_3**: Very few students seem to read books these days as well, which is a shame as you get a deeper/broader understanding from reading a book than you do searching a particular question on Google.  
  > **username_4**: Re, "...declare everything static..." If any of your students hope to become software developers, then that is horrible advice. I'd gladly spend a lot of code lines in a project to get rid of one `static` variable. `static` is the enemy of testability, the enemy of extensibility and maintainability, and maybe the enemy of some other "ilities" as well. Instead of declaring `static` variables to hold the state of a PRNG, a competent software engineer would declare a _class_ whose instance variables/fields hold a PRNG state.  
  > **username_0**: @username_4 that was in the context of random number generators. Otherwise I do tell my studnets very strongly never to use statics.  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_7 on 2023-12-19. Score: 8
  
  TL;DR Alas, that won't happen.
  
  It's very hard for authors to make their information as accessible as Google or ChatGPT results. So, when competing with these resources, you'll always loose in the typical lazy student/developer mindset. The radical conclusion would be to give up on lecture slides or books **as a reference resource**.
  
  Better embrace Google & Co and have some lectures about how to best use them. Teach your students how they can decide whether an example found online matches the current task.
  
  Insist that software has to fulfill requirements, and e.g. random number generators have to produce a nice distribution of values if called multiple times. Provide a testbed that checks whether the students' random number generators fulfill at least the most basic properties.
  
  Teach them what to do if their solution attempt fails, i.e. analyzing and debugging their programs.
  
  And regarding random number generators:
  
  * Is it important for a professional developer to be able to write a good random number generator? I don't think so. Never written one in my 30+ yrs developer career.
  * Is it important to understand what properties a good random number generator should have? Absolutely. Especially important is the ability to switch between two different usages: an unpredictable behaviour in production code, and a reproducible one for testing purposes.
  
  > **Comments:**
  > **username_0**: Random numbers are a subtle issue that I'd rather not focus on. Students in their first semester are barely able to use them, certainly not to assess them. Btw, I'm not asking them to write one: only to use it properly.  
  > **username_6**: Random numbers have a fascination, so I would use it as an example of how to employ system functions well or badly and how to substitute a library function for a built-in function. Things like that. I have seen these images that clearly show flaws in random number generators, see if you can locate or generate those. It would be humbling for students who try to construct a random function to see the failings on a big screen in color.  
  
  ---
  
  ### Answer by username_8 on 2024-06-23. Score: 4
  
  How about carrots in addition to the sticks? I assume you downgrade solutions that use idioms which your course materials say are not to be used. That's the stick. In addition, you could try adding a carrot by way of extra credit.
  
  For example, during the week that the students are supposed to read those materials that talk about C style vs smart pointers, have a low-stakes (one or two point) in-class extra credit exercise to be completed in five minutes or less. Something like:
  
  * Give them some easy code that uses a C pointer and tell them to replace it with a smart pointer, or
  * Give them an easy problem and ask them to implement the solution with a smart pointer, or
  * a multiple choice question saying, "which is the proper way to use pointers for your class assignments?" and providing a few code snippets, only one of which correctly uses the smart pointer, or
  * A one-sentence or multiple-choice question: "Why should you use a C++ smart pointer rather than a C pointer in your code for this class?"
  
  For the coding type questions, it doesn't have to be a perfect solution, just one that shows they know how to use smart pointers as opposed to C style pointers. Those who provide an answer along the lines you want get a small amount of extra credit.
  
  Similarly, for the random number generator reading, you could have extra credit questions such as:
  
  * What could go wrong if in your assignments, you use this code as given?
  * If you use this code as given, the generator is re-seeded every time you call the function. How should you solve this problem?
  
  Since they won't know how to do the extra credit exercise without having done the reading, this will be some motivation to do the reading. It will have the side effect of reinforcing the coding practices you want.
  
  Over the course of the term, such extra credit might add up to maybe one or two percentage points of their total course grade—enough maybe to bump a student up from a B to a B+, or an A minus to an A. So it's low-stakes but sufficient incentive. Personally I would tell the students in advance about each such extra credit opportunity. (Not the actual question, just "there will be a two point extra credit question based on the reading.") There's no point in springing the question on them without warning, as it's too late for them to do the reading then, and the goal is to get them to do the reading! Yes, by missing these easy extra credits, they will learn that you want them to use smart pointers, but that will simply be another stick. To make it a carrot, let them know that there is a potential reward for reading the materials.
  
  Of course this assumes a class that meets in person (or at least online synchronously), a setup where you are fully in charge of students' grades, and sufficient resources/small enough classes to be able to withstand the added burden of grading. So YMMV.
  
  
  ---
  
  ### Answer by username_5 on 2024-02-03. Score: 2
  
  I think in this day and age it's unavoidable. Short of cutting off the internet, students are going to look things up when stuck. And heck, even the pros will sometimes resort to getting ideas from StackOverflow once in a while.
  
  In my class, I have a "Many Small Programs" approach which takes the form of mini-projects that have to be done in groups. I teach an elective that meets 3 times a week. Each project is broken up into modules that an individual student can do in 30-40 minutes. Before they turn on their computers they'd at least have to write down the task in pseudocode using paper and pencil, if for nothing else to show that they've planned it out before actually coding.
  
  > **Comments:**
  > **username_6**: Right, if you can't even write out a plan, all the searching in the world won't really help. I would illustrate successful search habits by looking things up in class and showing the many wrong turns and dead ends that obscure the useful answer. I've seen code that involves importing entire libraries and rewriting everything when all I needed was two statements in the right place.  
  
  ---
  
  ### Answer by username_3 on 2024-07-03. Score: 1
  
  > "How about I conclude lectures with "Idioms to avoid and that will be
  > downgraded"?"
  
  This is very much the heart of the matter. The majority of students are very focused on getting good marks on assessments, rather than on gaining a good understanding of the material. This is a shame because the easiest way (in the long term) to get good marks on (well designed) assessments is to have a good understanding of the material. Sadly in the short term, the easiest way is to settle for a shallow understanding of the material and make do with googling things to cobble something together at the last moment. It is about balancing long term and short term costs and investments - sadly it is human nature to avoid investing for the long term.
  
  Students also tend to be very goal oriented, they tend to care a lot more about getting the code working than writing good quality code (again this comes down to long term investment of energy for a deferred benefit).
  
  So, the first thing to do is to explain that the assessments are designed to test your understanding of the material, and that the easiest way to get good marks is to have understanding to demonstrate. Also point out that assessments tend to build on previous assessments, so understanding the current assessment will make the next assessment easier (and likely to result in higher marks), and this is done on purpose. It is possible that nobody has told them this yet!
  
  It is also worth pointing out that if you can only program by looking things up on Google, ChatGPT and CoPilot are already better at that than you are. If you want to be employable in the not too distant future as a programmer you will need to be able to do something that ChatGPT can't do, namely understand the code and be able to make judgements about whether it is good code or likely to lead to maintenance problems later on. That requires understanding of the material and isn't something that can be googled - it requires thoughtful practice.
  
  For the nuclear option: Design assessments that can be done in exam conditions in the lab with the WWW switched off (except for selected referene materials). Give them the specification ahead of time, so that they can develop ideas, try things out, research library functions, or even implement the whole thing before the exam. However, when they get to the programming exam, they have to re-implement it all from scratch without google or ChatGPT. Except for students with eidetic memories, remembering unconnected arbitrary pieces of information (e.g. verbatim code) is **very** hard, but if the understand the material and they understand the code they have developed before the exam, then reproducing it in exam conditions will be much easier. I have done this in the past (about 20 years ago) for reassessment (which was pass/fail at the time) and it worked well, but it is logistically difficult for large classes. If the students know they will have to write code without Google, that will be a big incentive for them to learn to program without it.
  
  
  ---
  
  