
Ask HN: How do you code while dealing with personal problems? - heyheyhey
I had some personal problems this weekend and it&#x27;s been on my mind all morning to the point where I can&#x27;t concentrate at work.<p>Unless it were some urgent bug fix, I find coding to be extremely hard for me as my mind is always wandering.<p>Any advice?
======
twobyfour
In short, compartmentalization. Ymmv, but here's what works for me:

1) first, grab a real pen(cil) and paper (even if it's scrap), sit down
somewhere comfortable, and take some time to write down what's bothering you.
How it makes you feel, and why, and what you want to do about it, and
everything that's been running through your mind about it. Until you have no
more to say. This helps your mind feel like you have given the problem the
attention it deserves.

2) write down 2-3 finite, specific tasks that are important for you to get
done today, and that you know that on an ordinary day you can complete all of
in just half a day. This is a point of focus for your workday. Even if you
accomplish nothing else, completing these tasks should be considered a victory
on a bad day.

3) take a walk or meditate for 15 minutes to clear your head and refocus.
Don't beat yourself up if your mind wanders or even returns to what's
bothering you, but if you can empty your head, do. The purpose of this time is
to create a mental break between the thinking about this problem and thinking
about work.

4) don't force yourself to start coding. Do force yourself to open up your
text editor to the place you need to be to get the first of your 2-3 tasks
done.

5) if, at this point, you're still unable to code, take a mental health day or
two. Focus on taking care of yourself, because you'll be more productive
tomorrow if you heal yourself today.

~~~
l33tbro
I second the "brain vomit" approach. I'm not entirely sure it works for
everybody, but for people like me who are introverted and not so emotionally
coherent, writing everything down like this is like burrowing through to the
main route of a problem. It's like going into a photo lab with your negative,
and you sit there slowly watching your neuroses / problems / bullshit appear
before your eyes on paper. Magic.

The older I get, the more I realise the most important thing we owe ourselves
and each other is greater self awareness, and this tool/process is invaluable
in achieving that. At the very least, will give you the clarity needed for
coding.

------
tboyd47
Try to find something easier to work on until it passes.

At my company, I switched over to our new stack (all ReactJS) at the end of
last year and then had a whole bunch of personal/family drama hit me right
after. It was so overwhelming I had to ask my supervisor to move me back to
our old (Ruby) stack. I'm grateful he did. Not having to suddenly learn 10 new
technologies at once gave me back the mental space I needed to deal with the
other stuff.

------
joshrotenberg
Take the day off. Your mental health is likely much more important than any of
the work you'll do over the next day or two.

------
o2l
I am going through the same right now. The problems are of the kind which
won't be fixed overnight, but I realise that it is important to make your
peace with it, even if you are not able to solve it right now.

I am going to take a small break now to mindfully approach all the problems
and think of what I can do to solve them today. If there's nothing I can do
today, I can at least know that I did whatever I could for now and can move on
from the thoughts temporarily.

Listening to music which you usually listen to while programming can put you
back in the zone, if the problem is not too serious or not too distracting.

------
NotSammyHagar
Try to figure out how you can talk about this issue with someone. When my mom
died I couldn't do much (it wasn't as important b/c i was in management 1/2
;-)), and I eventually left the company, looking for something new. Maybe see
a therapist, or find someone to talk about it with. I have no idea what
happened, maybe you got a dui, maybe you broke up, maybe you witnessed a
tragedy. In any case, talk it out with someone. Good luck, life goes on. Even
if you made some bad choice that affected someone else, you could try to help
improve the world as partial compensation.

------
w4tson
Try going for a run. You get some alone time, the exercise does you good and
the endorphins released afterwards can ease the problem

I find myself more energized getting straight to work after a run.

Hope you work it out

------
imauld
Nothing wrong with taking a mental health day off of work. Especially if it's
bothering you so much you can't concentrate.

~~~
chauhankiran
And I strongly suggest to do this - take couple of days break from coding in
month or two.

------
bbcbasic
Been in that boat. Got nothing done for a couple of days. Fortunately I was at
the company a while and could get away with it as I wasn't being micromanaged.
In heinsight a couple of days leave might have been wiser. If they try to make
you feel guilty for taking it, increment the red flag counter :-)

------
shortsightedsid
Your personal problems (and health and family) should always come first before
work. Any reasonable manager should be able to recognize that and help you
out. Worst case take a day or two off to solve your problem. Long run - day or
two won't make a difference.

------
edimaudo
Here are some options you can take. \- If you work for someone, then talk to
your manager about your issue and see if you can get a lighter work load \-
Another option is to take some time off in order to address the issue

------
dmitripopov
It's a natural thing. Handle your personal issues first. But make sure you do
not suffer from Anxiety Disorder - you need help in this case.

------
jf22
It is ok if you aren't 100% productive sometimes.

------
crypto5
You can use coding as a kind of meditation to clear your mind from negative
emotions.

------
d--b
Multiple techniques:

\- take some time off

\- work out

\- do free expression exercises

\- meditate

~~~
tedmiston
Second to meditation, even on days where everything is fine. The app Simple
Habit is a good one for a variety of themed meditations.

[http://www.simplehabit.com/](http://www.simplehabit.com/)

------
tonteldoos
Firstly - good luck! I hope whatever it is, that it resolves itself sooner
rather than later, and that it's not too serious.

For suggestions, it's going to depend on what type of problem it is.

For a short term (or not overly personal) problem, like extended family issues
or similar, take day off and either:

* Sort out the issue (if you can)

* Relax - just taking a day for yourself and doing what you feel like doing (even if it's lying in front of the TV all day) can do wonders for your mental state

Like another poster pointed out, the issue can be more productively dealt with
or processed with a dedicated day, rather than trying to do it inbetween work
commitments.

For longer term issues (serious illness in immediate family, relationship
problems, etc), there is no surefire way to deal with it, but there are ways
to make it impact your work less (note: it WILL impact your work - the goal is
to make that impact as minimal as possible). Keep in mind that your health and
mental health impacts your ability to work and provide for yourself (and
family). Protect this at all costs, and remember that family responsibilities
should come first (any reasonable employer will understand this to some
degree).

Some things that worked for me:

* Inform a superior that you trust about the issue. Tell them that you will do your best to minimise impact on work, but it's important that someone knows you're not just 'slacking off', but dealing with problems. Ideally, this is someone that will have your back.

* Talk to someone, be it a friend, professional, family member, etc. Talking to someone helps you process the issue quicker, and takes some of the worry off your shoulders.

* If you have elements of your job that involves close interaction with other people, do those. Interacting with another human (with the knowledge that you can't let them down while working with them) is a quick way to focus, and also has room for lighthearted interaction, or deep technical discussion with someone to take your mind off things.

* Focus (in the short term) on things that you're good at, and can do almost 'mechanically'. If you're good at coding, but hate documentation, do the coding. If your superior knows what's going on, they'll understand.

* Find things that are mechanical to do - if you need to test things, and there are test plans and procedures in place that you can follow systematically without too much thinking involved, do those.

* Meetings. Everyone jokes about them, but they are good in this case (unless you have to prepare/present them).

* Lower your expectations for daily output, so that you are not disappointed at the end of a day. Do, however, try and absolutely stick to these lowered expectations. Start small with tasks, and once you're in the groove, keep running with it. Try your best to not overthink things - break them down into small, manageable chunks.

* Try and avoid unnecessary interruptions when you're in the zone, because at this moment, it will take you much longer to get back in the zone.

* Try and avoid things that will remind you of the issue while at work - deal with them after or before work. Do not check personal e-mails, etc. Obviously this is not applicable in all scenarios, but helps for things that you can't do much about short term.

* If it all gets too much, take a day off, and relax. A 'mental health day' can buy you another month work of mostly productive work days.

I hope this helps!

------
rcoder26
When u code ... U just code ...Imagine if you coding a critical software a bug
left due to your personal problems can cause many other ...

