開源日報 每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,堅持閱讀《開源日報》,保持每日學習的好習慣。
今日推薦開源項目:《衝擊力 obnoxious.css》
今日推薦英文原文:《Don』t be too Proud to Ask For Help》

今日推薦開源項目:《衝擊力 obnoxious.css》傳送門:項目鏈接
推薦理由:這個項目包含了一些極具衝擊力的 CSS 動畫——字面意義上的衝擊力,配合自己頁面上的主題元素一起使用能夠給來訪者留下足夠深刻的印象,包括但不限於為元素們附加強烈的閃爍與震動等等(有時衝擊力和驚嚇意外的只有一線之差呢……)。
今日推薦英文原文:《Don』t be too Proud to Ask For Help》作者:Rose Day
原文鏈接:https://towardsdatascience.com/dont-be-too-proud-to-ask-for-help-76f21d16f318
推薦理由:建議和提問的藝術一起食用來確保在你知道你應該向別人求助時能夠正確提出問題

Don』t be too Proud to Ask For Help

If you are stuck on a bug or feel overwhelmed, you can ask for the help you need.

One of the hardest lessons to learn when working on a problem is when to step back and ask for help. Don』t be too proud to ask for help. Whether it be an issue with a coworker, a bug in your code giving you grief, or a personal problem you have going on, you can always ask for help when you need it.

Noticing Your Problem

Recently I took on a project to develop a new set of functionalities in our codebase. Looking at this problem, it appeared to be relatively easy work as it just extended off existing code to cater to a new use-case. I spent a few days developing the code and creating unit tests to test the new functionality. As the sprint was coming to a close, I noticed two small issues that appeared in my output, (1) I had duplicate timestamp columns, and (2) my generator was returning an empty list though it should have had one element in it.

Working on data science and software projects, you can often face problems at work where you end up looking at code on a computer screen for hours on end and can』t seem to find the issue. For me, these two bugs were one of those cases. The first bug surfaced as a duplication of columns in my output dataset. I was receiving two timestamp columns with the same value but each in a different format. As I looked closer at this data, it was clear something was wrong, but I did not understand where the problem was coming from.

As I read through the code, I traced the timestamp column through the creation of the output but was not seeing the issue. The data looked fine throughout the process up until the final result was printed. My second bug was my generator function producing an empty list instead of creating a list of objects. So what was happening? At this point, I had identified that I had two problems and spent too much time debugging them alone; it was time to ask for help.

Accepting You Need Help

When you find yourself spending too much time trying to solve a problem yourself, step back from the problem for a few minutes. Accept that this problem may be something larger than yourself or maybe something you are just overlooking. As you step back, recognize that you can ask for help. And no matter what stage you are in your career, you can ask.

You shouldn』t feel as though you are too far along to need the assistance of others. If you are working on a coding project or an analysis and are now facing a bug, you may have made an assumption somewhere in your code that you overlooked. Maybe you missed something in the data that was unclear to you before. Could you have spelled something wrong or used a different function, which is altering your output? There are so many things that can cause problems, but you don』t need to solve them alone.

Asking For Help

After spending a day on my duplicate columns bug and empty generator output, I stepped back and set up a meeting with two other developers. I explained my issue in the email and asked if they could review my code for anything that I could have missed.

Heading into the meeting, I read through my code one more time and spotted the line creating the initial empty data frame. That line of code was creating the data frame with a timestamp column and a timestamp index. Thinking to myself, 「that can』t be my problem!」 I removed the timestamp column and left the timestamp index. I reran my code and looked at the output just as the meeting started. It was, in fact, my issue with the duplicate timestamp columns. With bug 1 concurred, it was clear I needed to step back from the original code for a while to bring a fresh perspective on the issue.

So what was wrong with my generator function producing an empty list of objects? As the meeting started, I explained my duplicate column bug and the solution. It was helpful for one of the developers who would be working on similar work in the upcoming sprint. As for the generator bug, I brought up my code and shared my screen. The function was operating without producing any error statement, but the output was wrong. It came down to a simple data type issue. I was trying to cast the data going into the generator as the wrong type. Therefore, it was not finding anything of that type in my folder. Since nothing in my folder was the correct type, nothing was added to the list, in turn, producing an empty list. Once I updated the class to the correct type, my generator created a list with the folder』s data. My problem as simple as a find and replace of one word that I overlooked.

Summary

So what did I learn here?
  • You can ask for help, and you should. Please don』t feel that you have to go it alone with your problem.
  • Don』t let what seems like a trivial bug put you off schedule because you are too proud to say, 「Hey, can you look at this with me quickly?」
  • Sometimes you need to step back from what you are working on to recognize where the problem is. Code can blindside you, walk away and come back for a fresh look later.
  • Don』t feel that you are alone. Every developer will ask for help at different times and for various reasons.

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