There has been several discussions in several meta-posts on this. I think we should settle the issue once and for all.

Do you think programming questions should be on-topic or not? What kind of programming questions can be on-topic?

Please be specific about what you mean by "programming questions", and give examples of the type of questions you are discussing.


I think the programming questions should be off-topic for several reasons:

  1. The area 51 proposal explicitly excluded such questions.
  2. They are dealt with quite well on SO, so no need to deal with them here,
  3. Programming questions per se are not computer science. (see this) (this one seems to be a bit controversial , so less emphasis on this)
  4. Excluding such questions doesn't seem to harm the site,

By a programming question I mean a question about code in a particular programming language and the point of asking for the code is not the programming language itself. A question about a feature of a programming language can be on-topic, e.g.

  • Can someone tell me how the exception handling works in Java?

Questions which are asking for algorithms should not require a prespecified language for the answer and an answer written in pseudo-code should be acceptable.

Questions asking about code in a particular programming language that are not about the programming language itself are off-topic. Typical examples are:

  • give me a program in C to multiply two given numbers,
  • tell me what [this C code] does?
  • analysis the time/space complexity of [this C code],
  • I have written [this C code], but it does not work, can someone help me debug it?

You can replace "C" with another programming language, and replace "multiply to numbers" by another computational problem.


Above I have argued that there is not a need to have programming questions here, and based on other factors like the intended scope of the site, it is better to leave them out. But can having programming questions lead to bad things for this site?

I think so: as demonstrated by half a million users of SO, there is a HUGE community of programmers out there with HUGE number of questions, much larger than the computer science questions we will get. By allowing programming questions we face the risk of computer science questions being a negligible portion of the site and turn the site into another version of SO, which would defeat the purpose of the site as a place for computer science questions (and computer scientists would leave also for the same reason that they are not active as computer scientists on SO). Moreover, since SO works very well for programming questions, we are likely to get question with lower quality than SO.

  • $\begingroup$ Regarding your reasons: (1) Granted, but people can change their minds, sometimes for the better; what if it was (and is) wrong to declare programming off-topic? (2) Overlap with a site is not, by itself, sufficient reason to declare things off-topic... plenty of questions which could do well here could do well on other sites; (3) I'd partially agree that this statement is controversial in that it's hard to provide non-mutually-referential definitions of programming and computer science so that there is not significant overlap (maybe I'm being unreasonable); (4) So it seems, so far. $\endgroup$
    – Patrick87
    Apr 9 '12 at 21:58
  • 1
    $\begingroup$ Regarding your off-topic questions, why does the language, or model of computation, or machine, matter? Why pick on C and not Turing machines, lambda calculus, etc.? "TMs are math and C++ isn't"... so what? Both express a computation that the majority of CS experts would understand. $\endgroup$
    – Patrick87
    Apr 9 '12 at 22:06
  • $\begingroup$ @Patrick87, I have already replied to what you are saying in your later comment in another thread. The point of 2 is not overlapping with other sites. I think me and you have discussed it thoroughly and last time you didn't replied to my last comment, so I don't see repeating them here would change anything. These are the reasons why I think there is no need to have them here, there is no harm to site and user to not have them here, and why it is better not to have them here. Of course you can disagree with them but I still think they are good reasons. $\endgroup$
    – Kaveh
    Apr 10 '12 at 3:02
  • $\begingroup$ I agree with this, I only wonder why would asking about the time/space complexity in a certain language be off-topic here? I may be a bit of a novice to CS, but my understanding is time-complexity and complexity-theory in general are important parts of CS. Is this because asking such a question in a particular language introduces language specific elements into how the language is processed by a compiler/interpreter? My general instinct would be that a question that introduced code in a specific language would be fine as long as the question focused on a CS topic and not syntax or grammar. $\endgroup$ Apr 10 '12 at 3:18
  • $\begingroup$ @BrotherJack, what people typically want is the complexity of the algorithm, in which case the algorithm should not be language dependent and it should be possible to restate it in pseudo-code. Bench-marking people's code is what I think should be off-topic. I gave that as an example of "analyze my C code" questions, but my opinion is not strong on this example. (A partial reason is that I fear we may get overwhelmed by people posting their code and asking us to analyze them, but those questions can probably be closed as too localized also.) $\endgroup$
    – Kaveh
    Apr 10 '12 at 3:26
  • $\begingroup$ @BrotherJack So syntax and semantics aren't CS topics? $\endgroup$
    – Patrick87
    Apr 10 '12 at 11:10
  • $\begingroup$ @Patrick87, that was worded poorly, "grammar and syntax" are typically CS topics. I was meaning to refer to LANGUAGE SPECIFIC "grammar and syntax", but ran out of room (in terms of comment space ^ attention). Certainly concepts such as the Chomsky normal form, context free grammars, etc are definitely CS concepts. The "syntactic sugar" implemented in python or the legal means of writing a C for loop are better left to other forums however. $\endgroup$ Apr 10 '12 at 11:40
  • $\begingroup$ @BrotherJack Better left to other sites, maybe; part of computer science, I fail to understand why not. I agree there should be a distinction, but how can a fair, useful, and helpful distinction be made? $\endgroup$
    – Patrick87
    Apr 10 '12 at 11:54
  • 1
    $\begingroup$ @Patrick87 My consideration would be because they are simply matters of preference based on a developer's personal taste. While a great deal of language design does involve CS topics (ie. what is relevant here), those topics can be abstracted out from the language specifics and presented in a language neutral way. When they can't they typically (although, conceivably not always) become more relevant to developers, IT experts, and programmers rather than scientists as they are technological implementation details tangentially related to computer science. That's my understanding at least. $\endgroup$ Apr 10 '12 at 12:03

Define programming as the act of writing a program. A programming issue is some issue that prevents you from writing a particular program. An algorithmic issue is a programming issue whose cause lies in the programmer's understanding or knowledge of some algorithm (to the point of not knowing the algorithm at all). I won't attempt to define what is an algorithm and what isn't.

An example of programming is me, trying to get my LR(1) parser generator working before Thursday. An example of a programming issue is the C# compiler crashing when I tried to compile some of my generated C# code that initialized my tables (the tables and therefore the code file was too big). An example of an algorithmic issue is me not knowing how a shift-reduce conflict should be solved if precedences are given and I have multiple conflicts in the same state on the same lookahead.

All programming issues that are not algorithmic issues should be off-topic.

There's really only one good reason for this: a huge part of SO would otherwise become on-topic for this site. Overlap is a good reason to declare a topic off-topic: the reason this site has only come into being a month ago and not years ago is that there was perceived potential overlap with other sites. Feeding that perception by declaring half of SO on-topic is a very bad idea.

The second reason is that programming issues that are not algorithmic issues don't really belong to computer science: a computer scientist shouldn't be interested in all the nitty gritty details of the Real World, as signified by big-oh notation and abstract models of computation. These issues are caused by irrelevant details that can be overcome, and we should therefore not be interested in them from a true Computer Science standpoint.

Note that these 'details' I'm talking about may be very complicated and hard to overcome, but there's no interesting theoretical background to them: details that do have such a background, like IO-efficiency, numerical analysis (finite precision), human-machine interaction, have been formalized and studied as Computer Science, and should therefore be on-topic.

Now, assuming that we indeed make this off-topic, there are two further points to this decision. We need to decide where the line lies, and how to communicate this line.

My proposed criterion is what I already said above: any issue that is algorithmic in nature should be on-topic, everything else is off-topic. It shouldn't matter what programming language is used to communicate the algorithm (issue) in question.

A clearly off-topic question would then be "What does this piece of Perl code look like in Python?". An on-topic question would be "I'm trying to implement an algorithm that uses hashtables in functional programming language X, but it doesn't have hashtables, what should I do?". An off-topic question would be "What's wrong with this mergesort implementation" (assuming the problem is, say, an off-by-one error somewhere).

On how to communicate this line, I'd suggest doing two things: have a vague, understandable rule-of-thumb that errs on the side of on-topicness, along with the exact criterion above. With any luck, the people that aren't sure what their problem is decide to try their luck based on the vague rule-of-thumb, while we still have the exact criterion that empowers us to close questions that are off-topic, without the possibility of a discussion whether that closure was warranted based on the rules.

  • $\begingroup$ "These issues are caused by irrelevant details that can be overcome" -- I wish that was always true. Still, I agree with your position. $\endgroup$
    – Raphael Mod
    Apr 10 '12 at 5:31
  • $\begingroup$ "a Computer Scientist shouldn't be interested in the nitty gritty details of the real world"... and you'll understand why this, and the rest of that paragraph, make it sound an awful lot like what you want is more permissive cstheory, not an inclusive site for various kinds of computing disciplines, some of which the community would probably like to see, which are inextricable from real-world details. $\endgroup$
    – Patrick87
    Apr 10 '12 at 11:19
  • $\begingroup$ @Patrick87, I think this is a matter of degree, as I see logic in both sides here. I think that attempting to completely extricate all "real world" implementation details isn't really feasible (or desirable), and even if it was the pendulum would then swing to most of this forum essentially becoming "on-topic" for math.SE. On the other hand, Alex is right to point out that CS is distinguished from SO, SU, and programmers by being a more abstract side of the computing discipline. That sort of "middle ground" is to me the essence of CS and I think we should embrace it. $\endgroup$ Apr 10 '12 at 11:49
  • 1
    $\begingroup$ Some of the 'real world details' are analyzed in a Computer Science way, such as IO-efficiency, numerical analysis, human-machine interaction, and are then on-topic. The details I was talking about are along the lines of 'my program doesn't compile because I don't know how to configure my IDE to link OpenGL'. These details may be hard or next to impossible to overcome, but that does not mean that they can be overcome: there is no theoretical barrier. I'll clarify my answer. $\endgroup$ Apr 10 '12 at 12:24
  • $\begingroup$ @Patrick87: I don't see how it can sound that way unless one thinks CS = TCS + Programming. $\endgroup$
    – Raphael Mod
    Apr 10 '12 at 14:38

Well, I seem to be the one instigating all of this, so the least I can do is to provide an answer and let the community treat it as it well.

Short answer: It depends on the programming question.

Long answer: I believe that the best solution is to:

  • simply admit the impossibility of determining, in general, whether a specific programming question will be on- or off-topic;
  • be as forthcoming as possible about this in the FAQ, and try to provide some general guidelines for programming questions which might be appropriate here;
  • allow the community to determine on a question-by-question basis what questions do well here, and what questions don't.

There are several reasons for which I hold this belief:

  • the boundaries and distinctions between various computing fields are likely not as clear as individuals' perceptions thereof, and such perceptions likely vary from individual to individual, making meaningful classification practically impossible;
  • by making clear the especially delicate nature of the relationship between programming and computer science, interested users (i.e., people who stand a realistic chance of reading the FAQ at some point in time) will be more sensitive to the issue at hand, and be able to make potentially better-informed decisions regarding asking, closing, and reopening questions;
  • allowing for the possibility of good programming questions might have several benefits for a site such as this, and there seems no reason to believe that the likelihood of the site's benefitting in the long-term from increased traffic, questions, answers, audience, perspectives, etc. is significantly less than the likelihood of the site's being damaged by a large number of poorly-received content.

Declaring "computer programming" as off-topic unfairly and unproductively excludes a large number of potentially interesting questions and the users who might ask them, receive answers from a computer-science perspective, benefitting both themselves and the community.

Declaring "computer programming" as on-topic provides the community with no charter, or mandate, or moral authority to exclude a question only on the basis of its being a programming question, which could make it impossible to meaningfully distinguish this site's scope from a variety of other sites' (Stack Overflow, Programmers, etc.)

The community's reserving the right, without providing a guarantee, to close programming questions as off-topic is both more inclusive than the former solution, and does more to appropriately limit the scope than the latter solution. Where it is weaker than the others is that it does not provide a clear answer to the question of whether any given question will be on-topic.

I believe it is better to be inconclusive all the time, and allow specific circumstances inform the community's decision, than to uniformly (and, in some cases, possibly incorrectly) influence the community's behavior, when it comes to passing judgment on questionable content. If the community doesn't agree that the relationship between programming and computer science is questionable, or debatable, or controversial, that is a separate discussion... and one which could be impossible to satisfactorily resolve.


Alternatively, or in addition to the above, the FAQ can attempt to provide a working, or practical, definition of the site's scope, so long as the motivations are made clear in the FAQ (e.g., too much overlap with Stack Overflow, or too much potential for poorly-placed questions, etc.)... so long as the policy which informs and guides the community is accurate (in terms of representing true motivations).

Examples of programming questions which could be considered on-topic

Given this language or formalism implementation of algorithm or process, what is the meaning of part of implementation / what does part of implementation do / why is part of implementation needed / can part of implementation be replaced with part of implementation?

Reason: Such questions require (a) the ability to read and understand the syntax and semantics of the language or formalism being used, which might come to bear on any correct answer to the question (of course, it might not!); (b) the ability to read and understand the a*algorithm or process* which the implementation encodes, and what effects on correctness/efficiency/etc. changes to the algorithm or process would have; (c) the ability to relate the ideas of algorithm or process to language or formalism, which is of fundamental importance in computability and complexity (i.e., can you do X in Y, and if so, can you do X in Y with complexity Z?)

More generally,

Does definition of computational process or structure, expressed in language or formalism, satisfy the property well-defined property for the indicated language or formalism?

Reason: Computer science provides unique tools for analysis and understanding of computational artifacts, allowing (in many, but not necessarily all, cases) for clearly reasoning about characteristics of those artifacts. The language or formalism employed to express those artifacts should not be a primary concern, so long as the the communication to the community is successful, and the artifact/language (or appropriate models thereof) are subject to the tools of computer science.

Note that nobody, including me, is advocating allowing questions that ask for an implementation in a programming language. Those questions should be closed, but for other reasons. Questions which do not show any effort to understand the problem can be closed, for other reasons. Questions which are argumentative or which use a significantly non-standard or incomprehensible notation can be closed, but for other reasons. Otherwise perfectly acceptable questions, for which this community fails to provide a reasonable answer, can be migrated to appropriate sites. It's this last point that presents the only difficulty with my solution: unless SE provides automated means of identifying such questions, it could mean a lot of work for moderators, or questions languishing for a while. Whether this problem would be serious or not is unknown; and in any event, I believe the community could find a way to fix it.

  • 3
    $\begingroup$ Please provide examples so others can understand what you mean by programming questions. As long as we leave it undefined and everyone interprets it differently we are not going to reach anywhere. $\endgroup$
    – Kaveh
    Apr 10 '12 at 2:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .