開源日報 每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,堅持閱讀《開源日報》,保持每日學習的好習慣。
今日推薦開源項目:《二維碼上傳文件 qrcp》
今日推薦英文原文:《Learning to Code? Fall in Love With Errors》
(這裡放日報封面) (請檢查,本文勾上了且只勾了《開源日報》這一個分類,請檢查,有添加文章 Tag,請檢查,有添加文章摘要,請檢查,有添加特色圖像,有添加bigger圖片,有選中頭圖「布局設置」為佔滿屏幕的那張「第3張」) (請檢查,預覽時候,所有圖片和文字顯示正常,且勾上了百度熊掌號-原創提交) (請檢查,本文的信息已經添加到 https://pm.openingsource.org/projects/daily/wiki日報摘要里,每個月的摘要信息單獨發一個page,格式參照 https://openingsource.org/daily-index/2018-5/,標題,URL,正文等格式均需保持一致) (檢查上述都完成之後,請刪掉括弧里的字,包括這一句,每天發布時間為早晨8點左右)
今日推薦開源項目:《二維碼上傳文件 qrcp》傳送門:GitHub鏈接
推薦理由:該項目能讓我們通過掃描二維碼的方式利用Wi-Fi將文件從計算機傳輸到移動設備,而無需離開終端。
今日推薦英文原文:《Learning to Code? Fall in Love With Errors》作者:
原文鏈接:https://medium.com/better-programming/learning-to-code-fall-in-love-with-errors-e502ed4b4624
推薦理由:誰不喜歡找bug呢?

Learning to Code? Fall in Love With Errors

Don』t fear errors. You』ll become a better developer when you embrace failure

(Photo by the author.)

Coding Can Be Frustrating

Let me share a personal story. I first started coding when I was 14. I liked playing computer games, so I assumed that creating them was a natural next step. For a bookworm used to learning things fast, learning to code didn』t seem like a big deal. So I bought a book about C++, downloaded a text editor, and started coding.

My first application was about ten lines of code. It didn』t work. I forgot about three semicolons in those lines. I got a little bit frustrated, fixed errors, and reran the program. It crashed again. This time, there was a typo. It took me almost an hour to make a trivial app work.

I stuck to coding for about two weeks. I just couldn』t handle the frustration of failing time after time. It took me over ten years to try programming again just because of some typos and missing semicolons.

(Photo by Jackson Simmer on Unsplash.)

Things Go Wrong All the Time

I』ve been programming for five years now, and I』ve made some progress. Nevertheless, I still get stuck almost daily. The thing is, programming is hard. And as we all know, everything that can go wrong will go wrong. It』s only a matter of time.

For programmers, buggy code is a natural state of things. Whether it is some unhandled error in nested asynchronous code or a missing semicolon, mistakes happen all the time.

Change Your Perspective

As an aspiring developer, you have to prepare for numerous setbacks. You have no choice but to befriend failure. As the infallible Samuel Beckett wrote:

「Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better.」

Although Beckett probably had something bleak in mind, the quote is a piece of sound advice for beginner developers.

But I know better than to think that one inspirational quote will be enough to convince you that failure is OK. So I』ll demonstrate how you can like errors or maybe even fall in love with them with a mindset shift.

(Photo by Nadine Shaabana on Unsplash.)
Here are some common attitudes towards errors and tips on how to reframe them.

「That error is stupid.」

Maybe. Some errors are stupid. But someone put them there for you as a clue about what went — or could go — wrong. Errors are there for you to understand what』s happening and they usually go with helpful advice.

Imagine having real-life error messages. For example, your partner seems angry at you, but you have no idea why. Thanks to excellent error implementation, you get a text message saying, 「429 Too Many Requests.」 Now you know she』s just tired, so you should try to help instead of wondering what you』ve done wrong. Wouldn』t that be helpful?

「Another error? That』s enough.」

I』m sure you know the feeling. You』ve spent lots of time fixing an error. Now the code has to work. And it works! But two lines below… there is another error. It looks like you』re stuck in an endless cycle of new errors.

But is that a bad thing? That』s a new error. A unique opportunity to expand your knowledge. As long as your errors are changing, you』re making progress. If you』re failing, you』re learning something. When your code is perfect, you』re in your comfort zone and learning nothing.

So try a different approach. Next time you encounter a brand new error, say to yourself, 「That』s interesting. I』ve never seen that error before.」 Let』s see what you can achieve with such a mindset.

「That bug is hard. I』ll start with something else.」

This is the tricky one. You can easily convince yourself that it』s reasonable to warm up with something easy and then get to the real business. But be careful — maybe you just want to procrastinate and avoid another failure.

You have the best chance for a breakthrough when you are rested. Try starting with the most challenging task. Don』t worry if you fail. At least you may learn something new.

「I』ve wasted three hours on that error and have gotten nowhere.」

So what? Nobody』s hurt. You』ve merely 「wasted」 some time. But did you really waste it? Maybe you just learned something.

Now you know some approaches don』t work. If you』re lucky, you may even have some idea about what may work. That』s how you make progress. Embrace the failure, feed on it.

Also, imagine the satisfaction when you eventually solve the problem. Be proud of your achievements.

「I』m tired of this. I need to rest.」

This one is productive. More often than not, taking a break is an excellent idea if you』re stuck. Try taking a walk, chatting with a coworker, or anything else that will help you reset. The problem is unlikely to get more serious while you』re taking a break.

I』ve got one extra tip: If you』ve rested and still can』t solve the issue, try tackling it right before going to bed. You may think your brain is resting while you』re sleeping, but in reality, it』s working hard. So there is a fair chance you』ll have your solution just after you wake up.


下載開源日報APP:https://openingsource.org/2579/
加入我們:https://openingsource.org/about/join/
關注我們:https://openingsource.org/about/love/