149 votes
Accepted

Is it bad to force my students not to return early?

Actually returning early should be the norm. Return as soon as you can. There are at least two reasons for this, of which the first, efficiency, is the least important. But if you return early then ...
Buffy's user avatar
  • 36.3k
54 votes

Should CS students be doing their tests on paper?

100% yes. In beginning courses, it's practically a cognitive requirement. Let me see if I can break down for you why it is so important. It comes down to what we can know that the student knows. ...
Ben I.'s user avatar
  • 33.4k
52 votes

Is it bad to force my students not to return early?

Teach your students about the return early philosophy. Teach your students about the single return philosophy. Tell them this ...
jpmc26's user avatar
  • 629
50 votes
Accepted

Should CS students be doing their tests on paper?

Edit: This relatively high voted answer seems to be confusing to some, as it does not seem to give a clear answer. TL;DR: yes, doing tests on paper is usual at least in my university, at least many ...
AnoE's user avatar
  • 1,379
38 votes

How do you deal with Lone Rangers in group projects?

This is really a separate approach from my first answer, which has received some push-back. It's worth noting that many of these loners are simply students who are substantially ahead of the curve. ...
Ben I.'s user avatar
  • 33.4k
37 votes
Accepted

Demonstrating the possible dangers of SQL injection

The best way to show your students that their work is vulnerable to SQL injection is to demonstrate it. I'd suggest that you challenge the students to "hack" each others projects using SQL injection. ...
thesecretmaster's user avatar
  • 4,795
35 votes
Accepted

Problematic student at a very high level

The best way to deal with this kind of student is to head it off at the pass. If you can get the student at the beginning, you can often prevent the problem from festering in the first place. I have ...
Ben I.'s user avatar
  • 33.4k
34 votes

Is it bad to force my students not to return early?

Is it a wrong approach, giving your students the choice? Or is it wrong to force them never to return early? This is a false dichotomy. Sometimes multiple returns are clearer, and sometimes (rarely) ...
Kevin's user avatar
  • 449
32 votes
Accepted

Explaining access levels and visibility in OOP

Here's an analogy that I've used for several years, and that students seem to understand. It doesn't focus on the rules, but why we have public and private and protected. "Most of you know that I ...
Stephen Gilbert's user avatar
24 votes

Should CS students be doing their tests on paper?

Although most of the answers here seem to be in agreement that coding tests should be done on paper, I would like to offer a different opinion. Any test that includes coding would benefit the student, ...
Winterborne's user avatar
24 votes

How do you teach Big O to high schoolers with varying degrees of math exposure?

One good overall educational strategy is to teach the same thing to students repeatedly, using a Spiral approach, in which each turn of the spiral teaches at a deeper level. Don't expect the students ...
Buffy's user avatar
  • 36.3k
21 votes

Dealing with students who complete labs very quickly

I have 3 tiers of labs. First are the required labs. They're worth 100 points each and every one must do these. If they don't do one, it goes in the gradebook as a zero. These are also the labs that ...
Ryan Nutt's user avatar
  • 3,009
19 votes

Should CS students be doing their tests on paper?

Speaking as a former student and as a coder: yes. Perhaps there's an element of in-my-day geezerism here, but under the assumption that by "on a computer" you mean "in an IDE" I'll point out that ...
G. Ann - SonarSource Team's user avatar
19 votes

Non-native English speakers struggle to come up with decent variable names and function names

The point of good variable/function/class naming is to express problem semantics to readers, including the programmers. If your readers are primarily French speakers, use good French naming for ...
Buffy's user avatar
  • 36.3k
18 votes

Demonstrating the possible dangers of SQL injection

A couple suggestions - The classic xkcd comic about Bobby Tables: Shown, complete with the explain xkcd article can provide a nice, humorous introduction that will get them to start paying to ...
auden's user avatar
  • 4,724
16 votes
Accepted

How can we motivate students to review each other's code?

You have an opportunity for several things here: You can make it a small-team effort rather than a whole-class thing. Say, a team of about 5. The team reviews everyone's code in sequence so all get ...
Buffy's user avatar
  • 36.3k
15 votes

How can I design online tests and prevent cheating?

I don't think there are any published tools to generate programming assignments, though there are articles that describe such tools (such as this one from a CUNY, or this one from Croatia, so one ...
Ben I.'s user avatar
  • 33.4k
14 votes

Should CS students be doing their tests on paper?

As a student who went through 4 years of undergraduate in computer science, writing all my exams on paper, I do think there are advantages to a paper exam. If you need an IDE to tell you the things ...
Kaneki's user avatar
  • 783
14 votes

How to deal with students that don't like CS?

On the first day of class, I ask students how Google search can work -- returning an answer to any query over billions of web pages in a fraction of a second. Usually someone mutters "magic". I say, "...
Ellen Spertus's user avatar
13 votes

Explaining access levels and visibility in OOP

What my teachers used was the following example, which is pretty simple and most people understood. Your father orders a pizza. The delivery guy arrives and expects payment. The ...
shalah allier's user avatar
13 votes

Is it bad to force my students not to return early?

When I learnt Eiffel, I realised that a single return at the end of a function is the way to go. Eiffel does not have a return. You just set the value of the Result variable, and it is returned at the ...
ctrl-alt-delor's user avatar
12 votes

Problematic student at a very high level

You said he refuses to work, but has mastered the material. How do you know he's mastered the material? I've had students like this in the past. They'll finish 2 weeks worth of assignments in a day ...
Ryan Nutt's user avatar
  • 3,009
12 votes

Should CS students be doing their tests on paper?

Speaking as a former student, a coder & a teacher: yes. In addition to the points raised by G. Ann, I would add the following: Problems on tests are typically far simpler than full real world ...
Pikalek's user avatar
  • 414
12 votes

Should CS students be doing their tests on paper?

Speaking as a former student, a former competitive programmer, a real world programmer, yes. Forcing student to write code on paper is not pointless. It has following benefits: Giving you syntax ...
hucancode's user avatar
  • 221
12 votes

Should CS students be doing their tests on paper?

Maybe some complementary points to what as already been said (as a CS assistant professor, giving both theoretical and practical courses). Even for practical courses (those which involve coding), ...
Kim Nguyễn's user avatar
12 votes
Accepted

How to stress the importance of testing code?

Introduce test-driven development. TDD and agile methods of development are very popular at the minute, and for good reason — you know, ahead of time, exactly what each part of the program must ...
Aurora0001's user avatar
  • 3,516
12 votes

Explaining access levels and visibility in OOP

Ooh, this is one of my favorite lessons! I don't introduce package private and protected in the same lesson as private and public, because there are 3 principles that I want them to absorb that ...
Ben I.'s user avatar
  • 33.4k
12 votes

The order of subjects in beginner's curriculum

We teach AP CS assuming that our students come to us with no prior computing background. Being that the language for AP CS A is Java, we plan our sequencing accordingly. We don't follow the approach ...
iFrame's user avatar
  • 171
12 votes

Is it bad to force my students not to return early?

Speaking as a computer science professional (not an educator) with over 40 years of experience, the important thing to teach is discipline. Would-be programmers need to understand that code which is ...
Hot Licks's user avatar
  • 221
11 votes

Demonstrating the possible dangers of SQL injection

If you search 'computerphile SQL injection' on google, it should bring you to the link below. The man in this video explains SQL injection very clearly and uses a practical example as well by breaking ...
ecarl's user avatar
  • 111

Only top scored, non community-wiki answers of a minimum length are eligible