Ask HN: How do prolific programmers go about their daily lives?
Three tips come to mind:<p>1. Get enough sleep. You&#x27;ve only written three paragraphs and there are already a lot of suggestions that you need more (&quot;I don&#x27;t feel as productive as others&quot;, &quot;I just drop dead in bed&quot; when well-rested people usually take 15-30 to fall asleep, &quot;I felt like I was inches away from becoming part of the zombie horde.&quot;)<p>Coding pretty intensively uses your short-term memory: &quot;I need to take this query which I prepared above and execute it on those variables, wait, this key from the database gets renamed to that on the front-end, okay, test it... dictionary does not have the right key on line 189? What&#x27;s over there? Oh, I forgot to do this critical preprocessing step, jump back to my code, 3 lines before, add the function call, test again -- what the crap is that, switch back to editor, aha, missed a semicolon here...&quot;.  Each of those actions requires you to not be overwhelmed by the number of details you have to remember, whether it&#x27;s where your tool for testing is located, or what the preprocessing function was called, or what have you.<p>When you&#x27;re even a little sleep-deprived, your short-term memory decreases dramatically -- if most normal humans can only juggle 7 balls (7 big details or crucial tasks occupying their memory), missing a few hours of sleep brings it down to 4 or 3. So of course everything looks two times bigger.<p>Sleep deprivation also causes you to lean on substances like sugar and caffeine, and those substances tend to cause procrastination &quot;I&#x27;ll browse Reddit until this kicks in&quot; -- until their effects wear off and leave you right back where you started with a bunch of nothing done. You can mitigate this somewhat by giving yourself a short task to do before the caffeine kicks in, even if it&#x27;s an asinine one like &quot;write down what you want to do today.&quot; Speaking of the which...<p>2. Write shit down, set alarms, otherwise use harebrained tools.<p>Those 7 balls that you can juggle need to incorporate just about everything that is happening in both personal and professional life -- not just code. If those things are in the mix, then you&#x27;re not as effective. Just like how you should set an alarm for &quot;time to start brushing my teeth and getting ready to go to bed&quot; so that you can get enough sleep, you can set an alarm for &quot;at this time I need to stop everything and call the couch company to send someone to fix the couch at home.&quot; Write those things down somewhere, set an alarm to look at that list and do the things on it.<p>3. Kill context-switches. Either lie your ass off about them or say &quot;no&quot; up front or be honest -- whatever is necessary to kill them.<p>Take your hands, open them in front of you, spread out your fingers, interleave them. That is 8 work tasks spread out over some distance L. Maybe it&#x27;s 8 hours of the day working on two projects, Right and Left. One gets concluded at 4pm, the other at 5pm. We&#x27;ll assume you got started at 8am and ignore an hour for lunch.<p>Now separate your hands and collapse your fingers. Put your right hand above your left hand, touching. Still 8 fingers in a row, but now you notice that your Left project is released at 12pm before lunch, while your Right project is still released at 5pm after. You just improved your average time-to-completion by 2 hours with no stress, and no improvement in efficiency: you just rushed one project out, then focused on the other.<p>Now interleave your fingers again and remember how each of those switches between projects feels. You&#x27;ve got 7 in there, yes? Each one doesn&#x27;t feel good, does it? Because you&#x27;ve got to stop juggling one set of balls, put it all down, and slowly start juggling this other set of balls. Each context switch eats up mental energy. (It also eats up time -- if you need 15 minutes to really get up to speed, then the 7 context switches eat up almost 2 extra hours of your day. So there <i>is</i> an undisclosed efficiency gain here.)<p>If management forces on you to be working on the two things at once with constant status updates, strongly consider lying your butt off. (Of course, first show your boss the trick with the fingers, it usually convinces them.) Because if management is asking you to do worse work slower so that they can be polite to two of their separate clients, then management has failed. They&#x27;re supposed to buffer you from all of that crap.<p>If you can&#x27;t lie and you can&#x27;t convince your management, try a firm &quot;no.&quot; Just say &quot;I&#x27;m on this high-stakes Project Left right now, I can&#x27;t take on Project Right right now, maybe when Project Left is over I can. Fortunately I think Project Left will be done by end-of-day today, possibly before, so if you really can&#x27;t find someone else, I may be able to start Project Right today.&quot; A &quot;no&quot; always goes better with a nice timetable that suggests that the task will still get accomplished in a timely manner.<p>Similarly, ignore those &quot;trends&quot; when you&#x27;re coding. Trends are another project with another context switch. Don&#x27;t interleave it with anything else.