On Stack Overflow, I see a lot of people answering questions with just code. It is not helpful to anyone at all. So, would it be possible to enforce pseudo-code answers? In my opinion, pseudo-code is pretty self-explanatory. Code without any explanation is neither helpful nor informative and no one learns from it.

To all the downvoters: this is not a duplicate question. I wanted to start a discussion about code in answers because it doesn't help the questioner to learn. They just copy and paste. Pseudo-code would encourage them to do research and learn from it.

  • What do you mean by sudo code answers?
    – nhahtdh
    Mar 3 '13 at 8:18
  • While the other question use different approach, the answers there perfectly fit to this question as well. Mar 3 '13 at 8:19
  • The code in words instead of writing it in an actual programming language with methods and etc.
    – RisingSun
    Mar 3 '13 at 8:19
  • @ShaWizDowArd I don't think so. I did read that discussion. Over there, they talk about the code. My idea is to eliminate actual working code from answers and replace it with sudo code.
    – RisingSun
    Mar 3 '13 at 8:21
  • 1
    OK, fair enough. You really better explain what is "sudo code" in the question itself though, it's not common term. Mar 3 '13 at 8:23
  • pseudo, maybe?
    – Arjan
    Mar 3 '13 at 8:24
  • Really? Sudo code is not a common term? Among programmers it is a very common term. Sudo code A.K.A pseudocode
    – RisingSun
    Mar 3 '13 at 8:25
  • 1
    Never heard of it either.
    – Arjan
    Mar 3 '13 at 8:26
  • 1
    @khuderm never heard in my life. Meager 11K results in Google means it's really NOT common. It's like using "tates" instead of "states". Mar 3 '13 at 8:28
  • 15
    It's known only as pseudo-code. Sudo is a misspelling. Mar 3 '13 at 8:28
  • @ShaWizDowArd lol what version of google are you using? It returns over 6M results for me
    – RisingSun
    Mar 3 '13 at 8:29
  • 6
    Nonono. If the problem is code-only answers with no explanation, pseudo-code doesn't fix it. It's possible to write an unhelpful pseudo-code only answer. The problem is the lack of explanation, not the presence of code.
    – AndrewC
    Mar 3 '13 at 8:31
  • 1
    @khuderm hmm Mar 3 '13 at 8:33
  • 3
    With regard to the downvotes: meta.stackoverflow.com/faq#vote-differences
    – Bart
    Mar 3 '13 at 8:43
  • 2
    @khuderm: The problem is that sudo is the actual spelling of a different command. Mar 3 '13 at 9:08

The merits or demerits of a code-only answer is a different matter. But constraining answers to pseudocode would detract from a large majority of answers and add little or no value.

Most importantly (in my opinion), the ability to get a specific answer to a specific question would be lost. Sometimes even experienced developers want to be able to cut-and-paste a useful snippet of code that--from reading it--they determine will suit their needs.

Requiring people to translate every solution would be completely counterproductive.

Taking it a step further, I can't imagine any practical use for pseudocode to abstract a stylesheet language like CSS, markup languages, CIL dumps/explanations, etc.

  • I guess that ends my argument lol
    – RisingSun
    Mar 3 '13 at 8:45
  • I think the better discussions (which have already been had) are around what constitutes a properly explained answer, and when it's better to give guidance (to encourage learning) instead of an exact answer.
    – Tim Medora
    Mar 3 '13 at 8:47
  • I was reading through those discussions and I didn't really see a solution to those kind of answers. I guess downvotes on those answers will have to do.
    – RisingSun
    Mar 3 '13 at 8:50
  • 1
    For better or worse, I think the answer is often "it depends". It's probably why your proposition to force pseudocode met with such resistance. FWIW, I often list out the logical parts of my answer so that the reader can 1) better understand my code and 2) choose to change the actual implementation.
    – Tim Medora
    Mar 3 '13 at 8:52
  • 2
    +1 for CSS sample with no doubts
    – Peter L.
    Mar 3 '13 at 8:57

I do not agree with this idea for the following reasons.

First of all I do not like limitations on how someone answers and tries to give help. If he likes to answer with code, with text, with pseudo code, with images, with whatever he believes can be best for all, then let him do it. Why should we limit him?

If the answer is not good, or does not help, then we have the vote system.

Now, if the person who asks the question likes to learn or not from the answer, is his/her responsibility, not ours. And many answers are not always useful. Also many people ask questions but they are not willing to hear the answer. Even if I have sometimes given code which is guaranteed to work, they argue with me just because they do not understand it – or because they have some other answer in their head and did not like to change that.

Now pseudo-code is one language by itself, but with no strict rules, and this means that everyone can write in their own style, making it difficult to understand and translate. It also makes it difficult to write it because we do not use it as out daily base language.

Also is not useful on the search machines, because users actually search for a function that throws exceptions, and maybe some of them can be on the question, but some other on the answer.

Now, I search a lot for many things on SO, many simple ones, like how to find if a check box is checked with jQuery. A simple call which I just do not remember some times. Some days with hundreds of lines of new code, my mind stops, so I need to see the code fast.

Google "jquery checked is checked" and find .is(':checked')

How that can be pseudo code, and if he can, then is not useful to me and I go way.

At the end, I do some time use pseudo code, but only on paper and only when I design stuff. I do it for me, or for people that are close to me, and if the do not understand it, they have me nearby to explain it. It is not useful after a week that I forget the design – it is useful only for the time when I have the design in my head and write it down on paper before I make it an actually working code. (At least for me)

  • +1 for not imposing limitations. If the best answer is pseudocode (perhaps for an algorithm explanation) then so be it.
    – Tim Medora
    Mar 3 '13 at 10:45

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