40

What is the minimum requirement for an answer, i.e. a "minimal answer"?

There is a guide to writing a good answer (How to Answer) but often we don't have time to write a novel, the question can be answered in two lines of code and clearly the person asking didn't put in too much effort either. What is the minimum I should post in an answer? (Yes, I want to post it as an answer instead of a comment.)

  • Is it ok to post only code if it is self-explanatory?
  • Do I need to write prose?
16
  • 14
    is self-explanatory code self-explanatory for everyone? That's what you should think about. Just because you understand it easily doesn't incldue that everybody understands it that easy. If unshure better write some explanations to it.
    – DocRattie
    Commented Jul 8, 2015 at 12:26
  • 18
    If the person asking did not put much effort into their question, are you sure it's worth answering it in the first place? Commented Jul 8, 2015 at 12:28
  • 13
    Questions and answers should be useful to more people than just the one who asked the question. Commented Jul 8, 2015 at 12:29
  • 10
    "clearly the person asking didn't put in too much effort either" - then I'd advise you to downvote the question and not answer it. Or if you're sure that it's a common problem that's not already answered on SO, edit the question to make it better before answering. Regarding your actual question, answers that only consist of "try this [code dump]" are very low quality IMO. At least take the time to summarize the solution in two or three sentences - otherwise you might solve some wannabe coder's problems by providing copypaste code, but don't help people understand your solution.
    – l4mpi
    Commented Jul 8, 2015 at 12:30
  • 1
    I think the most minimal answer I've used is 'No'. There are a few questions when it's appropriate. Commented Jul 8, 2015 at 12:36
  • 1
    @MartinJames "Body must be at least 30 characters; you entered 2". I guess it's not always been like that? Commented Jul 8, 2015 at 12:55
  • Short code-only is going to upset automatic quality processes, isn't it? Commented Jul 8, 2015 at 12:56
  • 1
    The minimal answer is a meaningless 30 character combination. However, that would not be a very good answer. Answers are measured by how useful they are to OP and bystanders (upvotes) and by whether or not they solved OP's problem (acceptance). Upvotes are subjective. You do not need to write prose or anything meaningful for that matter, you need to use common sense and provide a solution that will be useful to people and attempt to solve OP's problem. Commented Jul 8, 2015 at 12:56
  • 2
    It depends on the question. If the question is of the form "I'm trying to do X in SPITBOL, I wrote this statement but it does Y instead, Help." The answer might be as simple as "The third positional parameter in the SNARK statement should be in furlongs, not metres, like this: (1 line of code)." But if the scope of the question is broader, the scope of the answer should be broader too. Commented Jul 8, 2015 at 13:04
  • What do you include under self-explanatory code ? Commented code which explain what it does, or raw code supposed to be self-explanatory by the functions/methods name ?
    – Tensibai
    Commented Jul 8, 2015 at 16:22
  • Thanks for the many replies. Many of you have aimed at "what is a minimal good answer?" and that's great for the spirit of SO and also my goal btw. However I really intended what is a "minimal answer" without specifying minimal too much. Seeing all these answers and comments, I guess I meant minimal as "won't get downvoted/flagged but unlikely to draw any upvotes either".
    – mts
    Commented Jul 8, 2015 at 17:28
  • 2
    @mts but why would you ask about that? If you're out to do the bare minimum effort to not get flagged, why make the effort at all?
    – Gimby
    Commented Jul 9, 2015 at 8:59
  • 3
    @mts "...but often we don't have time to write a novel...". Why not? Better one nice answer than five poor answers, after all here we're not paid according to how many answers we provide... Commented Jul 9, 2015 at 11:43
  • 1
    @Adriano: besides which, writing the minimal amount for a good answer takes even longer than writing too much. Commented Jul 9, 2015 at 12:34
  • @SteveJessop I absolutely agree, unfortunately to be able to write minimum amount is a skill, no matters how hard you try (and I can say because I know I don't have). Commented Jul 9, 2015 at 12:35

6 Answers 6

11

I see you ask what a "minimal" answer should contain. We can all agree that a "minimal/sufficient/bare bones" answer will not necessarily be a "good" answer (though it might be, but that's a story for another day). Some of the other answers here discuss what a "good" question should contain; I'm not even going to touch that, and instead go straight to your question:

What should an answer contain to clear the downvotable bar of "not helpful" and qualify as minimally helpful?

  • Enough information to plausibly solve the OP's question. Self-explanatory code qualifies, if it satisfies this criterion.
  • If the answer is meant to only partially solve the question, then the answer should state this. In prose.

Starting from this, you can add more to turn this minimal answer into a good or even great one.

0
68

I almost always downvote answers in the format of "Try this [code block]".

Sure, code may be self-explanatory, but such an answer does not tell me:

  • That the answerer actually understood OP's problem and fixed their code (you're doing X, but you should do Y, which this code does).
  • That the answerer didn't just paste OP's error (if any) in Google and copied the first result (so it's really a guess, "try this, I don't know what it does but it might work").
  • That the answerer is someone who doesn't teach people to keep warm, but instead sets them on fire: "copy this snippet, it'll solve your problem".

It is hard to gauge the quality of "try this"-answers without thoroughly reading them and guessing at what the original poster thought was the problem and thinks how their answer will fix that (and this counts double for later visitors through Google - who may or may not have the same problem and have no choice than to carefully analyze the code to evaluate themselves what the code is supposed to do, and hope it fixes their problem, which may be different), so I don't consider them helpful - and downvote.

23
  • 40
    "Try this" for code is one of my least favourite types of answer. The chances of being correct must be smaller if they have to "guess" at an answer. I also love the "Let me know what happens"-type continuations. Especially "If it works, remember to accept my answer!". Commented Jul 8, 2015 at 13:43
  • 1
    @BillWoodger the second example you mention usually results in me flagging as Not an Answer. The third example you speak of, iirc, is against the rules (though don't quote me). By proxy, they're usually not formatted well to begin with and usually deserve a VTD for other reasons. Commented Jul 8, 2015 at 19:23
  • 6
    I hope you don't downvote an answer just because it has the words "Try this" in it without reading the entirety of the answer. If you do, then that is quite hypocritical of you, given that you probably haven't given enough effort into understanding the answer itself. Many good/complete answers contain those words....
    – ldog
    Commented Jul 9, 2015 at 0:16
  • 7
    @ldog of course it's on a case by case basis, but i usually do when that's the only non code content of an answer, because of the reasons specified in my answer.
    – CodeCaster
    Commented Jul 9, 2015 at 6:44
  • 4
    @BillWoodger "Try this" in itself must not necessarily be bad. Very often I find myself in a spot where I do not have the resources to thoroughly test my suggested answer. Nevertheless I usually think it through very carefully and then try to present it without any errors. In these cases the "Try this" signals that the code is untested. But it is always followed by a detailed explanation of I want to achieve and how it is done. And, no, I don't usually google my answers anyway ... Commented Jul 9, 2015 at 11:40
  • 7
    @Steve if the question isn't clear, you shouldn't answer, but ask for clarification in comments instead.
    – CodeCaster
    Commented Jul 9, 2015 at 11:53
  • 1
    @CodeCaster: If the question is unclear what's being asked, sure. But if the question refers to an unambiguously observable phenomenon with multiple possible causes and corresponding solutions, then IMO one should answer. Aside from anything else, the necessary steps for diagnosis are part of the "correct" procedure that a competent programmer would go through, and therefore should be part of a good answer. Commented Jul 9, 2015 at 11:55
  • 4
    Besides which, if 99% of the time the problem is solved by X and the other 1% requires Y, then "try X" is quite a good answer. A comment saying "does X solve it?" is 99% likely to be just an answer in comments. As I already said, "first try X, and if that's not applicable then do Y" is an even better answer. Commented Jul 9, 2015 at 12:00
  • 1
    @Steve in my answer I'm talking about answer that literally state "Try this code block". Questions asking "What can be the cause of X?" sure can have answers with uncertainty in them (which you seem to be talking about) in the form of "It could be Y, try Z". Those aren't the greatest questions (or answers, for that matter) either.
    – CodeCaster
    Commented Jul 9, 2015 at 12:01
  • 1
    @cars10 I don't think your type of "Try this" is a problem. It is not the words "Try this" that are problematic, it is the presentation of a chunk of code which is effectively "here's my guess, and that's the end of it". Sometimes it is going to be an educated or reasoned guess, and may even be insightfully correct, but is presented as "here's my guess" because the explanation is missing. Commented Jul 9, 2015 at 12:17
  • 9
    @SteveJessop it is not the words "Try this". It is when the "Try this" is, in substance, the entire description of the code. "Try this, I think it is unloaded" says someone handing you a revolver for your shot-in-the-head magic trick. Even a good "Try this" answer is hinting at a deficient question. For me, I get clarification, even if it means someone else guesses in the meantime or is faster than I once sufficient information is known. Long ago a guess cost me a lot of time and embarrassment. I really dislike guessing. When I do, I always qualify by "but guessing isn't really much use". Commented Jul 9, 2015 at 12:24
  • 3
    @Jean did you on purpose skip the body of my answer to comment on the semantics? I think I explained very well why I don't consider such answers helpful. You don't know what the poster was thinking, so you cannot evaluate its correctness. I have added the latter to the answer now.
    – CodeCaster
    Commented Jul 9, 2015 at 12:40
  • 3
    While I fully agree with the above, I have to stress that if I had to down vote all answers I stumble upon that are just guesses, I'd spend all my time/rep doing that. I have the impression that the tag I'm active on (android) mainly sees rep junkies posting rushed-answers on "easy" questions, without even taking the time to guide the new programmers towards proper documentation, good practices and clean code (in fact, quite the contrary, I see lots of links to old blogs, malformed code, etc). Sometimes answerers will even admit they have no idea what their code does... We're being overrun :-/
    – 2Dee
    Commented Jul 9, 2015 at 12:54
  • 6
    @Jean what is "fair"? This site isn't like Facebook, where anyone who can use a keyboard has to be heard; it's intended to be a collection of high quality questions and answers. I use voting for quality control.
    – CodeCaster
    Commented Jul 9, 2015 at 13:22
  • 5
    The other day I came across a user who cited "no chit chat" as a reason for posting code-only answers, and insisted that such answers were better than teaching people to fish because most people only care about solving their problem ASAP. Apparently exposition is considered chit chat now...
    – BoltClock Mod
    Commented Jul 9, 2015 at 17:02
8

An answer should facilitate learning and understanding. Although a block of code may solve a user's specific problem in the context of their code, it may not be helpful to other users attempting to solve their own problems without any sort of explanation.

As far as posting "code only" answers, you may find yourself down voted and/or flagged for a very low quality answer even if it is technically correct. It's hard to say exactly how little explanation is needed to satisfactorily explain the code you provide, but it is easy to spot an answer with insufficient explanation.

7

An answer must, at minimum, solve the problem experienced or otherwise answer the question.

1
  • 3
    Since no one else posted a self-demonstrating answer yet.... Commented Jul 10, 2015 at 2:49
6

You can explain your two lines of code with a little more than "Try this". There can be subtle differences with what the asker has already attempted, which are not as obvious as you think they are. Sometimes a comment that points a glaring omission on the asker's side, followed by a remedial patch of two lines of code, is all that you should do for your answer to be "minimal good answer".

So yes, write prose, and explain your code like to a junior programmer. Not to a five year old kid, but to a person who is able to read code in the slightest, but might not be aware of why this bit of code would do what he wants.

3

A good answer is made up of:

  • Understanding what the supplicant is asking.
  • Explaining why.
  • Explaining how to avoid it.

Code helps to illustrate these things, because this is a coding site, but personally I feel 'code only' answers aren't really able to be 'good answers' in all but he most trivial of cases.

I particularly get a little frustrated by the competition I see in certain tags where we have a bit of one upmanship in playing code golf - making the ultra-concise regex, one liner etc.

Not that they are technically incorrect, or that they don't demonstrate programming skill... but that almost by definition someone asking a question is doing so because they don't understand, and baffling them with whizz doesn't help understand, and encourages cargo cult programming.

You must log in to answer this question.

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