I teach programming, and I myself learned mostly self-taught about 30-35 years ago (pre-internet). I learned mostly by thinking things through and trying out alternate solutions. It never occurred to me that students could, or would, just "grep" the solution to many textbook assignments off the 'net. It sometimes seems that they do not make much effort to solve the problem themselves.

Sometimes I see two students's solutions with the same weird anomalies in them and it makes me go, "Hmmm..." It seems that the students who do NOT come up with the obvious best solutions are the ones actually thinking for themselves and not doing "research". In one case I searched on a strange method name and found one and only one hit on the web: a PDF that exactly duplicated the student's submission, including a lot of concepts and methods I have not taught yet.

Is this a problem generally?
How do Instructors deal with the fact that there could be many possible solutions available (most of them flawed) to students who know how to type some words in their browser?

(I have seen this question, and I do not agree and my question is more about how to handle the situation.) The assignments at this point are simple decisions and loops, nothing that requires knowledge of frameworks, etc. Most people should require nothing more than the textbook and my lectures.

Addition: I think the real problem is - now that my naivete is shattered, I have two doubts:

  1. Could anything they hand in potentially have been copied?
  2. Am I teaching effectively?
  • 4
    Good question. In my opinion, a good part of the solution is not to give standard assignments.
    – Davidmh
    Mar 10, 2016 at 21:56
  • 4
    Before we fix the rest of the world: maybe ask if there there places within stackexchange where students can get their programming homework done for them? And if so, should we try to stop it?
    – GEdgar
    Mar 10, 2016 at 22:03
  • 6
    @GennaroTedesco After all, they only cheat themselves, I beg to differ. The students cheat themselves now and they will cheat their employers and their clients/customers later. They will create software bugs and then everybody will be hurt. Imagine that you are flying on an airplane which has buggy flight control software. Will you be scared?
    – Nobody
    Mar 11, 2016 at 7:23
  • 1
    @GennaroTedesco "are always double checked", True. Actually, more than double in reality. However, there are many cases that people just assume the code is trivial and then escaped from the code review. Those trivial code are the kind of code the OP is talking about, that is, you're supposed to learn them during your first programming courses.
    – Nobody
    Mar 11, 2016 at 8:47
  • 1
    @nocomprende "caring if they succeed" is not achieved by checking homeworks like in primary school: it is achieved by giving good classes. Whether someone wants to make use of it, it is their personal choice and your pressure will not change their behaviour anyway.
    – gented
    Mar 11, 2016 at 13:26

5 Answers 5


You may have the problem of actually giving assignments which are just too simple - so easy they can be effectively Googled - but not at the same time making it clear that this is building to a compound problem that isn't so easily looked up, while building up skills that will make them good at their job.

A simple example: use regex to check to see if an email address might be valid. In theory, this is to help students learn regular expressions, as well as developing their skills of debugging, problem solving, and familiarity with string-handling in their computer language. The problem? Students think the problem is just about checking to see if an email is valid. As a real programmer, you absolutely should not even attempt to build your own solution for this - Google it and find a high-quality implementation suitable for your needs, then conduct your own testing and make sure it works. But your students might only be learning how to copy-paste ineffectively, not testing, altering, or understanding, and they do not learn how to modify the solution to fit custom business rules.

So, in this example I would suggest you twist it. The new problem is "test to see if an email address might be valid, using regex". Encourage them to find a nice regex online if they'd like, or build one on their own if they want extra practice on regex. Now, part 2 of the problem: our business rules only allow certain email addresses in our application. We only want to allow addresses that have a '.edu' extension, and before the @ symbol there must be 3 numbers (of the form: [email protected]).

This is not a complicated problem, but now there are two parts: 1) you need to find or build a regex to check an email, and 2) you need to be able to change it so it supports a non-standard rule that's terribly hard to Google. Hey, if you can find an answer on Google, knock yourself out - cite it so I can see where you found it and you'd still get full credit.

You may even want to state the 'hard' version of the problem first, then note how this is actually a few sets of simple problems combined together - then assign those easy ones right from the book if you like.

This is also a perfect way to then have the small in class problem that ff524 suggested. If they did the problem, then they should have no trouble with a solution to a minorly modified version like "this time, we want 4 numbers and a .co.uk extension - and you can use the solution you turned in to help your memory". Done right, at least some students will hopefully get the idea that it's actually harder to take the shortcuts than it is to genuinely understand the material so they can solve any problem that comes up in the future.

As a closing remark: I tend to try to skip most "try this problem from the book" type of assignments as a student myself, especially in anything programming related, because I find them trivial and unrecognizable compared to the kinds of problems I deal with as an actual real-life professional. So I don't really blame other students for not wanting to do them, either. I try to skew all my programming tasks towards real-world issues, preferably grounded in personal experience or existing applications, but I realize this is not always possible for teachers. Still, a little twist goes a long way!

  • OK, I am trying to completely absorb all of your suggestions. My first reaction is that we are in the chapter on loops, and the previous chapter (a week ago) was decisions. So, they don't know enough to build custom solutions to business problems. If I ask for a user-input loop that counts values within the range 1-99 and also counts how many values are outside that range, would you expect a solution that uses two List<T>s? (One gathered the input, the other tested it.) Wouldn't it have been easier for them to write the 10 line program that was asked,especially when most of it is in the book?
    – user28174
    Mar 11, 2016 at 16:12
  • 2
    @nocomprende Most business problems are trivial - it's when you slap them all together that things are hard. So I'd start with a problem they couldn't solve yet, like data validation. Business problem: entering the price of comparable houses to determine appraisal value. Enter base house price (one being appraised), then the price of 2-5 other houses (the 'comps'). You could hard-code what is too complicated to enter just yet. First, collect the data and print it out (problem X in book). Then add validation - entered prices more than 0, less than 1 mil, within 500k of base home price, etc....
    – BrianH
    Mar 11, 2016 at 16:29
  • @nocomprende ...and that's similar to "loop through ints 1-99", problem X in book. Let's insist on 3 entered houses, and use a for() loop for that. Next, let's use a while() loop to accept practically limitless input. Say, what if people put a comma in - oh, our program crashes. Whoops. We'll talk about try catch and error handling later, and string manipulation later too. For now we'll pretend people actually enter real numbers. In class, take that solution you turned in and make it so all houses are more than 10k and less than 200k, and also if it is less than 100k output "bargain!".
    – BrianH
    Mar 11, 2016 at 16:38
  • You have a bright future teaching here :-)
    – user28174
    Mar 11, 2016 at 16:44
  • 1
    @nocomprende Answering is easy - it's thinking up the right questions that's hard! :)
    – BrianH
    Mar 11, 2016 at 16:49

Most people should require nothing more than the textbook and my lectures.

Probably most professional programmers today could do their jobs armed with nothing but the lectures from their programming coursework and the complete official reference material for the programming languages and libraries they are using. But why would they, when there are much more useful resources available online that allow them to do a better job, more quickly?

Your students (understandably) approach this the same way. Why would they do their homework with just the textbook and lecture notes, when this isn't the most efficient way (with respect to time, getting a good grade, and actually learning)? (Yes, the Internet can be a tremendously useful aid for learning and not just copying.)

In my experience, the best way to deal with students using online resources is:

  • Encourage students to use online resources. Recommend specific online resources to them that you consider most helpful and reliable.
  • Require students to cite all the online resources that they used. (And depending on the assignment, to also explain how they used it.)
  • Educate students who use online resources that are flawed about how to better evaluate the online resources they choose to use. ("This website seems useful at first glance, but it actually doesn't apply to the problem in the homework assignment. Here is how you could have known that...") If you do this successfully, this will probably be the most valuable thing they learn in your class.
  • Assign a mix of problems, including some that can't be answered immediately with a simple Google search.

If you want them to have some practice solving programming problems without the assistance of the Internet, you can occasionally give them a small (< 10 minute) problem to complete in class.

  • 1
    I would want to emphasize that in programming you will absolutely want to know how the code works and why it works. I don't believe that copying code is a bad thing, however if they do it, they should know EXACTLY how it works. Simply asking a student what a certain line of code does and how it works could make them sweat. If they actually know the code. Then even the students would have no problem explaining it. and may even do so proudly.
    – Migz
    Mar 11, 2016 at 10:06
  • Up to now I disregarded the idea that they could be looking online. Most of the exercises were just too simple to seem to require research (this is chapter 5, OK?) I didn't realize that they would not try to solve it themselves. They have ample time, and are sitting in front of a computer full-time, which is more than I could say 30 years ago. So when I saw two basically identical submissions with weird flaws, I realized that they are not trying to do the simple assignments. What are they doing with their time? I look at them all day long. Don't they want to be able to work in the future?
    – user28174
    Mar 11, 2016 at 13:02
  • Regarding your last comment, I often (when I teach some programming in my math classes) give paper programming quizzes or simple programming problems on paper exams just to make sure they can write simple code on their own. I also usually meet with them in a computer lab once/week and have them work on lab exercises, and go around and see how they are doing.
    – Kimball
    Mar 12, 2016 at 14:44
  • @Kimball I have been studying mental development (throughout life) and trying to figure out what will be useful to "teach" abstraction, but haven't come up with much. It is a process of relentless application: keep trying to solve algorithmic problems. Peoples' ability to think symbolically varies, and it can grow, but not really be taught. It is like weightlifting: you have to lift the weights yourself, nothing will remove the effort required. So when I see students short-cut the effort, it is like watching someone lift balloons: what are they thinking?
    – user28174
    Mar 14, 2016 at 1:41

When I was about 13, I could guess the answer to most simple algebra problems and then check that my guess was a solution. My mathematics teacher explained that the objective was not to get the solution. The objective was for me to learn and practice techniques I would need later, for problems that would be too difficult for guess-and-check. Similarly, your programming students should be building up skills they will need to write programs they cannot just copy.

I don't know whether this would work or not, but it is something to try. Ask them to over-comment their programs, and give most of the grade for the clarity and quality of the comments.

They should begin by explaining the approaches they considered, and how they picked the one they actually coded.

Each line, or small group of lines, needs a comment saying what it is doing.

Whether or not they got the code from the Internet, they should demonstrate understanding of the purpose of every line in it. I find it easier to understand code at that level if I wrote it myself than if I am reading code someone else wrote.

  • Thank you. I was an "intuitive" algebra solver also, but that doesn't work for long! I guess I have been naive or lazy. I am consulting with the other programming instructor to see what will help. Your explanation technique is a good one.
    – user28174
    Mar 11, 2016 at 16:34
  • 2
    This was going to be my suggestion too. What I've done is write a script, then leave empty comments at specific places in the code for students to fill in. IME it works.
    – D.Salo
    Mar 16, 2016 at 1:47
  • @D.Salo I will think of how I can do this, thank you. We often use flowcharts and pseudocode in these early chapters, so that I know they can write structured code. I am not really concerned about the details of a particular language, I think I have learned about 30 of them, and made up several more (lex and yacc are your friends, or used to be...) In tests the other Instructor says, "assume that this part of the code is provided, and you just write this part..." but they often cannot seem to jump in and "assume" the way we expect them to. This means they don't grasp modularity and nesting.
    – user28174
    Mar 17, 2016 at 13:26

What worked for me(*) was forbidding anything not in class. The syllabus had something like: "The purpose of assignments is to get practice with the new stuff from that week. To solve them, you may only use things covered in class. Don't worry about the exact way. But if someone helps you using a feature you've never seen, tell them about this rule." It seems obvious -- you lecture on loops, then give problems on loops.

The basic problem is a fair one: students have seen lots of mismatches between the material, the tests, the stated goals, what they actually learned, and their final grade. They have no special reason to think the assignment during loop week is even about loops. It's a lot of work convincing students that learning the stuff from class is their only job, and you'll make sure that translates into getting a fair grade and having a useful skill. For examples, solving assignments beforehand for difficulty -- especially after any "minor" changes; double-checking that test Q's are similar to something from an assignment; and cutting busy-work (long unsigned byte, do-while).

The rest of the system that worked for us was having tests be worth 65-75% of the grade, fully closed-book. That emphasizes that by the end of the class, you'll have skills, especially the early ones, down cold, like tying your shoes. The first few test Q's are warm-ups like "what does this loop print?" to help students who freeze-up. 30% for the assignments is enough to make them worth doing, but clearly they're meant for practice (and hardly worth cheating on).

The other thing with assignments was making them oddball: reading a made-up code, or scoring the sport of "tongo-ball". That lets you tinker until it's exactly as complex as you need, good coverage of class material, with ALL the rules in one place (as opposed to assuming everyone knows about football safeties and the 2-minute time-out). It works better than real problems, and also makes googling tough. Some students don't love that -- they want to say they solved a real-world problem. But I go back to the first idea -- we're learning how to write loops. Once we know them, we can solve all the real problems we want.

(*) for several years at a US state college teaching 1st-year Com Sci.


Reword some Euler problems and assign them to the student to test their strength. I believe that if you become more creative with the assignments, they will be harder to Google and copy

  • Yep, it is up to me to be more clever, that is why they are paying me. I just hadn't run in to this situation before. The other Instructor had not either. It is so contrary to common sense. Or is it? Did you watch "The Big Short"? Sickening.
    – user28174
    Mar 17, 2016 at 13:21

You must log in to answer this question.