Ask HN: How do you deal with the pain of programming?

11 points by grover_hartmann ↗ HN
Programming is often a very pleasant activity.

However, there are times this is not true, we as programmers usually get stuck with something that is complicated to solve.

That might be a bug, a non-trivial problem that we need to solve, or whatever it might be that we cannot solve quickly.

How do you deal with the stress though?

26 comments

[ 4.2 ms ] story [ 73.3 ms ] thread
What your describing is the best part for me. Obviously spending days languishing in confused and lonely impotence is horrible, but no job (in my experience so far) has the same high of going from producing nothing (ie. program doesnt work at all) to producing a perfect working product in one second, one line, one moment of insight.

As I get more experienced I get stuck or encounter problems less and less, I think I just keep doing more challenging or unfamiliar work in order to keep chasing that high.

Also to answer your question,HOw do I actually get through the bad patch? if I encounter a problem I tend feel like like a Terrier with a bone. Sorta mad, affronted, like I'm gonna git this problem no matter what! Though I am naturally very stubborn and dogged.
Also if I have to do an unknown unknown which could result in getting stuck for a while I will schedule loads and loads of time for it. Like make a reasonable estimate and then double it. Then it often turns out that you solve it in a fraction of the alloted time and you feel awesome! Definitely dont compound the stress by adding time pressure if at all possible.
I enjoy hard programming challenges, I'm not saying I don't enjoy them.

I'm saying, how do you deal with stress of tight schedules and deadlines AND having to solve a hard programming problem.

If it weren't for that stress, I wouldn't be a programmer. It is that variability, and challenge that keeps me coming back and satiates my desire to problem solve. But I understand, in the moment, it is hard to step back and see programming this way.

The only thing I do when feeling stressed, is to physically step back. I walk away from the computer, go on on a run, or get some sleep.

It is often within this absence that the solution to my programming problem emerges.

I understand, but combine stress with pressure from your employer, deadlines and such.

And then you get real stress.

That's what I'm referring to, how do you deal with that?

I'm not saying I don't enjoy challenges of solving real problems with programming, I do enjoy them.

Why do you think you need to deal with it any differently as a programmer than you would in any other office/desk job?
I don't need to deal with it. I asked how most of you deal with it.
I agree with this. I like solving problems. Not just typing in line after line of code solving problems I've solved a thousand times before.
The joy of fixing the bug/creating a solution for a non-trivial problem is enough for me.
I use TDD. No matter how complicated the task may be, I have found writing tests first really reduces stress.
According to your blog, you discovered TDD less than a year ago.
How does this mean that he doesn't use it for the thing this thread is addressing ? O_o
Some of you guys are misunderstanding me, I also enjoy the challenge of solving real problems.

But mix that with the pressure from your employer and deadlines and you get even more stress.

This is what I'm referring to.

How do you deal with that?

That seems like a problem of your employer imo. If they understand software development they'll know that blockers and problems habitually crop up and should be expected and timetabled for. Putting on pressure to get stuff done hastily or creating artificial deadlines will just make things much worse + create a load of technical debt for later. In my experience manager types who have little or no experience actualy building stuff themselves think this is a good idea, 'they must be goofing off I'll, light a fire under them!'

From the simpsons... Hank Scorpio: I'm gonna leave everything to you. We're on a tight schedule. You keep them motivated. [he leaves] [his staff is busily working] Homer: [to staff] Are you guys working? Man 1: Yes, sir, Mr. Simpson. Homer: Could you, um... work any harder than this? Man 2: Sure thing, boss. [they do]

Also relevant if your self-employed. In that case you must not be creating realistic schedules for yourself.

If I'm doing some project with a hard real deadline say, 3 months away. I'll arrange my timetable to have everything completely finished at least a week early cus I know, something or other will crop up at end end.

In conclusion perhaps scheduling/planning/timetabling issues are the route cause here. If you arent self employed you should definitely bring this up with your employer. If they are even halfway decent they should take this very seriously.

ps. I've only been working in software for a few years now but I have a good few years of experience working as an architect (building buildings) Architecture is all about project management and stuff always goes wrong! + If you delay the project everyone sues your ass off!!

Firstly, if this is a regular occurrence, you have a dysfunctional team. It’s possible that some coaching, retrospectives, and/or tweaks of the overall process of delivery might help.

What I do varies based on the situation… but one of the most surefire ways of making headway through difficulty or just frustration is pair programming.

Do what you can and be able to communicate effectively when a deadline or request cannot be accomplished with the resources (including time) allotted. Just because someone wants something done by a certain date doesn't make it possible. Frequently those dates are not related to the complexity of the task but to some external driving force such as marketing.
The complicated problems are not the pain to me. The trivial things are the pain.
I like to talk about the problem with other engineers. It sometimes feels like you learn everything the hard way but it usually turns out that's how it is for everyone.
I deal with it with an old trick.

(1) Backing away. Pushing through stressed produces inferior results.

(2) Using a different constraint. That's the real trick.

Only I can't make myself pick the right constraint from the get go if I'm feeling stressed, so I stay stuck in a loop. I need to back away for the subconscious to reveal the right constraint.

It's as if I have to give up first. It seems it's only then I finally let myself attempt a solution I haven't tried before.

So ironically the way to deal with the stress of getting stuck and having deadlines is to manage to reach the point where, after trying everything, you sincerely no longer give a damn.