This article is a mirror article of machine translation, please click here to jump to the original article.

View: 8677|Reply: 0

Why can't you do without Stackoverflow?

[Copy link]
Posted on 10/4/2016 9:30:55 AM | | | |
As a programmer, if you haven't heard of Stackoverflow, you'd better think about it. One of the programming books that programmers need to read the most (in fact, it is enough to leave this one for programming books!). ):

(The homepage Jun strongly inserted, the picture above is a spoof picture, some netizens did not understand this before, especially to say it)
For those programmers who haven't read the book yet, it's time to buy one. If you're still on the fence, take a look at this article to see why you can't do without StackOverflow.
The wisdom of asking questions
When you ask a technical question, whether you end up getting a useful answer often depends on how you ask and follow up. —— Eric S. Raymond
Sometimes, a clear description of a problem, especially a technical one, is not as simple as it seems. Asking questions has always been a science, but unfortunately many people don't realize it or don't pay enough attention to it. Or, some questioners do not ask for help at all. So we will find all kinds of questions that people cannot answer or do not want to answer:
Java regex problem?
What is SLA response time?
What is the difference between ATL classes and general class inheritance?
In order to avoid the above problem being closed or modified, put a picture here to experience this shit problem:

You can find a bunch of these questions in the unanswered questions on SegmentFault, so many people obviously don't have the wisdom or attitude to ask questions. Raymond and Rick Moen wrote a classic essay on how to ask questions The Smart Way (http://www.catb.org/~esr/faqs/smart-questions.html#translations), which has been translated into various languages and is widely circulated and can be found in Chinese edition here. Stackoverflow and Segmentfalut also have suggestions for asking questions:
Help Center > Asking
How to Ask
How do I ask a good question?
What kind of questions are welcome
There are too many classic questions on Stackoverflow, and we can learn how to ask questions and communicate with answerers. When you get used to reading questions on stackoverflow, you will unconsciously imitate them when asking questions, thus avoiding asking brainless questions. Here are some of the most important questions to pay attention to when asking questions:
Ask a question that the search engine doesn't have a satisfactory answer (Google is at least four pages old).
Ask questions that you can't solve on your own and have tried a lot
Try to describe the problem as clearly as possible: good typography, code, error prompts, pictures, etc
Make your questions helpful to others
There should be a definite answer to the question, and there should be no too much subjectivity
Different schemes
Many times we hope to find a solution, but on Stackoverflow, there are often unexpected gains. You may see different solutions to a problem, including even comparisons of those solutions.
Suppose now you want to know how to call an external command in Python, such as ls -l, to print an article under a directory. Google the python call system command, and the first one is a related question on stackoverflow: Calling an external command in Python. (http://stackoverflow.com/questio ... l-command-in-python) (Google technical issues, basically stackoverflow related issues will be displayed).
Then under this question, someone summarizes several ways to invoke external commands:
os.system()
os.popen()
subprocess.popen()
subprocess.call()
subprocess.run()
And each method is also introduced, you can choose the method that suits your application scenario. Another example is the question How to check whether a file exists using Python? (http://stackoverflow.com/questio ... exists-using-python), which describes different methods in Python to check for the presence of a file.
Use of tools
There are many powerful tools that can help us better study problems, you may know the gdb debugging tool, you may know the timeit monitoring module of python, but you don't know the tools you don't know. Many times, when we first know a tool, we will have the feeling of meeting too late. However, the tools you like are always so hard to come by.
On Stackoverflow, there may be some good tools in every question answer or comment, and you will always have a chance to find the best ones that are left behind the lines.
Here is a list of some of the great tools I found:
truss/strace: tracks system calls and received signals when a process is executed, strace can track system calls generated by a process, including parameters, return values, and execution time. (From Question: Why is reading lines from stdin much slower in C++ than Python?)
vprof: A visual tool that analyzes the characteristics of Python programs, such as runtime, memory usage, etc. (From question: How can you profile a Python?)
Regex 101: An online regular expression assistant that can help you understand the meaning of regular expressions, debug regular expressions, and make simple experiments. (From Issue: Learning Regular Expressions)
Here's a simple example of Regex 101:

The process of thinking
Many times, when we encounter a problem, we have no way to start and don't know which direction to think. But with stackoverflow, we can easily find out the specific solution, and sometimes even know what others think when faced with this problem.
Let's say you want to use a decorator to accomplish a task by adding before and after the string returned by the say function below, and you think about defining say like this.
@makebold
@makeitalic
def say():
return"Hello"
Each call to say returns Hello. But how to implement makebold and makeitalic is a problem. On Stackoverflow, there are big bulls who will tell you the answer directly and throw you a link to the documentation of the decorators. But there are also Daniels who will tell you in detail about their thinking process and their understanding of decorators, so that you can deeply understand the decorator mechanism.
In response to the above question, there is an answer that has received more than 3,000 likes, telling you how to solve the problem step by step. First of all, tell us what are the characteristics of functions in python:
Functions are objects
A function can be assigned to a variable
A function can be defined in another function
One function can return another function
You can pass functions as parameters
Then start explaining what a decorator is: it is actually an encapsulator, which allows us to execute other code before and after executing the original function without modifying it. A simple decorator prototype is implemented by hand, followed by the introduction of decorator syntax in Python. Finally, some advanced uses of decorators are listed, including passing parameters to decorators. Read the whole answer, you will definitely have a deeper understanding of the decorator, and know the thinking process of understanding the decorator. In this way, following this path of thought, you yourself can deduce how to use the decorators.
Possible blind spots
When you don't have any questions to ask, you can also visit stackoverflow from time to time, browse some questions with more votes, and see what others have answered. In this vast knowledge base, you will most likely find some of your cognitive blind spots and discover content that you have never paid attention to.
I found some interesting questions, such as:
Print in terminal with colors using Python?
What is a metaclass in Python?
What is your most productive shortcut with Vim?
I've put together a list of high-quality Python questions here for frequent reference.
I regret that we met too late
So how to find StackOverflow, two suggestions:
Describe the problem precisely in English
Google it
As long as you're not the first person to encounter a technical problem, you'll probably find the same or similar problem on StackOverflow. Meet soon, fall in love with Stackoverflow early, and you'll find that life is so comfortable.





Previous:Windows batch connection VPN modifies the routing table
Next:node.js modular interface
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com