開源日報 每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,堅持閱讀《開源日報》,保持每日學習的好習慣。
今日推薦開源項目:《傳奇畫師續作 purecss-gaze》
今日推薦英文原文:《Use the Documentation — Not StackOverflow》

今日推薦開源項目:《傳奇畫師續作 purecss-gaze》傳送門:GitHub鏈接
推薦理由:他來了他來了,他帶著新作走來了。這個項目是經常拿著 HTML+CSS 就上場畫畫去的項目作者的續作,這個表現出來的效果一如既往的令人驚訝,如果你不打開瀏覽器控制台,很難想像這真的不是一張圖片而且一個個 HTML 元素堆砌起來的成果……
今日推薦英文原文:《Use the Documentation — Not StackOverflow》作者:Brett Fazio
原文鏈接:https://medium.com/better-programming/use-the-documentation-not-stackoverflow-45fe4663b94e
推薦理由:如果不是火燒眉毛,花點時間幫助未來的自己總不是壞事

Use the Documentation — Not StackOverflow

Understanding how to do something is much better than a quick fix

When faced with a problem, our first instinct is to Google to find the specific solution. This may be fine in other disciplines, but not in computer science.

Most of the time when we Google our problem, we are presented with a forum, like StackOverflow, that consists of a similar question and a specific answer. We read through the question to see if it fits ours, then we proceed to copy and modify the accepted answer to fit our needs. Problem solved, right? Well, not really.

Yes, you may have found a block of code on the internet that, with the magic of copy-paste, fixed your problem. But in the longer term, your understanding wasn』t really deepened. When faced with a similar problem again, you』ll probably have to resort to the same forum question. When faced with a more difficult problem, you』ll have to drain your energy trying to piece together seven or eight different solutions on the internet hopefully arriving at something that resembles good, working code.

Why Use Documentation Instead?

When I first got into iOS development, I used the BigNerdRanch iOS development books — they were the ones that looked the best at my local bookstore. One of the key things they hammered home was Shift+Command+0 — this keystroke brings up the documentation when using Xcode.

They didn』t suggest instantly giving up and Googling; the authors wanted me to use the documentation. This was great advice.

While forums online usually read like a quick fix, documentation reads like a textbook or a manual. I think a textbook is an apt comparison here because we use textbooks in school to deepen our understanding of an unfamiliar topic, and I think we should use documentation the same way.

If, for example, you were writing a Make file to compile your C++ app and one of the lines in your Make file kept resulting in an error, you could probably Google the error and find a line of Make code to fix your problem.

But what if you had looked at the documentation instead? Yes, it will take longer to scour through the documentation, but you will gain a deeper understanding of what』s going on. In doing so, you』ll be able to make connections between your newfound understanding of Make and the current problem at hand. Now, the next time you encounter a problem, you』ll be able to refer back to that deeper understanding and solve the problem yourself.

Should I Never Use StackOverflow Again?

No. There』s a time and place for everything. StackOverflow — and sites like it — are a great tool to figure out problems. But it shouldn't be your primary source of learning and it shouldn't be the first place you go when you have a problem.

If you refer to the documentation first but are unable to understand it or still can』t fix your code, going to StackOverflow next to ask the question is a logical next step — but now your question will be better. You can refer to the parts of the documentation that you looked at and still don』t understand, and try to connect that to your specific problem when you ask your question. Your question will be better.

People won』t view your question as just another person looking for someone else to fix their code. They』ll view your question as someone who』s really trying to understand something in order to fix a problem but just needs a little help. That』s a much better look.

With the long-term outlook in mind, being able to become the person who can solve your own programming problems, rather than relying on forums will make you a much better developer. It』s not to say that there isn't a time and place for StackOverflow; if you』ve tried to learn it yourself but still can』t get it, StackOverflow is a perfect place to go.

Trying to learn things yourself should always be your go-to when a problem arises.
下載開源日報APP:https://openingsource.org/2579/
加入我們:https://openingsource.org/about/join/
關注我們:https://openingsource.org/about/love/