The Competitive Programming Debate

Which of the following statements best describes your opinion of competitive programming?

  • -2: It is harmful to the software industry, and should be abolished.
  • -1: It’s no worse than any other form of entertainment, but it has no educational value.
  • 0: It may help some people get better at programming, but it’s a niche hobby.
  • 1: It’s a good way to get better at programming. Every programmer should try it out a few times to see what they think.
  • 2: It should be a required part of all college algorithms classes.

I’m not conducting a survey. These are just statements representing the range of opinions that I have seen while reading the Competitive Programming topic on Quora. (Actually I’m not sure if I have ever seen (2)).

As with any controversial topic, it’s common for people to talk past each other when discussing the pros and cons of competitive programming. In this post, my goal is to express the various arguments as clearly as I can.

That’s not to say that I am neutral on the matter. My opinion is closest to (1). I have written a post about reasons to study competitive programming, and of course much of the content on this blog deals with using competitive programming puzzles for learning. However, I’m always interested to hear differing opinions, especially when they have good arguments to back them up.

With that framework in mind, let’s take a look at what people are saying about competitive programming.

Claim #1: Competitive programmers are all serious competitors

When we talk about competitive programmers, who are we talking about? As I wrote in What is Competitive Programming?, that term could be used to describe someone who is using an online judge to learn programming for the first time, an expert who has a good chance of winning a major programming competition, or anyone in between.

People don’t directly claim that every competitive programmer is a potential contest winner. That wouldn’t make sense. But they often indirectly invoke this claim when they make other statements about competitive programming. For example, when someone describes competitive programming success as mainly about “remembering obscure facts and algorithms,” they are implicitly talking about top competitors.

The challenge for competitive programming beginners is just to become fluent enough in a language that they can submit one problem during a contest. Contest designers intentionally include ad-hoc problems that don’t require any particular algorithm, let alone an obscure one. This is to give beginners, who make up the majority of competitors (see my what is article for the TopCoder rating distribution), a chance to solve at least one problem.

Think of Claim #1 as a meta-claim that people unconsciously make when claiming other things about competitive programming.

Claim #2: Competitive programming teaches bad habits

Here’s the argument behind this claim:

(a) Programming habits are formed by repeatedly programming in a particular way.

(b) Programming competitions reward solving problems and submitting solutions quickly.

(c) The best way to accomplish (b) is to use techniques like macros (for C++), short variable names, long functions, minimal use of OOP principles in OO languages, and other practices that would be discouraged in real-world development.

(d) Competitive programmers take the habits they learn in programming competitions and apply them to their real-world programming tasks.

Claim #2 may sound reasonable: everyone knows that competitive programmers write in a style that isn’t compatible with real-world programming, and why wouldn’t they bring this style with them when they start at a real programming job. But the individual arguments that lead up to this claim don’t hold up as well.

(a) is generally true about all habits, so there’s not much to argue with there.

(b) is related to Claim #1. Top competitive programmers certainly have to prioritize speed in order to maintain their rank. But the majority of participants just want to submit a correct solution or two. That doesn’t mean they can think and code as long as they want, but they need to focus more on the correctness of the easy problems than experienced competitors do.

(c) also illustrates the difference between beginning and experienced competitive programmers. While serious contestants often do use these tricks, they are not as useful for beginners, who might just increase their debugging time by writing in “contest style.”

(d) is where opinion especially comes into play. There is anecdotal evidence on Quora from people who say they have worked with competitive programmers who exhibited poor practices, or say they wouldn’t hire a competitive programmer. But that doesn’t say anything about how competitive programmers in general perform on the job. See Claim #5 for more on this point.

Another point to consider is how bad these presumed “bad habits” are compared to the habits of the average new CS graduate. Plenty of college students arrive at their first programming jobs with bad habits. College assignments are often based on artificial problems and completed in haste. This sounds a lot like competitive programming. Pradeep George Mathias argues that competitive programmers may actually develop better habits than their peers because the experience of debugging under pressure forces them to write code that they can understand.

Claim #3: Competitive programming is useless

Some people take the position that competitive programming has no overly positive or negative effects. It’s in the same category as a casual video game habit. Here are some reasons they give for that view.

It doesn’t teach software engineering skills

Argument: Most programming contests focus on small puzzles that contestants solve using small programs which they throw away after the contest. Therefore, practicing competitive programming is not a good way to learn skills related to requirements gathering, system design, working with other disciplines, and other aspects of engineering a real software system.

Response: Not all programming contests focus on the same skills. ACM/ICPC is team-oriented. TopCoder hosts a number of competition types, including types that focus on software design, graphic design, and testing. However, it’s certainly true that the highest-profile and most popular contests feature algorithmic problems. So someone whose only exposure to programming comes through programming competitions will lack practice in the parts of software engineering that these competitions don’t target. On the other hand, they will be skilled in the parts that the competitions do target, namely building and debugging small modules. This is the subset of a programming job that is covered in a typical computer science curriculum. In other words, they’ll be no worse off than other CS graduates, and they’ll probably be better prepared in some areas.

Professional programmers don’t spent much time writing code

Argument: In this highly-upvoted Quora answer, Spotify engineer Mattias Petter Johansson estimates that he spends 95% of his time at work discussing what to build, reading other people’s code, and diagnosing bugs; no more than 1% of his time thinking about asymptotic computational complexity; and 4% of his time writing code for new functionality. If he is representative of software engineers, then improving coding ability won’t have much of an impact on an engineer’s overall productivity.

Response: In general, the proportion of a work day that a developer spends on coding decreases as they become more senior. Developers who are just out of college spend a lot of time coding because they are mainly working on tasks assigned by their more senior colleagues. Senior people get assigned more architectural and planning work because they have the experience to make good decisions. Mattias’s numbers seem skewed even for a senior developer. Consider that software companies have to build new products or new features for existing products in order to keep up with the competition. New features means new code, which someone has to write. If too many developers are spending only 4% of their time on new functionality, the product is likely to get stale.

I think the way to approach this argument is for each developer to ask themselves what kind of job they want. People who want to spend less time coding and more time on other activities can find positions where that’s what is needed. They will benefit less from competitive programming experience. There are also plenty of opportunities for people who mainly want to write code. For them, some amount of competitive programming practice is a good investment.

Algorithms aren’t used much in real-world programming

Argument: Most competitive programming focuses on problems that are designed to be solved using specific algorithms, so competitive programmers need to study those algorithms. But professional developers don’t spend much time applying and creating algorithms, so the algorithm experience provided by competitive programming practice wouldn’t help them much.

Response: This argument uses a narrow definition of what it means to apply or create an algorithm. It’s true that competitive programmers study a much wider range of algorithms than a professional programmer needs. It would be rare for a professional programmer to use segment trees. But there are plenty of data structures like queues, lists, and hash tables that programmers use on a regular basis.

Is competitive programming overkill for learning these simple concepts? It would be if most competitive programmers were advanced practitioners. But as argued in the response to Claim #1, most competitive programmers are beginners who practice the ad-hoc and other basic problems that don’t require advanced algorithms. Becoming competent at competitive programming requires a large initial investment in problem-solving and programming language fluency skills which are useful in any programming job. Learning advanced algorithms is only required for those who want to move into the long tail of elite competitors.

Competitive programmers should work on something else instead

Argument: Since competitive programming is useless (see the previous arguments), competitive programmers should redirect their efforts to real-world projects.

Response: Some competitive programmers, in response to this rather pushy argument, respond with “mind your own business.” Another way to approach this argument is just to acknowledge that competitive programming is not for everyone. Just as people have preferences for different programming languages, programmers choose to do different things with their time. Arguing that there are benefits to competitive programming doesn’t mean that everyone should do it.

Claim #4: Competitive programming is harmful

Some critics of competitive programming go beyond saying it is useless, and argue that it it actually harmful. Here are some of their arguments.

Competitive programming prevents more important work from being done

Argument: By putting too much emphasis on competitive programming, programmers are building an excessively narrow set of skills. This could lead to decreased innovation in the industry.

Response: This is related to the previous argument that competitive programmers should do something else with their lives. As Brian Bi wrote in his answer, people get to choose where to spend their free time. If they’re getting something out of competitive programming, it makes sense for them to do it. The question authors theorize that competitive programming suppresses innovation or entrepreneurship. But these things only happen when people are free to pursue what they’re interested in, which in some cases is competitive programming.

Competitive programming confuses CS undergrads

Argument: Competitive programming has a high profile in computer science departments, especially outside of the United States. It also bears a resemblance to coding interviews, which most CS undergrads are concerned about. This can cause students who wouldn’t otherwise encounter competitive programming to get distracted by it in an effort to avoid missing out.

Response: The questions that come through the Competitive Programming topic on Quora, do seem to indicate that this is a problem. For example, people write things like, “I think the only way to become smarter in programming is to study hard in algorithms and competitive programming.” Nevertheless, people go to college to learn critical thinking. This is just one of many opportunities to evaluate what their peers are doing, and not just blindly follow the herd.

This is not to say that competitive programming should necessarily be built in to the computer science curriculum. Thomas Cormen, co-author of the well-known CLRS algorithms textbook, points out that a CS class with a mandatory competitive assignment could discourage new students from pursuing the subject. But that’s different from having competitive programming as an optional activity on campus.

Competitive programmers stole my room

Argument: I can’t believe my class got evicted from their regular computer lab for something as useless as a programming contest.

Response: There’s not much to say about this one. Some people really don’t like competitive programming.

Claim #5: Google proved that competitive programmers make poor employees

If only there was a scientific study on the relationship between competitive programming and job performance. Earlier this year, Peteris Krumins posted an excerpt from a video that has since been referenced in discussions of that subject.

Argument: A Google study shows that competitive programmers are less effective at doing real-world programming than programmers in general because they are focused on solving simple problems quickly.

Response: You can read some responses to this video clip on Quora. The common thread is that, even if the study is valid (which one person questions), it only considers people who were hired by Google. Passing a Google interview requires many of the same skills as doing well in a programming competition. So if we looked at all applicants to Google, competitive programming performance would certainly correlate positively with getting hired. If Google was finding more qualified candidates than it needed and it wanted to use the results of this study, it could decide to use competitive programming results as a tiebreaker to distinguish between otherwise qualified candidates (and hire the candidate with less competitive programming experience). In reality, software companies are always short on talent, and Google runs its own programming competition to attract more applicants.

Key Points

If you read about competitive programming on the Web, you’ll repeatedly hear the claims discussed in this article. I have discussed a number of popular arguments and responses. Here’s how I would sum things up:

Competitive programming isn’t for everyone

There’s no reason why a programmer who tries competitive programming and decides that it isn’t for them should continue studying it. There are other ways to get better at programming. For interview preparation, there are books like Cracking the Coding Interview that offer targeted advice about the types of problems interviewers ask. For programming practice, building something useful, even if you’re the only one who uses it, is a tried and true learning technique.

But it’s not just a hobby or a game

Some people compare competitive programming to sports, and even use the term sport programming. There are certainly some similarities between the two activities: both of them feature points, fun, and countdown clocks. But it’s rare to turn a sports hobby into a lucrative career. Competitive programming, in contrast, covers some of the same skills taught in the computer science curriculum, but at a much deeper level. The sports or hobby analogy can seem like a way to find common ground with those who claim that competitive programming is useless or harmful: “Chill out, it’s just a hobby! We’re having fun over here!” It certainly can be fun, but it’s also more than that.