Live data from Hacker News

Ask HN: How do you stay focused while programming/working?

news.ycombinator.com

11–20 of 54 posts

Re: Ask HN: How do you stay focused while programming/working?

#11
post #3

It's not exactly new and exciting, but I found that listening to calm, instrumental music helps me focus. Mostly Ambient. If you do not like electronic music, Stars Of The Lid or Bohren & Der Club Of Gore are very much worth checking out. Also, https://mynoise.net/ has worked wonders for me. In both cases, it seems that unstructured audio input, like, occupies the parts of my mind that would otherwise distract me.

> It's not exactly new and exciting, but I found that listening to calm, instrumental music helps me focus. Mostly Ambient.

Same. Lounge, Ambient, Chillout, Chillstep (https://di.fm has a bunch of great streams. SoundCloud and MixCloud have complete replayable sets, too.)

I've heard that videogame soundtracks are designed to not be distracting; to help focus.

Re: Ask HN: How do you stay focused while programming/working?

#12
post #9
post #6

Earlier quoted context omitted.

A lot of the good stuff is off the shelf. L-Theanine for focus. Creatine monohydrate for more RAM (thinking faster, less brain fog).

Huh, I've been taking 3-5g of creatine mono every day for ~5 years and have never heard of it having mental benefits until now.

It's a lot like RAM. You notice it when you're not on it. I think the most obvious effect is humor... while on it, I'm quicker to see an opportunity for a joke. I assume it applies for finding breakthroughs faster.

Re: Ask HN: How do you stay focused while programming/working?

#13
post #6
post #4

Prescribed stimulants.

A lot of the good stuff is off the shelf. L-Theanine for focus. Creatine monohydrate for more RAM (thinking faster, less brain fog).

About stuff off the shelf: I bought Focus Pep (https://www.amazon.com/Addrena-Stimulants-Boosting-Dietary-S...) a year ago or so off Amazon (I believe they are only sold through Amazon). Well, they helped me tremendously. I would take them minutes after I would wake up and I would then consequently have a want and go for a three mile run every day of the week. Then I would go to several of my classes and be focused to the dot. You could even say, I felt I was in a confident "flow" state when I took them. I ended having an all time best sleep schedule, since I took them in the morning so by nighttime I was so exhausted I would fall asleep early and wake up early. But the period when I took them, I would get sweaty easily, my entire being would be jittery, and I would not feel hungry throughout the day. I eventually got off them because I didn't feel natural and at ease, I always had an anxious need to do something. Though now that I'm not on them, I'm more prone to: being sad, overthinking about things, having trouble falling asleep and getting out of bed, not having a want to exercise, etc.

Re: Ask HN: How do you stay focused while programming/working?

#14
Disclaimer - I wrote this https://betterself.io to help me out here. It's helped me get much better, but certainly isn't perfect. It's open-sourced at https://github.com/jeffshek/betterself/.

Someone posted this quote a while back, and it stuck with me. "Think of your mind every morning as a clean desk, and every time you get distracted via social, game, etc, you put something on it. It then gets progressively harder to do work with a messier desk. The best way is to just always have a clean desk."

I logged habits and supplements for over a year. Things that were effective were having a lot of strong routines that pull you in the right direction.

So things that helped were

X) Have some type of metric you are measuring to. For me it was RescueTime and WakaTime. How productive was I for this week compared to last?

1A) Have your phone on DnD or Airplane Mode.

1) Start the day off with SelfControl app. Add the timer to lock out all disractions until X PM every day.

2) Use a cold shower to wake up

3) Meditate

4) Eat the same foods that won't make you groggy / crap. This sounds masochastic in some way, but it's much easier than it sounds once you get used to it. For instance, the same oatmeal for breakfast is a great way to set a routine.

5) Track what supplements and food you were taking that improved productivity.

6) Inversely, see what supplements or diets you might be taking that does the opposite.

7) Set up a sleep routine. Melatonin at 3mg is a sweet spot. Getting six hours of sleep every night is the perfect amount for me. Everyone varies. The point is don't take "one size fits all advice" for something so crucial to your life. Less than 5 and I was easily distracted. More than 7 and I was groggy. There's a lot of information about how to sleep better. The point is to find a way to maximize sleep quality ... six hours in a city is going to be very different from six hours of sleep in a quiet area.

8) I've tried a lot of supplements. The most effective ones on productivity were ones that helped me with anxiety (so the opposite of caffeine). I eliminated a lot that didn't do anything.

9) Have a track / music that you listen to that starts you in a groove. For instance, I have a EDM Mixtape that I've probably listened to over a thousand times this year. You'll find that a lot of high throughout writers do something similar. The music helps build a habit of "okay, it's time to do work now"

10) Find the right setting / environment that makes you productive. Face a wall. Accept the fact if you can't work from home, then don't.

11) Go for walks when you're bored. Admit to yourself when you're not being productive and you're just spinning your wheels.

12) Exercise. Missing gym workouts (even though it was like 1-2 hours) was a sharp drop in total productivity.

13) Pomodoros. Start with 25 minutes and keep on going up (I average hour long Pomodoros now). When you get distracted in a Pomodoro, have a note card called "Distractions" and write what you want to to do there. That way your mind can stop obsessing about "New Avengers Trailer" if it knows it's going to get there after the break.

When you first start with Pomodoros, have a notebook of how many Pomodoros you did. Make it a goal to do just five pomodoros a day. You'll be impressed how hard that is initially.

14) No lying to yourself. Everytime I've said "this time is different for a YouTube video about anything mildy interesting", I've regretted it.

15) Plan for a social night at least once a week. You do need some rest. Self flagellation about not having earned it is almost a recipe of more anxiety and procrastination. (I'm not great at following this yet)

16) Have a deadline to finish something.

To give some backdrop, this has made me really productive throughout the last year without burning out. I've worked 60+ hours before at startups and just BURNED out, whereas now I can definitely push that easily without hitting that same wall. I integrated all these habits one by one when I was certain through quantitive evidence it was working.

Can't say much about helping social life though. This definitely takes a hit when you try to maximize productivity and flow at the expense of social life.

Re: Ask HN: How do you stay focused while programming/working?

#15
Find something else to reward yourself with. For example, a drink of flavored water or a sip of coffee/tea. Also, try coding offline. I always do my best programming when offline– pencil and paper is the best.

If you've already implemented a method in pseudocode, you can use StackOverflow/documentation/Google/etc to look up the actual API calls once you're translating the program into code.

Re: Ask HN: How do you stay focused while programming/working?

#17
A short walk and breath of fresh air is one of the more consistently serendipitous things that help creative work. Music helps too, though silence can help too - it depends on your emotive response at the time I guess.

"Brain dumps" - the act of transferring mental information to another medium can itself be a great mental relief. eg.:

- drawing diagrams w/ pencil and paper. things are more complicated than we first imagine them, often... remember, "the right perspective is worth 80 IQ points" - alan kay

- debugging by talking to yourself out loud

- post-it note reminders everywhere -> your short-term/working memory doesn't feel cramped

It is possible, maybe, that you are a bit concerned about enjoying programming/working to the fullest extent.. because you expected it to be more enjoyable. All that said... good focus is not just maximum momentum -- what you are really asking about, imo, sounds like a question of laminar vs turbulent flow :) To go "down the rabbit hole" with great momentum, versus a fragmented mind pulled apart in every direction with equal momentum :P Well, we all know how time flies when you're having fun, or enjoying good company, right? Yet it almost seems you are asking for tips on how to make time fly when it shouldn't, hypothetically kinda like this:

>"if -- while I am working on something difficult -- I had the capacity to just make time fly quicker, then I'd have no problems with stamina or keeping focused, by design. Furthermore, it would be a momentary-enough challenge to /become fun/. So how do I hasten the passage of time when work is hard?"

The answer to this is: unimpeded flow = mastery. Extrinsic obstacles are easy to spot but one's intrinsic obstacles take much longer to become aware of..

Only after intuition replaces the tendency to hesitant deliberation will deliberate action come easily. As you gain experience, you subvocalize less and operate 'fluidly' at the right mental level of semantics.. With mastery comes the use of "the voice as an object that can be seen as the lever of thought" [0]. Just think of the last time you were amazed by a display of talent or performance by someone that left you so amazed you wished for a few minutes more of their time.

imo, to solve your problems, you have a few options:

- you could improve to the point that coding gains a new and desiring appeal.

- you could find something (or somebody) with exceptionally inspiring talents to code with

- or, you could look deeper into yourself, and see if the focuslessness is really just a desirelessness

[0] https://mitpress.mit.edu/books/voice-and-nothing-more

Re: Ask HN: How do you stay focused while programming/working?

#18

Find something else to reward yourself with. For example, a drink of flavored water or a sip of coffee/tea. Also, try coding offline. I always do my best programming when offline– pencil and paper is the best. If you've already implemented a method in pseudocode, you can use StackOverflow/documentation/Google/etc to look up the actual API calls once you're translating the program into code.

Do you have any examples of good pseudocode? I have tried this method but feel as if I am not doing it in an effective manner?

And while writing pseudocode how do you know the level of depth and detail to include.

Post reply on HN