開源日報 每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,堅持閱讀《開源日報》,保持每日學習的好習慣。
今日推薦開源項目:《C++測試 Google Test》
今日推薦英文原文:《The Exhausted Programmer》
開源日報第684期:《C++測試 Google Test》
今日推薦開源項目:《C++測試 Google Test》傳送門:GitHub鏈接
推薦理由:Google Test 是一個由 Google 的測試技術團隊開發的測試框架,它考慮到了谷歌的特定需求和限制,可以幫助我們更好地編寫 C++ 測試用例。無論你使用的是 Linux、Windows 還是 Mac,只要你編寫 C++ 代碼,Google Test 都可以幫到你。它支持任何類型的測試,不只是單元測試。
今日推薦英文原文:《The Exhausted Programmer》作者:Meriam Kharbat
原文鏈接:https://medium.com/better-programming/the-exhausted-programmer-ad5b2893c560
推薦理由:是人總會累的。作為程序員,努力變強,同時與變禿作鬥爭。

The Exhausted Programmer

How I prevent mental and physical fatigue

開源日報第684期:《C++測試 Google Test》
(Photo by Annie Spratt on Unsplash)
At my first programming job, I worked at a very early stage startup. It was one other person and me. We met at a library in the suburbs of Paris at opening hours and stayed there until 8 pm, or sometimes until it closed. I was young and full of energy — I enjoyed the challenge and was motivated to work overtime.

Maybe it was because I felt ownership over the project. Perhaps it was the excitement of building something from scratch or the thrill of being in Europe for the first time.

I loved it. The only problem was I couldn』t sustain it.

When you spend too much time at work, you don』t have time for much else. You don』t have time for family and friends, you don』t have time for your hobbies. It quickly and inevitably wears you down.

You can feel it happening. Your energy levels drop no matter how much caffeine you ingest. You end up staring at the screen and scrolling up and down the code editor instead of producing something of real value.

You feel less creative. Less motivated. Irritable. Unhappy.

One of the biggest lessons I learned as an engineer is to work around my energy levels and know when to go home.

Overwork Culture

Some people take pride in being busy all the time and working overly-long hours. I have friends like that. They brag about how busy and tired they are. They wear their overwork as a badge of honor. At the same time, they’re utterly oblivious to what they』re missing out on. They』re the ones who ask me how I find time to paint and write, and they are the ones complaining about never having the time to do other activities!

Overwork culture honestly drives me nuts.

I believe in doing good work, and spending my free time with my family and friends or on my hobbies.

I know that if I am well-rested and not distracted at work, mental exhaustion does not occur. Trust me, eight hours a day is plenty of time to get a good job done!

Learn to Pace Yourself

When I find myself working overtime to finish something or am pressed by a deadline, that』s a good sign that I didn』t estimate my tasks and stories well.

Learn to pace yourself and don』t commit more than you can deliver! As Jason Fried says in 「It Doesn』t Have to Be Crazy at Work」:
If you can』t fit everything you want to do within 40 hours per week, you need to get better at picking what to do, not work longer hours. Most of what we think we have to do, we don』t have to do at all. It』s a choice, and often it』s a poor one.
Another thing to consider is to plan appropriately. Splitting projects up into smaller tasks that I can complete in a few hours helps me to get ahead and feel more productive.

Breaking the problem into smaller tasks also helps me with procrastination. If I notice that I』m struggling to get into the flow, I will start with something, anything. For me making the first step is the hardest part. Once I start, it』s easier to keep going. Soon enough, I dive into the problem I』m working on.

I also prioritize the tasks depending on my energy levels. Research says that we have less willpower as the day progresses. If it were up to me, I would do more programming and problem-solving tasks in the morning and attend estimation and grooming meetings in the afternoon, when my energy has dropped.

Dealing with Interruptions

I recently changed jobs and made the transition from working remotely to working in an office. My friends started noticing that I spend more time at work and I』m usually tired when we meet up. I started wondering why. I found my self saying things like: 「Yeah, I try to start very early to get some work done」 or 「sometimes I stay late because the office is quieter.」

Think I read that exact sentence, in Tom DeMarco』s book Peopleware! In that book, he states that overtime is not so much a means to increase the quantity of work time as it is to improve its average quality.

Once I became aware of that, I started experimenting with a few things:
  • Finding a quiet room to work from.
  • Asking people in the office to use the meeting room for their calls.
  • Using a noise-canceling headset in the open space.
  • Working mornings from the office and afternoons from home.
I feel like I』m still trying to find my balance, but so far, the last option is what worked best for me.

Dealing With Bad Bosses

We have all been in companies where your colleagues stare you down if you leave work at a proper time. I had a boss who in our 1:1 meetings kept insisting on how we are at a critical time of the startup and how we should all put in overtime. Overtime for which I was not going to be paid. For the whole time I worked there, we never had a 「non-critical」 time!

It』s not just a question of being paid for my time. I will gladly put in more time if I am in the flow. Or if being in the office is beneficial for me, in the sense that I get to have interesting conversations with my colleagues and learn from them. Being forced to stay overtime in a gloomy or a noisy room is not improving my life in any way. So, thanks, but no thanks!

Some managers still live in the industrial age. They seem to think that people are like machines: If they spend more time in the office, they will produce more. Productivity doesn』t work like that. You』d be amazed at how much time people can stay at the office without doing any actual work. As DeMarco writes:

「Overtime for salaried workers is a figment of the naïve manager』s imagination. Oh, there might be some benefit in a few extra hours worked on Saturday to meet a Monday deadline, but that』s almost always followed by an equal period of compensatory 「undertime」 while the workers catch up with their lives. Throughout the effort, there will be more or less an hour of undertime for every hour of overtime. The trade-off might work to your advantage for the short term, but for the long term it will cancel out.」

If you have to deal with such managers, keep in mind that no one is going to tell you when to go home. You need to learn to value and protect your time. If the manager pushes you to work over hours, you have to learn to push back.
開源日報第684期:《C++測試 Google Test》
(Photo by Olena Sergienko on Unsplash)

Take a Break

I take breaks every few hours. Usually, I put my water bottle at my desk, which automatically pushes me to take bathroom breaks. I stand up, stretch, and talk to my colleagues over the coffee machine.

After a long meeting, if I』m feeling drained and unfocused, I go for a walk. There is a park near my office that makes you forget that you are in the center of Berlin!

Going for a walk also helps with daylight cravings during the winter, and when I』m back at my desk, I feel refreshed and able to concentrate again.

Embrace Procrastination

Sometimes it also helps to take a mental break, step away from the problem, and switch context. During my lunch break, I sometimes read a book or an article unrelated to my work. If I』m at home, I sometimes make a small sketch.

I learned that, for me, caffeine and sugar are temporary solutions. They usually wear off in an hour or so. But taking a break and doing something completely different is refreshing and gives me a much-needed creativity boost.

If you don』t take care of your mental health, you risk burning out. Everybody is different and what I suggested here might not work for you, so the best is to try to develop your techniques. Understand what circumstances lead you to your most productive work and try to replicate them.
下載開源日報APP:https://openingsource.org/2579/
加入我們:https://openingsource.org/about/join/
關注我們:https://openingsource.org/about/love/