11
$\begingroup$

Background: I’m not entirely a CS educator, but I did run into a debate on whether programming contests are good for students.

A lot of people around me have fun in programming contests. Usually, those contests require participants to “solve” several problems (like 7 to 8) within certain time (2 to 3 hours). Students are ranked by their scores, calculated from the number of problems they are capable of solving, and then the time spent. There are test cases on the submission system to which students have to submit their source files, and the submission “passes” when it compiles to a program which passes all the test cases.

Given all these, while students are (probably?) good at problem solving skills, there are several problems:

  1. Students focus too much on the time spent on writing their programs. Therefore, they employ a lot of poor practices. For example, they always use short variable names, universal headers (#include ), using namespace std; etc in order to speed up their typing. They claim that iostream is implemented on top of C’s stdio and so they use printf even in C++.

  2. They always put extra assumptions. For example, while they know how to find the “unpaired” integer in an integer array (by taking the XOR sum), they won’t think of how to check whether the array has only one unpaired item. Also, they usually allocate large arrays in advance and skip bounds checking (they believe the array is large enough), which create concerns in both program stability and security.

  3. They don’t understand how to maintain a large project. Since OOP (usually) requires them to type more, they, for example, manipulate raw arrays with a part of custom heapsort algorithm, instead of creating a struct representing a heap, when they are writing in C. While sometimes OOP is unnecessary, for them code reuse is either impossible or requiring a lot of copy-and-paste.

$\endgroup$
1
  • 1
    $\begingroup$ Why would you ever write a heapsort algorithm in a coding competition? The correct answer o that problem is always "use what the programming language provides - it's been thoroughly vetted and will be closer to error free than you could possibly do in the time allowed, and you can focus on the real problem instead of rewriting something Dijkstra solved decades ago." $\endgroup$
    – pojo-guy
    Commented Jul 16, 2018 at 2:52

4 Answers 4

6
$\begingroup$

While I think that all of your observations are correct, there are other considerations. I'm not a big believer in these contests, nor in the kinds of problems that students are asked to solve in them.

However, the issue of student enthusiasm for programming (as a part of CS) is also very important. IF you have a bunch of students who need external motivation such contests can, perhaps be helpful.

On the other hand, the "take no prisoners" ultra competitive attitude that is exhibited by many young males is a negative consideration. A more cooperative environment would be better preparation for future endeavors in CS, I think. Some competitions, I note, are for teams, not individuals. And competition against your own self is likely a good thing whereas competition against the "other" has a down side.

Finally, I worry a bit about preparation for these contests. If your class attends to the issues 1-3 (and others) that you list, you are likely doing a good job. However, if the entire course is spent in working on small, tricky problems (Solving NIM, I call it), then the students aren't really learning what it is to be a "player" in CS. Only a very small fraction of the time spent by a professional or an academic in CS is spent on such "cute" problems. Sometimes that way of thinking can be very helpful, but not very often. Structure, correctness, usability, extendability, etc. are all more important in general.

I note that the OOPSLA conference (later SPLASH) of ACM used to have a Design Fest in which teams of folks (adults) would create an OO design of a fairly large system. This sort of thing can be competitive or not, but doesn't involve coding. Later they added Code Fest in which other teams would implement some design from a Design Fest.

$\endgroup$
8
$\begingroup$

Programming contests are useful for some students in some contexts, but they're harmful to other students in other contexts.

Contests are useful for students who already self-identify as programmers, are motivated by competition, and enjoy the high-stress environment of a competition. But like you said, the skills acquired by participating in programming contests aren't always useful outside of that environment. I'll also note that your examples are all very math-oriented, so the contests might be geared towards students with a more mathematical background.

But they're less useful for students who are not motivated by competition. Notably, students from under-represented groups or who don't self-identify as programmers are less likely to participate in these, and requiring them to participate can actually discourage them from pursuing computer science.

So, while programming competitions might be one small part of a course, I'd recommend balancing it with other activities that might help other types of students, and pointing out the problems with "competition code" that you mentioned in your question.

I'd also recommend focusing on "hackathons" or "game jams" more than competitions. These have the fun and motivation of a competition, but it's more of a collaborative / cooperative environment. This can be beneficial to students regardless of whether they already self-identify as programmers.

$\endgroup$
1
$\begingroup$

Time pressure is a given in industry. Schedules are driven by a number of factors - company cashflow, legal requirements, changing business environment - which have non-negotiable time constraints. Even professionally, programmers have to make a snap decision about speed versus robustness, and there are often times that speed is critical and you can come back for robustness.

Any student that wrote their own heapsort in the middle of a time constrained project should lose marks unless it can be demonstrated that it required less time to build and gave a better result than the facility built into the language. Unless you have Dijkstra Version 2.0 in your class, I would not expect this to be an issue (but leave the door open for appeal just in case).

Good code is time saving code. Using Java as an example (given my handle, you can guess why, but equivalent practices work in almost any programming language), you can design in javadoc and interfaces, then implement the interfaces. This allows you to follow a complete waterfall methodology (ugh!) with documentation, yet still code at turbo speed and produce robust code.

$\endgroup$
1
$\begingroup$

Some will love it, a few will excel, most will hate it.

Around here we have elective courses preparing for programming contests. They cover more advanced algorithms, more in-depth C++ (or Java, or what have you) and do lots of "hands on" training (e.g. solving problems to be submitted to online judges).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.