Nathan Herald

Designer, developer, husband, and nerd.

Read this first

My core values

  • Other’s needs and wants are more important than your own
  • Surprise and delight those you connect with
  • Thank people regularly for what they do
  • Take risks from time to time
  • Ambitiously pursue solutions for hard problems
  • Positively encourage other’s ideas and aspirations
  • Be content, but not complacent with how things are currently
  • Prioritize calmly, work aggressively
  • Gladly do the work other’s don’t want
  • Focus on details while considering a work holistically

View →

How we allow any request to be safely repeated at anytime for Wunderlist

Stripe recently introduced an Idempotent requests feature for their api calls to protect against duplicate charges caused by network failures. While building Wunderlist 3 we needed a similar mechanism for our remote clients to be able to be safely repeat any requests. Mobile networks, corporate firewalls, and general internet connectivity issues are problems way too often. One cannot be sure an operation has successfully arrived without receiving a full, parseable response.

We took a different route to protecting our data and I’d like to detail it for future reference. It could be useful for other’s to compare and contrast Stripe’s and Wunderlist’s methods for idempotent requests.

With stripe, one includes an Idempotency-Key header with every request. If a request comes in within the next 24 hours with the same header value then Stripe will return the original response. One could build...

Continue reading →

Make workflows for complicated tasks

I’ve been extracting a lot of controller code into simple POROs recently, but it’s become more and more difficult and repetitive to get things to work consistently. I end up doing a lot of if statements in the call method to manage failure states. An example might be:

 in a controller
def create
  @amount = params[:amount].to_i
  unless @amount > 100
    render :error and return

    @charge = Stripe::Charge.create({
        amount: @amount,
        card: params[:card_token]
  rescue Stripe::CardError => e
    render :error and return

  @charge_response = @charge.to_hash)
  @payment ={
    stripe_charge_response: charge_response,
    amount: charge.amount,
    currency: charge.currency

  rescue ActiveRecord::RecordInvalid => e
    render :error and

Continue reading →

Object Oriented System Architecture

Building large systems to process web requests, work jobs, and do other things can be daunting without a plan of attack or a system-of-thought. How many components to build, how to separate responsibilities, and when to build small or big are questions that come up over and over again. Having a framework to answer questions is a huge help and keeps things consistent, especially when working on a team.

The best way I’ve found to describe my system-of-thought for building large systems is object oriented system architecture. This means to loosely apply object oriented software design principles to the macro-level of a system’s architecture. Basically: micro-services. The term micro-service is pretty vague now-a-days, so I feel it’s important to be more specific.

Over the next few months I plan to take the time to describe different principles, scenarios, and ideas about how to build...

Continue reading →

Always use a CDN

Doing maintenance on a 6 year old project today that “didn’t have the budget” for a [CDN](( reminded me how important one can be. I’m writing this to remind myself to stick to my guns and always make time for the important things: one of which is using Cloudfront or Cloudflare every time.

Not every site needs to “scale” (whatever that means), but it’s a complete waste of resources to keep answering requests for the same files over and over again. If a project is hosted on heroku, then there is no web server in front of the application to intercept requests for files. The application has to answer and handle the same requests over and over again. Even if an app is behind a reverse proxy like apache or nginx, the proxy is still answering and streaming files when it doesn’t need to.

Don’t under estimate just how easy and useful it is...

Continue reading →

Why make a Mash?

Hashie is fine

Recently, Richard Schneeman wrote a very good article titled Hashie Considered Harmful - An Ode to Hash and OpenStruct. Give it a read, there is some wisdom there. However, I have a bit of a different take on this issue. I’ve also had this as a draft in Svbtle for way too long.

First, let’s get this straight: if OpenStruct is useful then Hashie::Mash is useful too. And OpenStruct is really useful. Also, don’t let anyone tell you “you don’t need a hash-like object that responds to methods” because you very well might need it. Always contrast your goals and the implementation of a library to make sure it’s as simple as it could be.

Second, don’t take advice about what to use from people who can’t explain the pain or joy around it. It’s like someone who says to use postgres instead of mysql, but has no clear reason to prefer anything. What is the real pain here? What is...

Continue reading →