I Gave a Presentation About Redux to Indy.js

After completing a project at work that used the Redux state container, I gave a presentation to the local JavaScript meetup group about my understanding of Redux and showing how it works in the app that we built.

Link to the slides.

Link to a video of the presentation.

Overall, I’d say that Redux was a useful tool and we’d like to use it on new projects going forward. I think there are some good patterns there that we didn’t fully realize the benefit of because the app is so simple (basically a form wizard signup application.) Obviously I said more in the presentation, so if you are interested in hearing more of my thoughts the subject, check out the video of the presentation above.

Turning Down the Volume on Social Media

I am generally a fan of creating small challenges for myself. Sometimes they are to grow in a specific area, sometimes they are just to see if I can do something for a prolonged period of time. Some of the challenges I have done in the past few years:

The Social Media Challenge

Last year, I realized that I was spending more time than I wanted to on Twitter, Facebook, and the like. These sites would often link to posts that I would also read, and ended up being a huge time sink.

Certainly there is value in finding new articles that I wouldn’t have normally read, but on the whole the time was not very well spent. How many of the random articles that I read had something of substance or that I could later recite even a single noteworthy fact from? I found myself trapped in a self-inflicted filter bubble / echo chamber.

The Origins

Miles tweeted this post:

I figured this was a good of a time as any, and emailed him with a slightly formalized challenge. It was partially based on the fitness challenge experience and some previous attempts to do something like this:

If you want, I’d be up for a $10 April Social Media ban contest.

Parameters: You get one ten minute block per week for essentials (facebook event checking for social events, twitter responses that are important.) Ten minutes is use it or lose it, ending Sunday at midnight local time. If you check Facebook, Twitter, Reddit, HN, Google News(?) for more than ten minutes total during the week, you lose the bet for the month.

If we both lose or neither lose, nothing exchanged. Square cash any difference. :)

Your call if you want to do this or not, just let me know. We can recruit others if you want.

Anthony “/etc/hosts willpower” Panozzo

(Spirit of the game / honor clause / Rescuetime for whether you succeeded during the week or not.)

Miles was interested, and we clarified various parameters of the challenge over email as time progressed. Mostly which sites were in play or not, and so forth. But overall the point was to limit these as much as possible.

Challenge design considerations

One of the things that I thought was useful with this experiment was having a small time budget for social media. I think cutting it out entirely would be a little too extreme, since I often post things (via asocial media) and have responses or I want to check Facebook events for directions.

The fitness challenge had the concept of a “skip day” once per week for the daily exercises. I think when creating habits that if you give yourself a flexible cheat period that it really helps with overall compliance. Allowing you to pick when to use it also helps. Do I want to skip this day, or save it for the future when I might be feeling even worse or have no time?

While I think the financial incentive was useful, I think that having a $10 bet per week would have been better. If you lose one of the weeks early, you had no incentive to continue doing the challenge. So that is something I would probably try to change if I did it again. We ended up making it ten minutes average over the weeks instead of ten minutes each week to compensate for this design issue.

The early days

We both noted that we had a habit to semi-consciously navigate to distracting things when we got stuck or found our minds wandering.

Miles: “I have found that, when I find my mind wandering, my fingers will CMD+Tab and type reddi-Tab Enter. Thankfully I have that redirected to localhost for now.”

Me: “I am in the exact same boat w/ being in the browser, getting stumped, and then command-t and start typing . It is just a muscle memory / deep brain habit. That is one of the reasons I like vacations, you lose some of these habits. I think that might be a portion of the productivity I get after vacation.”

I’d say the first few days were the hardest, after that the muscle memory seems to fade.

No foolin’

One advantage was that we started the challenge in April, so we missed most of the April Fools jokes that consume a lot of time.

RescueTime recaps

Miles suggested using RescueTime screenshots as an accountability measure, and I thought this was useful. We sent each other these at the end of each week. Here is my summary from the month before we did the challenge:

RescueTime March 2015

Not terrible, but not great either. Then for the month that we did the challenge:

RescueTime April 2015

Fantastic! The next month I was very productive again, although in that month I suffered a back injury that affected my sleeping and sent me into a pretty negative spiral. :( But overall I feel that doing this challenge was useful.

I felt like the urgency of checking various websites was greatly reduced. It was like turning down the volume.

Paying up

I went a bit over some of my guidelines, and I think Miles hit all of his. So I sent him $10. I consider it money well spent considering how much more work I was able to get done.

When’s the next one?

If we did something like this, would you be interested? Email me at (this domain minus the com)@gmail.com and if we do it again I will notify you. Or just comment on this post!

Commuting Probably Costs More Than You Think

My wife and I currently live on the northeast side of Indianapolis and work near downtown Indianapolis. We have been discussing whether we would like to move, and if so, where. For the past year or so, these talks really haven’t had much energy. We’d decide to look into moving, and then not really do anything about it. Currently we’re in a month-to-month rental with some nice landlords. However, it’s pretty far from where we work.

Last weekend I decided to quantify the costs of commuting. I figured this would give us something to work with and if it was surprising, would motivate us to take action. In typical fashion, I made a spreadsheet.

The spreadsheet shows what we are currently paying per month in total housing costs (rent, utilities) and commuting expenses. By extension, it also shows what we should be rationally willing to spend per month in total housing costs (based on our current costs of housing and work transportation.) For example, if every month of commuting costs us $300 and we are spending $1000 in rent each month, spending $1300 on a place with zero commute would be theoretically equivalent.

Here is the commuting breakdown spreadsheet that I came up with.

What surprised me

Overall, I was surprised by the amount that we should be willing to pay. I expected it to be high, but not 50% more than we are currently paying. Part of the surprise was probably due to the fact that two people’s commutes would be lowered.

After doing this analysis, I would definitely question any commute to see how it could be reduced. All things being equal, we would prefer to pay less than more, but this figure gives a nice bounds considering we think our current rent is acceptable.

General breakdown

I thought that there would generally be two quantities to figure out. First, what is the mileage that we would save by commuting less? Second, what is the time that we would save by commuting less?

Valuing mileage

Mileage covers fuel costs and vehicle maintenance. I calculated this by taking the average of the 2016 IRS standard mileage rates for business expenses (54 cents) and the lowest cost per mile that seemed reasonable (17 cents). Since both of our ten-year-old cars are paid off, have decent gas mileage (around 30 MPG) and have routine maintenance done to them, I figured this seemed reasonable.

Then I took what Google Maps says as the miles one way to our places of work from home. I took the very best case (not adding on detours.) From there:

  • multiplying by two to get round-trip miles per day
  • multiplying by how many days per week we go into work
  • multiplying by how many weeks we work each year

We have roughly $5100 in car and fuel costs per year as a result solely of our commutes.

How do you value your time?

The other factor that I thought was relevant was how much time we were spending in the car. If you drive an hour each day, how much is that costing you in terms of other things that you could be doing like leisure, working, or learning?

Calculating the time spent was fairly straightforward. I took what Google Maps said was the time during the evening and said that it was the one-way time trip. This was the most optimistic I could be, since generally traffic at other times is worse. Increases of 25%-50% can happen during rush hour, and who knows, you might get stuck in traffic for days. But still, best case I am spending the equivalent of about four working weeks in the car just driving to and from work!

Appropriately valuing our time was the most difficult part of this exercise. Initially I put $20 for value of time since I thought that was conservative. I figured if I could spend $20 to save an hour of driving in a potentially dangerous, potentially stressful environment, that would be worth it to me. I would without hesitation pay someone $20 to mow the lawn, even if I could do it myself and listen to educational material at the same time. So I figured that was in the right ballpark.

Monica felt that figure was too high. She wanted to put $0, because (paraphrasing):

Since you are working at a salaried job, it is unlikely that you would be earning more as a result of having that extra time. You can’t just spend that money on rent since it is not really coming from anywhere (just opportunity cost.)

I could see the rationale of this argument, but I wanted some way of capturing the fact that living much closer to work would be a significant quality of life difference. Basically, I wanted to take time and money and compress them both into money for analysis purposes. We ended up compromising by choosing $5, although I could see $10 being even better. I figured that some of the time I was listening to podcasts or the radio otherwise making good use of the time. There is definitely value in being free from needing to be in the car.

I found an interesting site for exploring valuing your time, although it was kind of hard to reason through. You can tell it was made by academic people with questions about things like how much would someone need to pay you for an hour of “neutral” work (work you neither like nor dislike.) It was hard to think of things that I neither liked nor disliked. I ended up getting a super-high number for how I valued my time, which might have been unreasonable. However, I really liked a lot of the things that they tried to capture.

Anyway, even with the low value of time ($5 / hour), we should rationally be willing to spend up to $1700 more per year just to live closer to work.1

Takeaways

First, move closer to where you commonly go. If it’s not possible to change your work, change lodging. If it’s not possible to change lodging, change where you work or work remotely. When you add up the costs over years or decades (with interest!), they certainly add up.

Second, we are lucky that we can consider moving and that we have careers that are in demand and flexible enough to consider remote work.

Last, valuing time is hard. We often pay people to do things for us, but it’s hard to know when it is worth it. I think establishing a decent value for your time is something worth doing. It lets you stop doing things that aren’t worth doing, lets you delegate things that are, and lets you focus more on your core economic values.

If anyone has good ways of valuing their time (or is willing to give a number with justification), I would love to hear it. I think that I have generally underdelegated in the past and it is something that I would like to get better at.2

If you liked this post and want more math applications to financial things, I wrote a post about how I saved $1400 by using a prepaid phone plan. This was before unlocked / no contract plans were in vogue, but some of the concepts still apply (especially when thinking about breaking a contract with a price to break it.)


  1. I did take into account that we would not be right next to work, since our offices are some distance apart from each other. I figured that I could walk or bike to work since my office is closer to nicer areas. So I didn’t take that mileage at all. However, I calculate Monica’s new cost as the cost of my work to her work, since the housing should be somewhere in the middle. 

  2. It certainly seems like having a good value / justification for what you would be doing with the time saved would help. If I outsource something and spend the time writing, working, socializing, or other high value activities, then outsourcing something is probably worth it. If I spend it looking at cat pictures online, probably should have just done it myself. Likewise, a factor is how much you want to do the work. But maybe this is a digression that should be split into its own post. 

Refactoring Rails Routes

Today I want to share a quick Ruby on Rails tip that I have used in the past and just used again in a recently inherited codebase.

The general problem under consideration is when you have route specifications where you want to change the syntax, but you didn’t want to change how the application works. I had done this in the past when upgrading a Rails app from version 2 to version 3, and yesterday I wanted to make some route changes to reduce deprecation warnings at the beginning of test runs.

In this case, I was getting some deprecation warnings about the syntax of the route. For example:

DEPRECATION WARNING: Defining a route where `to` is a controller without an action is deprecated. ...

So I wanted to fix the underlying issue but leave the routes otherwise unchanged.

General approach

To make sure that I do route refactorings correctly, I first write out the output of rake routes to a file before making any changes. Then, when I make changes, I can write out the result of rake routes to another file and then diff the two. If I just want to see if they changed, diff -q <file1> <file2> is sufficient. If I want to see the specific changes, doing a normal diff or unified diff is helpful to see what changed. For the deprecation warnings, this was enough to ensure that I made the changes correctly.

For the Rails 3 conversion, I ended up doing this very slowly and committing whenever I had a valid change. I would change the name of each output file to match the git commit that it was generated at to help keep track of the changes. There were some changes that were inconsequential but would affect the diff result, so it was easier to check them only once and then have them filtered out of subsequent diffs.

To make that point a bit clearer:

A -> B - 1 change (manually verified)
B -> C - 1 change (manually verified)
C -> D - 1 change (manually verified)

If I diffed D against A, I would have to reverify (or be distracted by) the previous changes that B and C introduced. By diffing against the last known good copy (C -> D), I can save effort.

Why not just run the tests?

We can’t rely solely on the test suite to catch regressions because most apps do not exhaustively test their routes. If yours does, consider yourself the lucky exception! I think there is some merit in punting on testing routes. It seems like a low return on investment–at least until you are trying to upgrade major versions and need to overhaul the syntax. For the most part the routing syntax has probably stabilized, so there might be more value in doing it now. Still, I feel like testing DSL logic is hard to justify since they are already so readable, and in this case we have a good way to expand them (rake routes).

However, you might as well run the test suite just in case it picks something up. You might choose to run the subset of it that might contain things that test the routes. Routing tests, controller tests, and end-to-end tests are tests that generally hit the routes.

How to Actually Publish More Things

I recently published a post to my blog newsletter for the first time in a year, and mentioned a writing group that I had started. One of my readers asked for more details about it. So in this post I’ll talk about how our small writing group of around ten people helps keep each other accountable and encourages each other to write more.

The beginning

In August 2015, I decided to write more and more regularly. My writing backlog had increased quite a bit but I was not paring it down much. I had some recent experiences with a weekly fitness challenge and a weekly social media challenge (details to come), so figured something like a weekly writing challenge would work well. Those challenges showed that social accountability helps me stay focused on a goal. Also, setting up a system where I need to do something each week is flexible enough that I can make progress but it is not too onerous to achieve.

I didn’t just want to write, though. I wanted to have the writing be accessible to others. So I figured something like a weekly minimum to publish would be good.

I didn’t really want to have a financial component like the other two challenges. I wanted to see if the motivation of writing for the group would be enough to get people to write. Plus, I didn’t want to have to deal with the hassle of moving money around or setting up a system that was correctly motivational.

I sent a message to a few people who I know who write a decent amount or want to be writing more, and we correspond via a small private Google group. The current group composition is mostly software / product / marketing people with varying levels of experience.

The process

The general process for the group is:

  1. publish something at least once a week
  2. make a short post per week on the thread of the week of the things you published
  3. (optional) respond to others’ posts with minor feedback, encouragement, personal stories, etc.

The goal is to make the process of participating in the group as small of a time commitment as possible, leaving most of the time for actual writing. To encourage people to write more, publishing can be anywhere, any time. It can be across multiple blogs / platforms / books / podcasts, etc. Any topic is fine. The key is just to keep writing and making public what you are writing.

Course-corrections

Things went pretty smoothly from the beginning.

Since the group was self-organizing, we had a little trouble figuring out how to split up the email threads. A thread per week is helpful for remembering to post once per week. Amitai suggested that we use the Unix week as the boundary. Conveniently, Sunday night at midnight begins a new week. The week is fairly easy to figure out1.

Some people got hung up a bit on feeling bad or guilty that they were not writing as much as they “should”. Some wanted to catch up when they missed a week by posting twice the following week. Generally we recommend to just post once a week, and if you miss a week, to let it go. Otherwise it can be easy to fall into a downward motivational spiral (“haven’t published anything in three weeks, need to post three things or I’m a failure.”) The point is never to feel bad or complain, only to get writing out there, of whatever quality level or length the member determines is acceptable.

The results (so far)

I feel that as a group we have published quite a bit, and I have personally published at least ten times as much as I would have without the group.

Usually I have a lot of things that I know well enough that I can knock them out without too much work, but actually having a deadline helps me put in the time to write them out. There’s also the positive spiral of doing something every week.

I think the group dynamic is great, with people contributing feedback of the high level points and not getting hung up on small formatting points. Every week I read great posts that I otherwise might not have seen. The publishing has covered podcasts, books, works of fiction, technical blog posts, book reviews, role-playing writeups, heartfelt honesty, training material that is hosted on Github, and even some highly voted Hacker News comments.

One additional thing I like about the weekly publishing deadline is that it forces me to make definite progress each week. For example, I can’t say “I’m working on my book” for six months without writing anything up. I need to think about how to incrementally publish my work, publish bits and pieces or the artifacts of it, or write up other ideas.

Create your own groups

Trying to do something and want more chances to succeed? Consider forming a group with like-minded people that has some sort of daily or weekly requirement. Some of the members of the group are thinking about starting other groups with similar philosophies around product development, and it will be interesting to see how it plays out.

You can even form your own writing group. I would be happy to hear about it!

Does a writing group like this seem appealing? Would you like to join? Can you commit to writing something each week? Send me an email (domain name minus the .com at gmail.com) with what you are generally interested in writing about, and we can try to add you to the group!


  1. If someone is the first to post for the week, they make a new thread with the week of the year. You can do this with date "+%V" if you are on a Linux-like machine. If you have Ruby installed, ruby -e "require 'date'; puts DateTime.now.strftime('%V')" also works.