Using Quotes For Programming Students

Quotes for programming assignments are just one of the many topics that I teach all of my undergraduate students. In fact, I teach a lot of other programming subjects as well, but quotes for programming assignments is by far the easiest and most fun topic to teach. There are so many good questions on programming that you can spend days teaching Bonuses yourself (or others) how to do things! And when you’re teaching yourself, you can use this forum to share your program with others as well.

First, I ask the same sorts of questions each time I give a programming assignment. What do the students know about programming? What do they need to know? What’s the typical programming problem? Do my students have trouble doing it?

When I give an example of what a programmer would do in order to find the answer to a given question, I tell my students that a programmer “must” use a search function. And I give a little twist: the programmer “must” use a search function “to” find the answer. I explain that he/she must first “look through” the result, i.e., input the value into the search box, and then find where that search returns the answer. This search method can be used to search through any source code. (A common source code search is for “usefulness:defining” a method, which turns out to be helpful when the programmer has to define a new method in a way that satisfies some other usefulness requirement.)

Sometimes I give the same example to two different students. In both cases, the programmer must search inside the source code. In neither case does the programmer have to “look outside” to find the answer. In both cases, I give the same advice: Whenever a programmer “looks outside” for the answer, the programmer must look inside first! A programmer cannot solve a problem if he/she does not understand where the problem actually exists! So, don’t give a programmer “outside” the question; give the programmer “inside” the question!

One more example. I give the following to a young student: “given a list of words, what’s the easiest way to extract the contents of each word?” The student answers, “Given a list of words, I can find the contents of each word by searching through the list using the dictionary.” The student does not answer the question. Instead, he/she explains that he/she will need a list of words and a function to extract the matching content from each word. So, the student goes on to explain that he/she will create a function called “tails” that will let him/her search for the exact matching contents of the words with the tails.

This student has obviously used his/her function incorrectly! He/She has used his/her function to search an empty list, not an actual list of words! Now, what should have happened is that the student would have gotten ONLY the exact matches for each list item (the words in the list), and he/she would have been able to extract the correct word(s) from the list! So, what does this “programmer” do?

He/she goes on to explain that he/she will write a program that uses these functions to give you the exact matches to any words in your program. That’s great. That’s what you should be doing. But, what I want you to do is to give the search function a little tweak. Give it a name. Put a hyphen between the words in the list.

Before I end, let me say that this is only an example. I give real-life examples all the time in classes. I often give these examples as examples to motivate the students to come up with better solutions for problems. And, I do think that these quotes are excellent motivational tools, if given the right setting. So, the next time you have a problem solving problem in your programming projects, you can use these quotes to help you solve the problem by matching the right quote to the problem.