An (Unscientific) Study in Behavior Change With Software

Forming habits is hard. There’s been tons of research on what practices help form new habits successfully. And there has been research on what software can do to help form new habits. It’s not enough to simply send daily reminders or keep track of the goals in a visible place. For software to help us form new habits successfully, we must look to the current research for clues as to how habits are formed.

Over the past year or so, I’ve been trying to adopt a habit to take Vitamin D every morning. I’ve been largely successful, which I think is partly due to the software I used. I use Lift on my iPhone, which sends me emails every morning as a reminder. The app itself has checkins for each habit, progress charts, and social features. Most mornings, I wake up, swipe away the reminder email, and take my morning antihistamine and a Vitamin D. [1] Like I said, I’ve been mostly successful, and at this point, I’ve taken Vitamin D every day in a row for 442 days in a row. [2] Granted, taking a vitamin every morning is only a small change, but it is one that I wanted to accomplish and did. Small successes add up to bigger successes, and this gives me confidence that if I set out to make a bigger change in my life, I have a toolset that will help me to accomplish that goal.

So what does the research say helps us form successful habits? The Fogg Method [3] is one of the more well-known systems, and suggests that a way to be successful is to:

  1. Select the right target behavior.
  2. Make the target behavior easy to do.
  3. Ensure a trigger will prompt the behavior.

So what do each of these steps tell us?

The Right Target Behavior

It’s hard to be successful in picking up a habit that you don’t already want to accomplish. Some things you may already want to do include things like learning a language, eating a specific diet, or flossing your teeth. It goes without saying that things you’d rather not do are going to be harder to implement.

But there’s another factor in play here that I think determines the right target behavior: simplicity. That is, is the habit a simple task to accomplish, or is it something complex and unmanageable? Can you perform one simple task per day and call it “done”, or is it more complicated as to whether it is “done” or not each day? The simple “done” state seems really important, and so it is good to focus on using this technique for binary actions: either you did them today, or you didn’t. Things that must be done with complicated schedules, every other day, or once a week, will be much harder to establish as habits.

Easy to do

One reason we want a simple target behavior is so that it is easy for us to add to our schedule. You may have a goal of exercising more. But “exercising more” doesn’t have a binary action associated with it; for example: what is “more”? Instead, you might say, “I want to exercise 45 minutes per day.” And that would be a much better goal. But if exercising means you have to drive to the gym, and the gym is out of your way each day, it might be very unlikely that you will do it. This is not a simple target behavior.

If you do have some goal that may not be simple to implement at first — say, the example of having to drive out of your way to the gym — instead try to find a simpler version of the habit that you can adopt first. You may decide instead to just do some bodyweight exercises before you leave for work each morning. Decide on the exercises and write them down. Either you did them or you didn’t. Later on, you can modify this existing habit to be more exercise, but for now, focus on what you can reasonably adopt as a simple habit.

The other concern in implementing an “easy” habit is how much time the new habit will take. In the above example, the initial goal was something like 45 minutes per day. Eventually, you could probably find when you exercise best and are least likely to schedule appointments (say, early morning or late at night), and actually implement that goal. But early on, it’s going to be hard to change your schedule for your new habit. I ran into this frequently while trying to find time after 5PM but before dinner to practice guitar. It didn’t help that after-work and dinnertime are frequently scheduled as social events, and that I have a habit of staying at the office past 5; all these added up to very little success in trying to spend 45 minutes to an hour practicing guitar at home after work.


The last step is quite important. Where you might think of triggers as things like alerts on your phone or daily emails from a service like Lift, I didn’t find those kinds of prompts very effective in helping me adopt a habit.

To be more likely to perform some task on any given day, look at the habits you already have. I’ve been taking an antihistamine every morning since I was about 12; this has been a constant in my life and part of my routine for a very long time. Since I already have this daily habit, I added taking Vitamin D every morning to that habit. Other habits with no daily routine to hinge off of, like practicing guitar, were much harder to make stick.

Flossing is an easy addition to brushing your teeth every night, and just took enough of me making it simpler (finding a brand of flossers I liked rather than wrangling loose floss) and doing it enough times before it stuck, too.

What didn’t work for me?

As noted above, despite a couple attempts to really make daily guitar practice stick, I’ve never been able to tackle that habit. There were no good triggers that I could add the event on to, and I frequently didn’t have time for what I was trying to accomplish. If I were to go back to trying to focus on guitar, I’d probably start with much less time commitment, and schedule it some time when I’m very likely to be home and have 5-10 minutes, like early in the morning before work. Whether or not guitar practice is effective with my first cup of coffee would have to be tested, of course.

What I’ve found is that I’m partially motivated by progress bars and graphs, though, and so I will make time in my day for easy-to-accomplish things. So when I can, I will try to squeeze in some mundane activity I’m tracking in Lift, like washing the dishes. [4]

The social component of Lift, on the other hand, doesn’t really help me any. For others, it might be a good motivator. In cycling, I have several local friends, including one local cyclist who is quite prolific and who frequently rides 10x as much as I do in a given week. We all use Strava to track our cycling, and the social component alerts me to new rides that the prolific cyclist has done. Seeing that cyclist’s rides helps remind me to get out and enjoy more cycling, as well as sets up a nice carrot-on-a-stick for me to ride more to “catch up.” In that case, the social features definitely help me to perform an action more, but I wouldn’t really call cycling a habit as much as my transportation and leisure-time hobby that I can do whenever I have time.

Habits with no simple binary action and no triggers, such as creative acts, are especially hard to form as habits. I have tracked writing blog posts in Lift for some time, but since I only write blog posts when the mood strikes me, it is hardly a daily goal, and it would be difficult for me to implement the above steps to form an actual habit of blogging on a daily basis.

Final thoughts

Notice that most of the guidelines above have very little to do with software? Software itself can’t convince you to go to the gym or make you more likely to floss. But it can provide some prompts and some encouragement, and that might be enough to get you over the hurdle of adopting a new habit.

As with anything, you are an individual and your mileage may vary. Experiment, use an app like Lift or something else you prefer to track your progress, and see where it takes you.

There’s more resources out there to help understand forming new habits, self-control, and behavior change, but I feel like this is the baseline one needs to know to be more successful in implementing behavior change. Some references of note that I have been consuming:

  1. Designing for Behavior Change. Stephen Wendel. 2013.
  2. The Sugary Secret of Self-Control. New York Times. September 2, 2011.
  3. The Healthy Programmer. Joe Kutner. 2013.

If you’re interested in some research, the above book (Designing for Behavior Change) is a good reference, as well as these papers:

  1. ReflectOns : mental prostheses for self-reflection (hardware and software solutions)
  2. Behavior Wizard: A Method for Matching Target Behaviors with Solutions

1 Yes, I’m aware of the fact that taking vitamins with an antihistamine decreases the effectiveness of the antihistamine. I’ll cover why I take them at the same time in this post.

2 You can view my progress on Lift on my public profile. Notice there’s quite a few habits I’ve tried to form with Lift in the past that didn’t quite work.

3 As described by BJ Fogg in the preface to Designing for Behavior Change.

4 We don’t have a dishwasher in our current apartment, and I both dislike dirty dishes and dislike washing dishes by hand.


In the Year 2100

Recently I was asked by a coworker to write up some ideas for where our company would be in the future. Not just next year, or in 5 years, but where we saw the company in the year 2100. For my other coworkers, the year 2100 probably represents far enough out to ensure they stop thinking in the constraints of right now. But for someone who has read as much science fiction as I have, I saw a wide gulf of time.

So I hit up Wolfram Alpha, asking myself what technology might look like in the year 2100.

If Moore’s Law holds, then processors could contain 3.5 x 1022 transistors — roughly 350 times more transistors than the number of grains of sands on the planet. (Thanks, Wolfram Alpha!) This also represents roughly 2.9x1018 MIPS per chip, which is roughly a factor of ten more processing power in each chip than all 7 billion brains of humans on the planet, combined. That kind of computing power is almost unimaginable to me now.

While I don’t have a religious belief in the Singularity, I do think that we can’t really predict what it’ll mean to have so much computing power available to us. Or what technology, society, or people will look like by then. Of course, someone’s gotta write the software to make that hardware useful…

Note: It could be that I messed up these numbers a bit; I went off the current transistor count and MIPS for the Intel i7-4770k processor, since I recently started putting together a server with one. And the numbers are extrapolated out quite a bit. If you’ve got corrections to these numbers, hit me up on Twitter to let me know!


Indent and Colorize HTML Strings in Pry

(This post is part of my blog archiving project. This post appeared on Coderwall on November 14, 2013.)

Note: I have converted the inline code to Gists for better readabililty.

An issue I run into frequently while testing with tools like capybara by dropping into pry is that the last response for a page is a single string, containing the HTML that was rendered. But those string have lost indentation and generally make it really hard to see the content of the page, or whatever you care about.

For example, a simple login page might look like:

Wouldn’t it be great if Pry could re-indent and colorize that string of HTML for you? Well, I put together a quick little Pry command that does. Throw this into your ~/.pryrc:

Originally, I had tried to use the html5 fork of the tidy command: but that tool changes the HTML as it parses it, and spits out a bunch of warnings. So instead, I have this pry command use nokogiri when it is available. The command should warn you if you try to use it without nokogiri available. What is output should be very close to the original rendered HTML, just cleaned up and re-indented.

So what does it look like in action?

(imagine that pry has colorized this output, too, through the excellent CodeRay tool.)

I’d love to hear from you if you find this useful! Or even if you don’t find it useful, but have some suggestions to improve it. Thanks!


Apprentice Talk Video & Notes

Back in September, I had a blast speaking at Nickel City Ruby. My talk was entitled “Apprenticeship: Software Craftsmanship’s Missing Link” and included a lot of slides of sasquatches. The video has been posted to Confreaks, so I’m embedding it here. Also note that I have posted my notes and a few resources over on the microsite I created for this talk,


Git Fml

(This post is part of my blog archiving project. This post appeared on Coderwall on September 3, 2013.)

For when you need to go back to a clean slate and declare FML, add this to your ~/.gitconfig:

  fml = !"git fetch && git reset --hard origin/master"
Blog Archives