Hot answers tagged

122 votes

Is it bad practice to post a short answer first and then add details afterwards?

You are welcome to post a first version of your answer as fast as you can, provided it is already a correct and useful answer meeting our minimal standards. Regarding whether doing lots of edits is ...
Deduplicator's user avatar
  • 44.7k
115 votes
Accepted

Should we edit a question to transcribe code from an image to text?

I feel that we should not be editing a post to transcribe code in an image into text. Some of these reasons have already been touched on in the other answers, such as: Could introduce errors. Might ...
Thom A's user avatar
  • 89.1k
88 votes

But seriously. How to be nice when trying to say the code is crap?

The idea you're trying to communicate is inherently not nice. So don't bother trying to communicate it. Downvote, close vote if it's appropriate (if a post has lots of disparate bugs, then it's Too ...
Nicol Bolas's user avatar
80 votes
Accepted

Are imports useful when posting code on answers?

From your comment on another answer: Probably I didn't explained quite well, but, when I ask a question, should I add them or not? Absolutely That is part of what an MCVE is. To make sure a ...
Darrick Herwehe's user avatar
70 votes
Accepted

Answers with large amounts of code (whole scripts)

I'mma squint real hard and try to see what this question is. im trying to get my data from a .txt separated into a dataframe. the text file looks like this this is a shortend version of what im ...
Makoto's user avatar
  • 104k
57 votes
Accepted

Edited question made less readable

The editor probably thought that since it was not code, the closest thing is a quotation of the console. Therefore, change a code block to a block quote. Since it does not make the question easier ...
zondo's user avatar
  • 20k
53 votes
Accepted

How best to correct poor coding practice which isn't related to the answer

Yes, a comment would be appropriate. To give an example, there must be at least a million comments in the php and mysql tags along the lines of Please note that mysql_ functions are unsafe and ...
Glorfindel's user avatar
52 votes
Accepted

Should questions about obfuscated code be off-topic?

Should questions about obfuscated code be off-topic? Yes, they should be off topic. Why? They are generally either too broad or unclear. Too broad, because posting obfuscated code is basically ...
Dalija Prasnikar's user avatar
51 votes

Are edits that insert Swift 3 code into existing Swift 2 answers acceptable?

I have no doubt that this user means well - and most users doing similar edits probably mean well too. But such edits are not updates to the existing code, they are new answers entirely. An update ...
Eric Aya's user avatar
  • 69.5k
46 votes
Accepted

Are backticks appropriate for emphasizing references to things that show up in code?

Yes, this usage is acceptable. Identifiers that are found in source code are code, and therefore it's acceptable to format them as if they are code. The rule is, inline code formatting is only for ...
Cody Gray - on strike's user avatar
45 votes

Should we edit a question to transcribe code from an image to text?

No, it is clear from the tutorial and help pages that code and data must be in text form, so that it can be reproduced. So close these questions for a lack of details.
nbk's user avatar
  • 46k
44 votes

Is it bad practice to post a short answer first and then add details afterwards?

Is it bad practice to post a short answer first and adding details afterwards? No. It's the key to get high a reputation as the Fastest gun in the west :-) Joking aside, I can see its benefits, ...
Bergi's user avatar
  • 633k
42 votes

Should code from pastebin be edited into a question?

In general, yes. Questions should be self-contained, i.e. all information must be in the question itself and not depend on external links (which may break). There are exceptions, though. If the ...
Glorfindel's user avatar
40 votes

But seriously. How to be nice when trying to say the code is crap?

I usually call these situations "extenuating constraints"; the code that is presented to us is not code that anyone would actually want to use in production, but is code that the OP has decided to ...
Makoto's user avatar
  • 104k
36 votes
Accepted

Should I edit posts with improved style?

The trouble is you've changed the answer from one that works in any version of Python to one that now requires at least Python 3.6. Anyone having to work with a legacy version of Python will now find ...
Robert Longson's user avatar
35 votes

Should we allow answers that contain hard-coded values?

Yes, we should allow such answers. SO doesn't exist to give full examples of working applications, complete with configuration files, sample data, and the like. Instead, it focuses on questions and ...
elixenide's user avatar
  • 44.3k
35 votes

Is it bad practice to post a short answer first and then add details afterwards?

I can't go so far as to say that it's "bad practice", but it is incredibly annoying. It shows that you are racing towards getting the most upvotes, not giving the OP the best advice. Of course you can ...
Lightness Races in Orbit's user avatar
32 votes

Are imports useful when posting code on answers?

I would recommend that a code sample to be as close as possible to a running sample. This includes all imports, directives etc. Whoever takes the time to answer a question should be helped to ...
Alexei - check Codidact's user avatar
29 votes

Can we please have a shortcut for "Do not post code or errors as images"?

Yes, but no. Let's stop fixing symptoms. It's great if you haven't given up on user education. But the priority should be on prevention, not cleaning up. SO could easily avoid most of these cases with ...
mario's user avatar
  • 144k
28 votes

Are imports useful when posting code on answers?

I would say it's up to the author of the post whether or not to add them to their code snippets. If the author doesn't add them, it can be assumed that they're implied; Includes and Imports are a ...
TylerH's user avatar
  • 20.8k
27 votes
Accepted

Can't Seem to get This Code Into a Codeblock

Testing with a textarea produces this result when four spaces is typed in (encoded so we can see whitespace characters): Seems like Chrome inserts a linefeed character %0A after two spaces, as the ...
Samuel Liew's user avatar
  • 76.9k
27 votes

Should we edit a question to transcribe code from an image to text?

The answer is pretty simple: No. There is a FAQ that addresses the issue: Please do not upload images of code/errors when asking a question. It is the OP's responsibility to post the actual code. The ...
Ken White's user avatar
  • 123k
24 votes
Accepted

How to provide additional code to comment an answer?

Or should I edit my question (risking that my question gets longer and longer)? Do not edit and scope-creep your original question. If you have additional requirements exposed by the answer, ask a ...
ryanyuyu's user avatar
  • 6,366
21 votes

How production-ready should code in answers be?

I believe that Stack Overflow is very useful repository of information for students and professionals. When we answer we should strive for best quality, so anyone reading the answer can benefit from ...
Dharman's user avatar
  • 31.1k
20 votes

Is it bad practice to post a short answer first and then add details afterwards?

Ok, so a few days in this question has attracted a lot more attention than I expected, and it has taken a turn I didn't expect - I thought I stopped playing Fastest Gun In The West a long time ago, ...
Mikk3lRo's user avatar
  • 3,477
20 votes

What's better: a question with no attempt or with an unfixable/irrelevant attempt?

You seem to be asking two unrelated questions here: "What's better: a question with no attempt or with an unfixable/irrelevant attempt?" If the code posted by the OP is indeed a genuine attempt to ...
Ilmari Karonen's user avatar
20 votes
Accepted

Which flag should I use for too much code?

You should use Needs debugging details The question should be updated to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. which is ...
Nick's user avatar
  • 140k

Only top scored, non community-wiki answers of a minimum length are eligible