15 votes

Is asking students to debug existing code better than having them write new code?

I give students targeted debugging exercises to make them aware of common traps that they can fall into while coding, and I believe that this is beneficial to them. Certain errors come up all of the ...
  • 31.7k
14 votes

Is asking students to debug existing code better than having them write new code?

In the engineering world, being able to read, understand, debug and add on to existing code is MUCH more valuable skill than writing code from scratch. Too often, programmers will opt to rewrite a ...
13 votes
Accepted

Why do educators not set an upper bound for the amount of times we're allowed to compile code?

Because it's a meaningless obstacle Putting an upper limit on compilations is like telling a car manufacturer that they must build a new supercar, but are only allowed to test drive it a few times. ...
  • 1,253
13 votes

Teaching students to hunt for and debug their own errors

Debugging is more a craft, an art, than a science. That's where the pedagogical challenge lies. That said, here are a handful of tools/techniques I used to varying success: Model the debugging ...
  • 9,032
11 votes

Teaching students to hunt for and debug their own errors

I was a Girls Who Code mentor this year. The exercises provided by GWC included "debug this program" activities on a regular basis, so students got used to reading and understanding error messages. By ...
10 votes

Why do educators not set an upper bound for the amount of times we're allowed to compile code?

I do it the other way round: I encourage my students to compile and test very often! Of course, just changing random lines of code until the result seems to work is not a good idea and this should be ...
  • 594
7 votes

Why do educators not set an upper bound for the amount of times we're allowed to compile code?

My philosophy is "use professional tools" and creating an experience that is like being in real programming shop. The compiler can help you get rid of silly errors very fast without wasting time on ...
  • 2,279
7 votes

Why do educators not set an upper bound for the amount of times we're allowed to compile code?

Back in my day (which wasn't that long ago), many of the tests for my programming courses involved writing code on a piece of paper, with a pencil. In this environment, I couldn't rely on the compiler ...
7 votes

Is asking students to debug existing code better than having them write new code?

I tend to think that CS education should be done in multiple stages (to be repeated as the students progress in skill): teach them theory show them good code as an example have them write code it'...
  • 251
6 votes

Teaching students to hunt for and debug their own errors

Because debugging can be learned very easily through experiance, I'd try and help the students self-correct when they make mistakes. When correcting mistakes, ask the students to type the corrections ...
  • 4,754
6 votes
Accepted

Best way to pass on the problem solving experience

In places that use the ideas of agile software development, the usual way is to just let the newcomers pair with the more experienced members in all tasks. In your case it would consist of a lot of ...
  • 35.1k
5 votes

Debugging a submission that works well on student's computer but not on my computer

You've said that having an identical environment for everyone would be an incomplete solution, since students' code could still work "by accident" in that environment. One option would be to provide ...
  • 519
4 votes

Is asking students to debug existing code better than having them write new code?

I agree that learning to debug code written by someone else is a critical skill, but I do not think it can replace having to write and debug your own code. Writing your own code is a critical ...
4 votes

Why do educators not set an upper bound for the amount of times we're allowed to compile code?

While limiting use of compiling and testing, will stop same bad behaviours, it will also stop the best behaviours. Test driven development is one of the best ways to write software, and it involves a ...
3 votes

Debugging a submission that works well on student's computer but not on my computer

Your student/staff ratio is pretty unfavorable. This makes everything difficult. If you had a few more TAs or could find the schedule time, I'd make one of the TAs the person to handle all such ...
  • 35.1k
3 votes

Debugging a submission that works well on student's computer but not on my computer

As early as possible in the course, and again when appropriate examples arise, you should "round up the usual suspects." (It's a Dick Tracy reference, but that does not really help.) You could ...
3 votes
Accepted

What are good sample programs for learning to use a debugger?

A few Java specific examples come to mind: Using % with a negative number - I recently came across this and had to remember how Java treats modulus v. remainder (...
  • 9,032
3 votes

Is asking students to debug existing code better than having them write new code?

Writing code is essential, and a part of that is debugging (your own) code. If you can't debug your own code, you won't get very far, unless you write perfect code the first time, every time. ...
3 votes

Is asking students to debug existing code better than having them write new code?

I've been a software engineer for over 25 years and in my opinion, the two skills are just different. What you need to know and how you spend your time is very different when conceiving of a new ...
3 votes

Is asking students to debug existing code better than having them write new code?

I would say that it is helpful to have them write their own code in the beginning to better understand the processes that go into writing for an application. It gives them a strong basis and practice ...
  • 171
2 votes

Is asking students to debug existing code better than having them write new code?

Even though I'm not an educator, I work with programming and personally I don't think that you should teach your students on how to debug (don't curse me!). What I'd do is to present them the debugger ...
  • 121
2 votes

Is asking students to debug existing code better than having them write new code?

Neither is "better" or "worse" - just different. Writing your own code and understanding someone else's code well enough to debug and improve it are definitely distinct skills, both of which are ...
2 votes

Is asking students to debug existing code better than having them write new code?

There's a lot of discussion about how people who work in industry spend a lot of time working with other people's code. That's true, but in my opinion, the key skill for dealing with other people's ...
2 votes

Is asking students to debug existing code better than having them write new code?

During my 4 years of school debugging was never taught to us. We were only quickly shown that if we get an error, set a break point, see where it breaks and you know where the error is. Looking back, ...
  • 121
2 votes

What are good sample programs for learning to use a debugger?

I would try to focus in on the kinds of errors that beginner programmers get stuck on, to imitate as closely as possible the kind of situation that they would want a debugger for. So, I might code ...
  • 31.7k
2 votes

Teaching students to hunt for and debug their own errors

I prefer not to use a debugger, myself, for the simple reason that they are frustrating and don't actually run the same program (breakpoints and such can modify the logic). There is not a lot of ...
  • 35.1k
2 votes

Debugging a submission that works well on student's computer but not on my computer

You could encourage them to use tools like compiler warnings and valgrind to try to check for bugs.
2 votes

Why do educators not set an upper bound for the amount of times we're allowed to compile code?

Here is something I tell my students. Compiling is like voting in Chicago: do it early and often. I tell them it is a bad idea to write a whole bunch of code without compiling because they then wind ...
  • 2,279
2 votes

Best way to pass on the problem solving experience

As well as pair programming, look at other agile/lean techniques. Test Driven Development. What does done look like? / definition of done (scrum). Short release cycles (scrum). Minimise work in ...
2 votes

Debugging a submission that works well on student's computer but not on my computer

Is this using different versions of gcc? Have the students compile with full warnings and with different level of optimizations. I wonder: could the emitted ...

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