Stack Overflow is an incredible collection of programming and software knowledge. Thousands of students and developers use it daily to lookup answers for questions they can’t solve easily themselves. Stack Overflow taught me so much over the years, I have used it since I began to learn to program. It’s built and grown by a community of developers, with new questions and answers being added all the time.
堆栈溢出是令人难以置信的编程和软件知识的集合。 每天有成千上万的学生和开发人员使用它来查找自己无法轻松解决的问题的答案。 多年来，Stack Overflow教会了我很多东西，自从我开始学习编程以来，我就一直使用它。 它由开发人员社区构建和发展，并始终添加新的问题和答案。
However, contributing to Stack Overflow, asking questions and answering them, is vastly different from just searching and reading information on the site. Stack Overflow has a very steep learning curve, for a long time, it wasn’t really welcoming toward beginners. If you are interested in using it to grow and further your skills or reputation as a developer, this article is for you. On a site like Stack Overflow, there is no right or wrong, all content will eventually be moderated by the community. Yet, you will want to avoid situations where despite good intentions, you get downvoted to oblivion.
但是， 促成堆栈溢出，提出问题和回答问题与仅在站点上搜索和读取信息有很大不同。 长期以来，Stack Overflow的学习曲线非常陡峭，对初学者并不那么受欢迎。 如果您有兴趣使用它来发展自己，并提高自己作为开发人员的技能或声誉，那么本文适合您。 在Stack Overflow之类的网站上，没有对与错，所有内容最终都将由社区管理。 但是，您将希望避免尽管有良好的意愿但又被遗忘的情况。
目的 (The Purpose)
When people start using Stack Overflow, they often don’t fully understand the purpose of the site. Stack Overflow is not a discussion site or a forum. It’s a knowledge base. That means for whatever questions are asked, any answer should be accurate, specific, and useful to the highest degree. It’s not a place to post partial answers or to ask questions on questions. Answers are upvoted and downvoted to determine the communities opinion on them. There’s one, critically, crucially important detail to understand about upvotes and downvotes: Roughly 80% of all votes on Stack Overflow are downvotes.
当人们开始使用Stack Overflow时，他们通常并不完全了解该站点的用途。 堆栈溢出不是讨论站点或论坛。 这是一个知识库。 这意味着，无论提出什么问题，任何答案都应准确，具体且在最大程度上有用。 这不是发布部分答案或提出问题的地方。 回答是否正确，可以确定社区对此的看法。 有一个非常关键，非常重要的细节需要了解有关投票和降票的信息：关于Stack Overflow的所有选票中大约有80％是投票。
In fact, there’s even some users with hundreds of thousands in points that have an up to down vote ratio of over one to one thousand. That means for every one up vote they gave, they also gave over a thousand down votes. This isn’t meant to scare you, it’s to help you understand Stack Overflow does have a high standard of quality for content. Even the best answers also get their share of down votes. Any answer you give should have careful thought and effort put into it.
实际上，甚至有些用户拥有数十万的点数，其最高投票率超过一千。 这意味着他们每投票一票，他们也会投票一千票。 这并不是要吓you您，而是要帮助您了解Stack Overflow确实具有高标准的内容质量。 即使是最佳答案，也将得到他们的反对。 您给出的任何答案都应该经过认真的思考和努力。
Being a knowledge oriented site can also imply there’s no room for subjectivity. To an extent that’s true, but it’s more complicated than that. Whether or not something is considered subjective depends on how much information exists on that particular problem, or if there is a widely accepted solution. For example, a question asking “How to add more items to a list in Python?” could only be reasonably answered by suggesting to use the append or insert methods of a Python list. An answer giving a solution by construction an entirely new list, would likely be heavily downvoted. That’s because a list in Python is designed for mutability, answers diverting from that use will simply not be useful or welcomed.
作为一个面向知识的网站，也可能意味着没有主观性。 在一定程度上是对的，但要复杂得多。 是否认为某件事是主观的，取决于有关该特定问题的信息量或是否存在被广泛接受的解决方案。 例如，一个问题询问“如何在Python中将更多项目添加到列表中？” 只能通过建议使用Python列表的append或insert方法来合理地回答。 通过构造一个全新的清单来给出解决方案的答案可能会被严重否决。 这是因为Python中的列表是为可变性而设计的，从该用法中转移出来的答案将根本无用或不受欢迎。
Asking “How to ensure a particular module is only imported from a certain directory?” is a question that’s more open to interpretation and does not have a widely accepted methodology. A simple answer to such a question would be to suggest inserting the directory path at the beginning of
sys.path . Although that answer works, it’s still not full proof. The Python interpreter actually checks
sys.modules before it checks
sys.path . There’s also a completely different way to achieve the same desired behavior, to run Python in a virtual environment, avoiding conflicts between module names altogether. The point is, there’s multiple ways to answer such a question, given any answer accurately argues for itself.
问“如何确保特定模块仅从特定目录导入？” 这个问题更易于解释，没有广泛接受的方法论。 一个简单的答案就是建议在
sys.path的开头插入目录路径。 尽管该答案有效，但仍不是完整的证据。 Python解释器实际上在检查
sys.modules 。 还有一种完全不同的方式来实现相同的期望行为，以便在虚拟环境中运行Python，从而完全避免模块名称之间的冲突。 关键是，给定任何答案都可以正确辩解的情况，有多种方法可以回答这样的问题。
Next, look at both the best, and worst ways you can use Stack Overflow to grow and improve as a developer.
As mentioned previously, there’s no wrong way to use Stack Overflow. Yet, there are many pitfalls and traps you can avoid to prevent being heavily downvoted. These are those patterns of contribution you will want to avoid.
如前所述，使用堆栈溢出没有错误的方法。 但是，您可以避免很多陷阱和陷阱，以防止被严重否决。 这些就是您希望避免的贡献模式。
问简单的问题 (Asking simple questions)
Most simple questions are likely to be closed as duplicates on Stack Overflow. This happens to questions that are usually have a solution found easily in a language’s or package’s documentation. While this won’t subtract points from your total score on the site, it’s just a waste of time since you won’t get your question upvoted. Both questions and answers can be voted on, up votes in either case increase points, while down votes decrease them. Try to search if you question exists before you ask it.
大多数简单问题很可能会作为Stack Overflow上的重复项关闭。 这通常发生在通常在语言或软件包的文档中很容易找到解决方案的问题上。 尽管这不会从您在网站上的总得分中减去分数，但这只是浪费时间，因为您不会提出自己的问题。 可以对问题和答案都进行投票，无论哪种情况，都可以提高投票数，而减少投票则可以降低分数。 询问之前，先尝试搜索是否存在问题。
Keep in mind, sometimes questions are mistakenly marked as duplicates. This can be because you weren’t clear enough on the specific answer or knowledge you sought. Good news, Stack Overflow allows you to edit a question and reopen it if this happens, netting you more points if that edit is better received.
请记住，有时问题被错误地标记为重复。 这可能是因为您对所寻求的具体答案或知识不够清楚。 好消息，Stack Overflow允许您编辑问题并在出现这种情况时将其重新打开，如果更好地接受了此编辑，则可以为您赢得更多的分数。
提供与问题不符的答案 (Giving answers that don’t match the question)
This might sound obvious, whatever answer you contribute should be suited for the question being asked. Stack Overflow enforces a rather strict interpretation of this rule, though. Submitting an answer which suggests a solution that either doesn’t fully resolve the problem, or uses a different tool or method than what’s specified, is highly frowned upon, and will result in downvoting. This is probably the absolute worst way to use Stack Overflow.
这听起来似乎很明显，无论您提供什么答案都应该适合所提出的问题。 但是，堆栈溢出强制对此规则进行了相当严格的解释。 提交的答案表明解决方案不能完全解决问题，或者使用的工具或方法与指定的方法不同，因此对此表示强烈的反对，这将导致投票失败。 这可能是使用堆栈溢出的绝对最糟糕的方法。
An example can be as follows. There is a question, “How to get the stderr from a process with Popen?”. You answer, “This can be accomplished using subprocess.run and accessing the stderr attribute of the return value”. This answer would be considered inappropriate for the question, because it’s specifying the use of a different builtin object the question is not asking about. Stack Overflow is not a discussion forum, and such answers are not useful or desirable on that particular question.
一个例子可以如下。 有一个问题， “如何从使用Popen的进程中获取stderr？”。 您将回答： “这可以使用subprocess.run并访问返回值的stderr属性来完成”。 该答案将被认为不适合该问题，因为它指定使用该问题未询问的其他内置对象。 堆栈溢出不是讨论论坛，并且这样的回答对于该特定问题没有用或不希望有。
用热门标签回答问题 (Answering questions with highly popular tags)
Questions on Stack Overflow are organized by tags relating to the specific topic of software development they are concerned with. The site holds tens of thousands of tags, encompassing every topic you can think of. The most popular of which are general programming language tags, such as
[python] . The most popular tags have hundreds of thousands, if not millions of questions listed under them. While you may see a lot of questions that feel easy to answer, there are some substantial risks.
关于堆栈溢出的问题按与他们所关注的软件开发特定主题相关的标签来组织。 该网站拥有成千上万个标签，涵盖了您可以想到的每个主题。 其中最受欢迎的是通用编程语言标签，例如
[python] 。 最受欢迎的标签下有成千上万个问题，即使不是数百万个问题。 尽管您可能会觉得很多问题很容易回答，但存在一些重大风险。
Remember the user I mentioned that gives over a thousand downvotes per one up vote? Users similar to that are likely top contributors and lurking in popular tags. Answers you give to questions under these tags will be under high scrutiny. Additionally, many questions in such tags get answered very quickly, as many people are also looking at them. By the time you write a well thought out answer, some top contributor may have already answered it before you. Or, your answer or code may miss small details involved in answering the question, leading to a higher degree of downvotes. Generic, language syntax type of questions are frequently marked as duplicates, so you may start putting effort toward an answer for nothing.
还记得我提到过的用户，每一次投票就有一千多票的赞成票吗？ 与此类似的用户可能是最主要的贡献者，并且潜藏在流行标签中。 您对这些标签下的问题的回答将受到严格审查。 另外，此类标签中的许多问题很快就会得到回答，因为很多人也在看它们。 当您编写一个经过深思熟虑的答案时，某些杰出贡献者可能已经在您面前回答了。 或者，您的答案或代码可能会错过回答问题所涉及的小细节，从而导致更高的否决率。 通用的语言语法类型的问题经常被标记为重复项，因此您可能会开始全力以赴地寻求答案。
These strategies and tips are meant to help you achieve the most up votes with the least down votes.
用不太受欢迎的标签回答问题 (Answering questions in less popular tags)
In less popular tags, such as
[bson] , questions stay unanswered for much longer periods of time. Such tags also have far less super contributors (reputation > 100k) you have to compete with. There’s also less intensive, harsh moderation going on. I am by no means suggesting that moderation is bad or counterproductive. On the contrary, it’s what builds Stack Overflow as a community. However, not all moderation is conducive to increases in quality.
[bson] ，问题会在更长的时间内保持未回答状态。 这样的标签所具有的超级贡献者(声誉> 100k)也要少得多。 另外，强度较低，苛刻的调节正在进行中。 我绝不暗示节制是有害的或适得其反。 相反，这是将Stack Overflow建立为社区的原因。 但是，并非所有节制措施都有助于提高质量。
I wrote this answer to a question I had asked which to my surprise, no one answered. I explained the solution and all the needed steps for others to implement it if they found themselves in a similar situation. Yet, my answer was still downvoted, due to using a different, yet equivalent keyword argument in the setup function for a Python package. There’s no difference in behavior between the two argument fields, but was still marked down by the community. If I were to write that question again, I wouldn’t include the
提出没有明显解决方案的问题 (Asking questions with no obvious solution)
The best questions to ask, and the ones that will get the most upvotes, are the ones with no obvious solution. This doesn’t mean super complex questions almost no one can answer or solve. Questions that concern a common situation, but that have no easily identifiable or straight forward solution, are the ones you need to be asking.
最好的问题是那些没有明显解决方案的问题，它们将获得最多的投票。 这并不意味着几乎没有人能够回答或解决的超级复杂问题。 您需要提出的问题涉及一个常见情况，但没有容易识别或直接解决的问题。
I have question that I asked five years ago that has since gotten over 50,000 views. The question asks how to match a particular string against many different possible strings using regular expressions. Generally, checking if a string is present in a group of strings can be accomplished with a hash set. But in the case of regex, there is no widely used method. One option, which turned out as the best answer, is using a list of words joined with the
| “or” operator in regex. Another option, the second answer listed, is using named lists from a common third party library for regular expressions. Both answers work fine, but the former doesn’t depend on any other packages, it uses native Python.
我有一个问题 ，我五年前问过，自那以后获得了50,000多次浏览。 该问题询问如何使用正则表达式将特定字符串与许多不同的可能字符串进行匹配。 通常，可以使用哈希集完成检查字符串组中是否存在字符串。 但是对于正则表达式，没有广泛使用的方法。 事实证明，这是最好的选择，其中一个选项是使用带有
|的单词列表。 正则表达式中的“或”运算符。 另一个选择是列出的第二个答案，它使用来自公共第三方库的命名列表进行正则表达式。 两个答案都可以正常工作，但是前者不依赖于其他任何软件包，它使用本机Python。
The lesson here is asking questions with no direct or straight forward answers are more likely to be upvoted, and more likely to generate answers.
Overall, Stack Overflow is an immense body of knowledge that’s built by a vast community of developers. Using it is easy, contributing to it isn’t that easy. However, if you put careful thought into your answers, stick to less popular tags, and try to ask more complex questions, you will gain a lot more out the experience.
总体而言，堆栈溢出是由大量开发人员构建的大量知识。 使用它很容易，贡献它并不是那么容易。 但是，如果您对答案进行仔细的思考，坚持使用不太受欢迎的标签，并尝试提出更复杂的问题，您将获得更多的体验。