TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Why do I feel anxiety when I'm writing code?

2 点作者 acidus将近 8 年前
I&#x27;m trying to rewrite something from scratch and I&#x27;m not finding it easy at all. I&#x27;m supposed to be doing this for fun but I&#x27;m struggling quite a lot. I kind of enjoy it, don&#x27;t get me wrong, I love programming - but I also feel the pain.<p>Most of the times I don&#x27;t experience this feeling. But it happens consistently when I&#x27;m facing a tough problem that it&#x27;s a bit over my head.<p>Why is this happening? Do you have any tip to overcome it? Hard problems should be fun to solve, not the opposite.<p>This is not new to me. I remember I had a similar issue in school. It feels that at some point my cognitive capacity hits the wall and anxiety kicks in.

3 条评论

tlack将近 8 年前
I see this in myself at times. A few ideas based on your scenario:<p>1. We are constantly screamed at on sites like HN that there is a right and a wrong way to do something. It&#x27;s almost always just a fashion trend of some kind, and the reality is: there is rarely a single &quot;best way&quot;, the pros mess up all the time, and even the perfect design will grow haggard with age, and that ain&#x27;t a long time in this business. Perfect is an illusion, so just try to make some reasonable choices.<p>1.5. Naming things is hard, but there is no perfect name. Pick a single letter and move on! :)<p>2. You are replacing something that already works. As you begin your planning, you&#x27;ll start to notice all kinds of little features you&#x27;ll have to build out.. the boring minutiae that you didn&#x27;t even notice the first version did.. and then the scope of work changes, becomes less thrilling, and that can be discouraging.<p>3. It&#x27;s always difficult to start from a blank page, especially in a software system where the &quot;method of entanglement&quot; of all the moving parts is such a key design decision. Sometimes it&#x27;s good to just pick some interesting part and write that in isolation. Then you will get some momentum going and you can move on to fleshing out the rest.<p>4. Anxiousness sometimes comes from not knowing the full scope of the problem. Try sketching on a napkin some pieces of what you have to do. Try to start from large blocks and decompose. This might help you feel more comfortable committing some code.<p>5. Maybe the project is just way more boring than you thought. :)
airbreather将近 8 年前
Maybe you are worried about not how it will work, but the myriad of ways it might fail under unusual&#x2F;unexpected circumstances?<p>I particularly feel this anxiety when writing code for real time safety&#x2F;automation&#x2F;process control systems of plant and machinery.<p>For me this is as the consequences can be quite visible and quite expensive - many tonnes of equipment or megawatts of power may be involved and you can&#x27;t just reboot it to fix it once the equipment is damaged. Also a lot of peoples jobs may be impacted, so others are relying heavily on you to get it right.<p>I find that good architecture&#x2F;data structures go a long way to allowing a feeling of ease as these enable simpler code to be created. That and use of state machines so the behaviors are exhaustively and unambiguously defined and if well structured then debugging is limited to small parts of the code related to a particular state or transition.
cerberusss将近 8 年前
Isn&#x27;t that natural?<p>There are obviously certain sweet spots in projects where you&#x27;re at your best. For me, that is after the initial coding on the project, but before going into maintenance mode. Adding big new features to a project is what I like best.<p>However when I step into an existing project with a huge amount of code, there&#x27;s a lot of uncertainty. Did I grok the existing architecture? Will I use the existing code to its fullest? Do I make it better instead of worse?