Write Code Every Day

Last fall, work on my coding side projects came to a head: I wasn’t making adequate progress and I couldn’t find a way to get more done without sacrificing my ability to do effective work at Khan Academy.

There were a few major problems with how I was working on my side projects. I was primarily working on them during the weekends and sometimes in the evenings during the week. This is a strategy that does not work well for me, as it turns out. I was burdened with an incredible amount of stress to try and complete as much high quality work as possible during the weekend (and if I was unable to it felt like a failure). This was a problem as there’s no guarantee that every weekend will be free – nor that I’ll want to program all day for two days (removing any chance of relaxation or doing anything fun).

There’s also the issue that a week between working on some code is a long time, it’s very easy to forget what you were working on or what you left off on (even if you keep notes). Not to mention if you miss a weekend you end up with a two week gap as a result. That massive multi-week context switch can be deadly (I’ve had many side projects die due to attention starvation like that).

Inspired by the incredible work that Jennifer Dewalt completed last year, in which she taught herself programming by building 180 web sites in 180 days, I felt compelled to try a similar tactic: working on my side projects every single day.

I must write code every day. I can write docs, or blog posts, or other things but it must be in addition to the code that I write.

It must be useful code. No tweaking indentation, no code re-formatting, and if at all possible no refactoring. (All these things are permitted, but not as the exclusive work of the day.)

All code must be written before midnight.

The code must be Open Source and up on Github.

Some of these rules were arbitrary. The code doesn’t technically need to be written before midnight of the day of but I wanted to avoid staying up too late writing sloppy code. Neither does the code have to be Open Source or up on Github. This just forced me to be more mindful of the code that I was writing (thinking about reusability and deciding to create modules earlier in the process).

Thus far I’ve been very successful, I’m nearing 20 weeks of consecutive work. I wanted to write about it as it’s completely changed how I code and has had a substantial impact upon my life and psyche.

With this in mind a number of interesting things happened as a result of this change in habit:

Minimum viable code. I was forced to write code for no less than 30 minutes a day. (It’s really hard to write meaningful code in less time, especially after remembering where you left off the day before.) Some week days I work a little bit more (usually no more than an hour) and on weekends I’m sometimes able to work a full day.

Code as habit. It’s important to note that that I don’t particularly care about the outward perception of the above Github chart. I think that’s the most important take away from this experiment: this is about a change that you’re making in your life for yourself not a change that you’re making to satisfy someone else’s perception of your work. The same goes for any form of dieting or exercise: if you don’t care about improving yourself then you’ll never actually succeed.

Battling anxiety. Prior to starting this experiment I would frequently feel a high level of anxiety over not having completed “enough” work or made “enough” progress (both of which are relatively unquantifiable as my side projects had no specific deadlines). I realized that the feeling of making progress is just as important as making actual progress. This was an eye-opener. Once I started to make consistent progress every day the anxiety started to melt away. I felt at peace with the amount of work that I was getting done and I no longer had the over-bearing desire to frantically get any work done.

Weekends. Getting work done on weekends use to be absolutely critical towards making forward momentum (as they were, typically, the only time in which I got significant side project coding done). That’s not so much the case now – and that’s a good thing. Building up a weeks-worth of expectations about what I should accomplish during the weekend only ended up leaving me disappointed. I was rarely able to complete all the work that I wanted and it forced me to reject other weekend activities that I enjoyed (eating dim sum, visiting museums, going to the park, spending time with my partner, etc.) in favor of getting more work done. I strongly feel that while side projects are really important they should not be to the exclusion of life in general.

Background processing. An interesting side effect of writing side project code every day is that your current task is frequently running in the back of your mind. Thus when I go for a walk, or take a shower, or any of the other non-brain-using activities I participate in, I’m thinking about what I’m going to be coding later and finding a good way to solve that problem. This did not happen when I was working on the code once a week, or every other week. Instead that time was consumed thinking about some other task or, usually, replaced with anxiety over not getting any side project work done.

Context switch. There’s always going to be a context switch cost when resuming work on a side project. Unfortunately it’s extremely hard to resume thinking about a project after an entire week of working on another task. Daily work has been quite helpful in this regard as the time period between work is much shorter, making it easier to remember what I was working on.

Work balance. One of the most important aspects of this change was in simply learning how to better balance work/life/side project. Knowing that I was going to have to work on the project every single day I had to get better at balancing my time. If I was scheduled to go out in the evening, and not get back until late, then I would need to work on my side project early in the day, before starting my main Khan Academy work. Additionally if I hadn’t finished my work yet, and I was out late, then I’d hurry back home to finish it up (instead of missing a day). I should note that I’ve been finding that I have less time to spend on hobbies (such as woodblock printing) but that’s a reasonable tradeoff that I’ll need to live with.

Outward perception. This has all had the added benefit of communicating this new habit externally. My partner understands that I have to finish this work every day, and thus activities sometimes have to be scheduled around it. It’s of considerable comfort to be able to say “Yes, we can go out/watch a movie/etc. but I have to get my coding in later” and have that be understood and taken into consideration.

How much code was written? I have a hard time believing how much code I’ve written over the past few months. I created a couple new web sites, re-wrote some frameworks, and created a ton of new node modules. I’ve written so much I sometimes forget the things I’ve made – work from even a few weeks prior seem like a distant memory. I’m extremely pleased with the amount of work that I’ve gotten done.

I consider this change in habit to be a massive success and hope to continue it for as long as I can. In the meantime I’ll do all that I can to recommend this tactic to others who wish to get substantial side project work done. Let me know if this technique does, or doesn’t, work for you – I’m very interested in hearing additional anecdotes!

I spent the last few months doing this and I could not agree more with what you’ve written. I had a 161 day streak, and I believe it had a really positive effect on my life for many of the same reasons you mentioned – I was better at managing my time, I had less anxiety, and I infrequently had trouble picking up where I left off. Last week, I got back from a ten day trip, and it has been very, very hard to achieve the focus I had during this streak. This is actually kind of depressing, and leaves me wishing I had set aside more time during my trip to do a little bit of coding each day. Before taking some days off from coding, I did not feel exhausted or burnt out, but as friends suggested, it seemed like it would be a good idea to take a break, just for the sake of giving my mind a rest and making sure I wasn’t overworking myself without realizing it.

In retrospect, I do not regret taking the time off – I knew it was inevitable that I’d need to go some time without coding. But, the next time I do go on a trip or find myself without access to my computer for a while, I think I am going to plan ahead a little better, and think of ways to keep the projects/code/ideas fresh in my head so that it’s not so hard to pick up where I left off. Perhaps this just means writing ideas down on paper on a daily basis, or asking people around me what they think of the latest UI in my app – stuff like this will hopefully help to keep it all fresh in my head.

For something you yourself use every day, you always know what you need to work on next: it’s whatever bugged you about it the most yesterday. You also get immediate feedback on what you wrote yesterday: you get to use it tomorrow. It’s a daily feedback loop both of incentive, and of productivity.

I find continuous improvement is difficult for things that I don’t use myself. It means to figure out what to work on, I need to guess, or gather data from users, or listen to a product manager. It means I don’t get to see yesterday’s improvements, except indirectly. It means yesterday’s work doesn’t help make today’s work any easier.

this is something I’ve been trying out recently. But I haven’t been able to keep up with the pace. Since, the anxiety of missing one day, kills me. It just breaks the chain. I’ve been trying hard to get time off’s on evenings, but it’s not always possible.

I might try the early morning coding. Since, its lot easier to start coding with a fresh mind.

Thanks a lot for this post. It will definitely gives me helpful pointers. :-)

I’m actually starting off a similar project, came up with it last week: the 30 days of Git Commits; however, I like your 20 weeks better.

The main issue I have with structuring your life this way is the pure amount of time you’re spending on coding. I work as a programmer in my day job, that’s 7-8 hours of solid coding a day (with breaks of course).

Adding another 30 minutes on top of that should be fine but never at the cost of another hobby. At least to me, because then my “side projects” begin to feel like work, and I do enough of that already ;)

What I started doing last year (or maybe the year prior to that) is a concept of “monthly goals (http://renewlifebalance.com/?/monthly-goals/ <- wrote about it here). Which is basically the idea of picking a subject, whatever hobby, or work, or whatever, and focusing on just that for a month. And the focus greatly helps alleviate the ADHD-type behavior where you have time and either mis-spend it or can't figure out what to focus on.

It's the same concept as writers doing NaNoWriMo, or coders doing a 30-day git commit sprint.

I hope you get back to the woodblock printing and enjoy that for a change! :)

Inspiring indeed, but you should mention that even if you write daily code, never forget about your personal life, including friends and family.
After all you are just chasing your dream, but don’t forget about others.

I got a 35 days streak, took two days off, and now continue with a new streak. But I’ve seen all the advantages you mention on this blog post in my daily routine. Mostly background processing, since I’m always thinking of new ideas to implement both as new projects or as improvements to my current projects.

I still work on refactors, docs and similar stuff some of the days. I also love midnight coding, though sometimes it extends to 4am coding and I am not so happy the other day when I check out the code I wrote at 4am :P
Those are the parts I need to improve the most, but I fully agree with the post and the advantages of writing code every day.

I think this is called the Jeremy Seinfeld ‘Chains’ method – as in don’t break the chain!
Although github already shows us the chain, some people could use https://chains.cc/
to track various activities.
The main problem for me has been to start and stick with this for a few days at least, and then the habit establishes itself. It’s the first week that’s crucial.

I recently started the same discipline. I spent a good part of my career writing code then worked my way up to executive management and stopped. After several years as Director of this, or VP of that, my skills had eroded. Late last year I decided to take a sabbatical and get back into the game by applying to Hack Reactor in SF. It was an intense period of two months of pre-course work (18 Code School classes and a bunch of coding assignments), followed by three months of intense work on site where we went 11+ hours a day for 6 days a week. One of the disciplines there is to work on a short “toy problem” every morning for 30-60 minutes. Although I finished the program recently I am keeping up that practice as well as working on my real project, a new startup for social video. I’ll never stop coding again!

WOW ! That’s my story (the problem part). Thank you for writing.
I plan to do so much on on weekends and I get depressed for not completing the TODOs.
I think it’s important not to Plan too much and do less at a time. With information overload, we just forget we are humans not computers and try to do a lot of things which backfires instead.

Consistency is very important, I’ve been coding for many years now most of the code Is private. But I’ve always tried coding daily, this makes you think about code and fix bugs even in your dream ^_^ Good post thank you.

My coworker has a streak over a month now, and I may join. Keeping count is itself a turn-off for me, so I’ll need the mindset of just counting to two: yesterday and today. This suggestion could help improve my favorite side work, by not cramming 7 hours in the dark between Saturday and Sunday.

P.S. I love Steven Resig’s illustrations, but it seems his server’s doing its best just to load the thumbnails; larger versions were inaccessible.

This resounded with me. I just came to many of the same conclusions you touched on. After years of continually starting and never completing side projects I came to the slow realization that something needed to change. I also forced myself to code everyday (weekends included) and developed the habit of doing at least a couple hours first thing in the morning. Thanks for the post and reaffirming the benefits.

That’s a saying I keep telling myself as I try and do what your article suggests. I also like to write about my projects in blog posts in a coder-centric ‘dear diary’ kind of way. It not only allows me to remain enthused about what I’m doing and provides something to show to friends but also journalises how much has been accomplished. Knowing that the time hasn’t been wasted is important for self-esteem.

I had a pretty good run starting my first project in Go, where the rule was mostly “just do *something* now, no matter how ridiculously small.” And “something” meant bits of functionality or improvements (like cleaning up pain points in the code) I could test; plans are cheap.

I found small, running pieces add up to actual software faster than you think. The wrong kind of sitting and thinking slows you down more than you think. Actually making stuff is motivating and maintains momentum. The bit about problems percolating in the background as you work is totally true.

I also found the other thing folks in the comments mention, that it just takes an incredible number of hours. I mostly had to forget about it when I had to focus on real life for a bit. I’m pretty skeptical about the idea that seems to be widespread that coders *should* have side projects to show, that they’re somehow necessary for a coder to be whole rather than just a cool bonus thing that life sometimes permits, like, say, exercising 3x/week or baking really good bread.

Finally, with a better idea of the investment, I care a bit more about what I choose to work on. I need to either be *really* confident I’d find just the doing itself worthwhile (e.g., using fun CS or expanding my limits somehow) or I have a rational hope that my work could actually help the world in some really miniscule way.

Also, just observing the difference in doing a side project now vs. soon after college makes me aware that time management just works differently with friends and social obligations.

I feel like there ought to be some way to swirl this around into a satisfying synthesis involving building things in thousands of tiny pieces around the rest of life or something. But, not right now.

Reading this almost seemed that I wrote it. Exactly the same feelings of guilt over not working on side projects enough, delaying work for the weekends etc. I too ended up commiting to write code every day, but I also set myself specific hours to do so: 5am to 8-9am. This meant that I should wake up at 4am each day, go to bed early etc., but has the added benefit that the world is a quiet place at night/early morning and I find it very easy to get into “the flow”, no distractions.
Very nice read, it’s interesting to see how similar lives of programmers might be :).

Wouldn’t it be nice if you could make your “side project” (or hobby project as I call them) your day job?

That is what I’m working on… I’ll let you know how it goes.

I agree with the coding every day thing. I used to work weekends mainly because I let my day job take up 10-14 hours every day. So I worked on the weekends. I even took a whole week of PTO just so I could make “a ton of progress” on my project.

It turns out that I make more progress on a daily basis than I did taking PTO. Go figure – I think my mind needs to mull things over during the day. Faced with too much time I felt guilty like I was wasting my PTO and didn’t code as much.

My worst daily bad habit is doing “research” into my domain… a miss a lot of coding in the name of research. I need to stop looking at what others are doing (similar to my project) and just get on with what I’m working on!

Now I’m looking for a co-founder to help keep the project moving along. I think it helps when you have someone else to work with – but it needs to be someone who is onboard with your specific project/goals… not always easy to find.

Hello,
Reading your post was fun, especially since I recognize myself a lot in what you wrote.
Few months ago I worked on my side projects only the weekend, not making substantial progress, giving my girlfriend hard times when she planned something else, always ending up disappointed because I didn’t achieved everything that I had planned. Today I work every morning from 7 am to 9 am before going to my job and only 1 day by weekend, I feel that is a lot more efficient and more of all when I’m going to bed my mind is freer, and I can’t wait to wake up to work on my own stuff again!

I found this post extremely reassuring. Also struggling with motivation time to take on and maintain side projects. It does seem that you have hit on a method that works for you. I hope you are able to continue with this level of self discipline without it becoming a chore.

In an ideal world I would be working on the things that interest me within the working week only and dropping all computer based work evenings and weekends, but I suspect that if the code projects I was working on the day were self motivated or more interesting I would still be at my computer late at night…

I am always busy at weekends so its hard to get solid hours coding done so I have no choice in doing it throughout the week, but, whilst in my case it is compulsory if I want to learn I’ve always thought it the best way to do. Glad to know more experienced guys also see the benefit.

I am now 65 years old and have been working on an application I first started working on in 1978 before most of you guys were born. I am now in partnership with one of my oldest customers and work for his business about 45 hours a week, modifying and supporting my app for his company and also supporting our other clients.

I was immediately struck by how accurately you described the problem. I am currently attempting to rewrite the application (over 350,000 lines of code), moving it from VB6 to Visual Studio 2010 (VB of course). I tried previously with VS2002, and VS2005. But before I ever got finished, Microsoft would come out with a new version of Visual studio.

It is encouraging to know that other programmers/developers/ (it really is 98% coding) are going through the same thing.

My problems are having to exercise regularly due to heart problems from so many years of sitting on my chair and coding, and addiction to NCIS, BigBang, and Elementary, and a wife that I love dearly who wants to see me occasionally.

I intend to start trying your solution tonight. I will follow up in a few weeks and let you know. Great, great article/blog/info!

Great information :) But waht about a full time Mom like me ? What I do is I think about coding whle I’m washing dishes or watching TV with my kids or take tem to activities and also while we do grocery shopping :))

You are very inspiring, but how do you manage to write code every day? Don’t you ever find that you need to spend “coding time” on research or planning and thus not getting any code written?

Sometimes when I’m working on a side project, I find I have to solve a particularly hard problem. Instead of writing code, I wind up drawing diagrams, outlining possible approaches, or searching to see if/how others have solved similar problems. Other times, I find I have to get some library or framework that looks promising, setup a build environment, build it and test it. It can take up the whole hour I’ve set aside in the early morning for my side projects.

This is awesome! I don’t write code, and I still find it super inspiring as I’ve got several creative side projects/business going from my regular day jobs of mama and soon, software project manager (again). I also tend to save work for late at night when I’m exhausted or think I’ll get to it on the weekend, but it’s not like I EVER have a whole day to luxuriate in my side projects.

Thanks so much mate !
I am struggling right now, having hard time between my job and my side projects and this blog from you came up as oxygen for me.
Incredible way out!
I am going to plan around what you have shared.

While learning HTML and CSS from codecademy, this method you described worked because they counted streaks, so i had to complete an exercise everyday.
Not going too well with javascript probably because i’m using Offline Videos with no one counting my streak.

Thanks for this John – Beginners like me need all the motivation we can get and challenge.

I fucking love this article!!! I’ve had such a hard time with this over the past year or so, and finally started on a similar path. I’m definitely going to implement some of your ideas going forward. Also, I’d like to add a link to your post in a recent article I wrote around this topic (http://hacksnsnacks.com/hacks/theres-always-room-for-jell-o/). Thanks, and excellent illustrations!

You are crazy.
If you are in a relationship then you are doing yourself and your partner disservice.
When you are doing projects of any complexity then you need to slow down. From time to time you need to take a break to let your subconsciousness take stock and sort-out the overall picture. Only then you you can have a break-though idea. Working constantly at the grinding wheel will never get you there.
What about your paid job? Is your employer happy with the QUALITY of your work?
There was a time in my life when I would wake-up, OK I need to get-up. Just-a-second, what commands do we have to put the left foot on the ground?…
Never again!

I suffer from the same anxiety too – a side project (a somewhat popular WordPress plugin) has a never-ending stream of feature requests coming in.

But after watching my health deteriorate from too much sitting, it is just not worth it any more to me. Living longer and healthier and spending time with the people I care about is far more important than the side projects.

So, I’m learning to live with the angst of not being able to solve everyone’s problems and taking care of myself more. And I find each day I get those 10,000 or more steps on the FitBit, the less angst I feel.

Doggy,
I work at a company called CMN (http://cmn.com). And I do get a ton of code done on a daily basis.

We have a wide variety of projects so it’s actually easy to do a ton of work without feeling burnt out. We have prototypical style work, R&D stuff, development with cutting edge work, improvements to legacy system etc. etc. Plus, you always see the immediate effect of your code, not because of continuous deployments, but usually because of the magnitude of worth your code brings to the table. Anyways, at the end of the day, I may spend another 10-20 minutes working on my own stuff but my coder-self feels like I’m good for the day as it is since I get to do cutting-edge tech dev as well as legacy code dev.

Great blog post. I think your overall strategy of incremental progress is very effective, and one that I’ve started to follow as well. The one thing you highlight which I think is key is battling anxiety – by chipping away at projects you have less anxiety about getting “enough” work done.

This is a very good article. I can relate to the need and anxiety of developing good work habits. I am not sure of what your personal code writing is, but it is good to know I am not alone in the challenges and effects of bad work habits. Knowing that you have succeeded is a great incentive for believing in ones ability to develop and maintain productive habits too. Thanks for sharing your experience.

Since I have joined company, I feel like I am not getting time to work on my own projects due to lack of time. What max I could do is couple of hours per week, but its not at all sufficient. I’ll surely try to code everyday and make it live on GitHub.

It is like many other skills in life e.g. languages, playing an instrument, or making art. If you do it frequently you get in the zone a lot faster as well, not wasting any time to wrap your mind around the feature and overall project.

I’m truly happy for folks if they enjoy coding so much they want to do it for fun/as a hobby in their non day-job hours, but I think positioning one’s hobby (when it happens to coincide with one’s profession) as somehow obligatory if you care about improving/success (“if you don’t care about improving yourself then you’ll never actually succeed”) is wrong. Maybe that’s not what you intend, but I think that’s the message that comes across.

Many commenters on this post mention “anxiety” and worry about their supposed lack of commitment. I think that if you/they really care about and want to complete side projects, then your strategy is probably a good one, but I wouldn’t position it (and blog about it) to perpetuate the idea that being successful in programming means sacrificing your nights and weekends for side projects.

Folks, please, just enjoy your lives. If you are feeling anxiety about not spending your free time coding, STOP. Go grab a beer/wine/scotch/whatever and enjoy your life. This should be something you enjoy, not something you get anxious about.

“I should note that I’ve been finding that I have less time to spend on hobbies (such as woodblock printing) but that’s a reasonable tradeoff that I’ll need to live with.”

Great. For you, John. I’m really happy for you if you find this fulfilling. Personally, I’d rather spend my free time with my wife and kids, and smoking meats and brewing beers and reading philosophy. ;)

I agree that setting such goal can really boost your performance and reduce anxiety. But I would reduce this only to working days and have weekend for the family or just to have fun/relax – without even having to touch my computer.

I’ve taken this approach with my goal of being a better artist. I got into the habit of getting up early everyday before the rest of the house wakes up. This allowed me to get about 30~60 minutes of quality time into my sketchbooks.