With discussions in progress about creating a competitive programming site on Stack Exchange, I have been thinking about what we get out of technical Q&A sites.
For programmers, Stack Overflow is more useful than any other programming Q&A resource. So I’m going to use their approach as a model of what a technical Q&A site is good for.
The goal of Stack Overflow is to give professional programmers a place to teach and learn. It’s not for arguing about languages, collecting “best of” lists, or discussing open-ended questions. Those things all happen to some extent on Stack Overflow, but they’re not what the site is for.
That strict content policy is key to why Stack Overflow is so useful. It influences the other two primary aspects of any Q&A site, questions and answers. For Stack Overflow, the rules are:
Questions: These are required to be actual problems that a programmer is having, not just ideas that people are wondering about. This rule means the site is full of real-world problems that people are likely to encounter.
Answers: After a question is asked, a conversation begins among the asker, answerers, commenters, upvoters/downvoters, and moderators. That process helps shape both the question and the answers. The question gets edited to be more clear. The best answers rise to the top.
The result of this interplay among site users is an artifact that is often more useful to developers than documentation on the same topic. (The Stack Overflow Documentation feature is still fairly new, so I’m just talking about Q&A for now).
Quora has many of the same features as Stack Overflow: question titles; question details; multiple answers that can be upvoted and downvoted; comments on questions and answers; and moderation flags.
It even covers some of the same topic areas as Stack Overflow. You can ask and answer questions about code, algorithms, and programmer tools. But the result is not quite the same, which is why if you Google a specific programming question, the top results are always from Stack Overflow.
For competitive programming questions though, the results are reversed: the top results are from Quora. In fact, the Stack Overflow community actively discourages competitive programming questions, unless people ask them very carefully.
A few months ago, I categorized the types of questions found in Quora’s competitive programming topic area. In that post, I used the following categories: Getting started with competitive programming; getting better at it; pros and cons of doing it; and tools and resources for it.
Those categories illustrate the topics that people are interested in when they ask about competitive programming. But to answer a more general question about the purpose of competitive programming Q&A, I think these categories of questions are more instructive:
- Practical and objective
- Practical and subjective
- Impractical and objective
- Impractical and subjective
Practical and objective
Any good-quality question about a specific competitive programming problem fits in this category. I’m using practical to mean likely to help you get better at competitive programming, not to refer to the distinction between competitive and real-world programming. The practical value of CP solutions is to teach algorithmic thinking, not to solve a business problem using software.
A more specific example: What can be the value of n in competitive programming when it is said that it should pass under 2 seconds? This question is practical because it covers one component of a necessary competitive programming skill: estimating how fast your solution will run on the online judge. And it’s objective because it can be answered by running experiments and presenting data.
This is the target question type for general programming questions on Stack Overflow. Questions and answers of this type address a specific programming-related problem, and there’s a way to evaluate whether an answer is correct.
Practical and subjective
These types of questions are the most controversial on Stack Overflow. They are clearly against policy, but it’s also hard to explain why the site is better off without them, given their popularity. In fact, some of these types of questions are grandfathered in from the early days of the site. For example: The Definitive C++ Book Guide and List. This question is practical for someone who wants to learn C++, but subjective since it depends on a judgement on the relative merits of each book. In general, new “best of” questions like this aren’t allowed.
On Quora, these types of questions are encouraged, and tend to be popular. An example: What are some good books for competitive programming?
Impractical and objective
It’s possible for a question to be completely objective, but also to be useless for the purpose of getting better at competitive programming. For example: Does Gennady Korotkevich have a girlfriend? He either does or he doesn’t, but do we really need to know? Fortunately, these questions aren’t very common in the Competitive Programming topic.
Impractical and subjective
These are the most common category of competitive programming questions on Quora. Here are some examples:
- How is competitive programming different from real-life programming?
- What made you quit competitive programming?
- Is competitive programming really useful?
Impractical in this context doesn’t mean having no value at all. As an analogy: You can write a novel using your phone keyboard. If you work at it long enough, you’ll eventually come up with a phone novel. It’s just not very practical. There are more efficient ways to do it.
Similarly, it’s possible to learn something about competitive programming from these questions, but your skills won’t improve very quickly if questions like that make up the bulk of your reading.
A Math Digression
Let’s switch topics a bit, to see how learning from Q&A sites works for another technical subject.
Imagine that you have a textbook on number theory, and you’re going to use it to learn that topic. You’re also going to use a Q&A site when you don’t find what you need in the textbook.
On Quora, you can find questions like:
- What is number theory?
- What important topics of number theory should every programmer know?
- How can I get started to learn number theory?
There’s nothing wrong with spending some time reading the answer to these questions. Maybe you’ll pick up a few interesting facts or sources. But you’ll soon reach a point of diminishing returns. There’s only so much general information you need about a topic before it becomes more beneficial to just study it. In this example, that means reading the textbook and working on problems.
There are a limited number of general number theory questions to ask on Quora, and most of them have already been asked. (Not that this stops people from asking them again). But the number of specific number theory questions to ask is essentially unlimited, since as you learn more about number theory, you can come up with more questions. Here’s the type of specific number theory question I’m talking about:
How many pairs of integers $(a , b)$ are there such that $a^b=b^a$ and $0 < a < b$?
Just as you can use Stack Overflow as an aid to learning programming, you can use Math Stack Exchange, and even Quora, as an aid to learning math. Used properly, these sites can help clarify specific points that you’re having trouble with. If the “math documentation” (a textbook or academic paper) is too formal, your peers can cover the same concepts in a more understandable way through the Q&A format.
The Best Use of Online Q&A
So what are technical Q&A sites good for? If your goal is to get better at programming, then you should mainly use them for asking and answering very specific questions. After you have read a documentation page or a blog post, and you have tried something out, and it doesn’t work the way you expect, Stack Overflow may have the answer. If it doesn’t already, then you can ask a new question that starts by describing what you have tried so far.
What about the potential Competitive Programming Stack Exchange site? To succeed, it should be full of practical and objective questions. But unlike on Stack Overflow, the questions shouldn’t be about real-world programming problems. In fact, questions about real-world problems shouldn’t appear on CP.SE at all. They belong on Stack Overflow. Most CP.SE questions should have as their starting point an artificial programming puzzle, like those found in programming contests. The answers should describe how to read and understand the problem, how to come up with a high-level solution, how to describe the solution in more detail, how to test it, and how to debug it. In other words: all of the steps required to successfully solve programming puzzles.
(Image credit: opensource.com)