don't worry, it's probably fine

Notes from the Week #37

23 Mar 2020

weeknotes

That was not a week.

Committing to writing each week fell down the priority list in order to make room for everything else, including my own mental well-being.

Now that I’ve settled into the “new normal” - I know it’s not normal, at all, but it is helpful as a coping mechanism - I hope to bring these back more regularly.

Encouraging myself to post more using IFTTT and Monzo

Writing blog posts feels like a bit of an “event” at the moment. It’s analogous to releasing software once every few months - much more ceremony, a bit riskier (I forget stuff!).

Inspired by tweets I saw last month, I decided to use If-This-Then-That in combination with Monzo to reward myself every time I publish a new blog post.

At the moment, I’ll get a nice round £3 each time I make a blog post, which is enough for a coffee or some sweet treat.

Credit to IFTTT and Monzo for making it nearly trivial to connect these things together.

Improving the user experience of our API

We’ve finished building the feature set necessary to enforce quotas on our API. We need this because each participant in the DCS pilot will have an allocated number of total requests.

The team decided to expose these numbers to clients in the form of response headers. There’s a well established pattern of providing X-RateLimit-* for rate-limit information, so our first thought was to implement something like X-Quota-Remaining.

That was before we had a good read of RFC 6648, or Deprecating the “X-“ Prefix and Similar Constructs in Application Protocols.

In short, although in theory the “X-“ convention was a good way to avoid collisions (and attendant interoperability problems) between standardized parameters and unstandardized parameters, in practice the benefits have been outweighed by the costs associated with the leakage of unstandardized parameters into the standards space.

This changed our minds about how we name our public headers going forward. We expose DCS-Quota-Limit and DCS-Quota-Remaining for quota information, and all future public headers will be namespaced as DCS-* unless there’s a significant precedent to do otherwise.

Traffic simulations to test our new features

Given that we want confidence in how these features will behave in the wild, we have written some Gatling scenarios designed to stress-test the interaction between new rate-limiting capabilities and quotas.

These have already started delivering value for us - the first simulations exposed some minor issues related to how some graphs on our internal dashboards are constructed which we fixed.

It’s been interesting revisiting Scala after having a horrible experience with it the first time around - at my old job, we used the Play framework to build something that didn’t need a user interface and that negatively coloured my thoughts on it for a long time. Nothing to do with Scala itself per-se, more that in hindsight Play was likely not a good fit for the requirements.

Long-story short - Scala is fine, but if I had to choose a non-Java JVM language it would probably be Kotlin. I quite like Kotlin.

Speeding up code by removing dependencies

My library to calculate candidate list publishing dates, sopn-publish-date, had depended on pandas for date arithmetic. This was a huge dependency to pull in for such a small requirement (establishing number of days between two dates).

I opted to implement a minimal set of functionality to remove the need for pandas in the library.

It turns out this made the code significantly faster as it had a narrower remit - doing one thing, but doing it well. I also love the simple act of breaking down the set of requirements into commit-sized incremental improvements.

Ooooh yeah, that’s the stuff.👌🏻

Grilled cheese sandwiches are amazing

I made perhaps the best grilled-cheese sandwich of my life last week. I posted pictures in my old team’s group chat and was asked what I did to get it in the state that it was. Publishing it here because why not? (Your mileage may vary, of course)

  1. Spread the outward-facing sides of bread with mayo, not butter. The tiny bits of egg give it a really crisp and crunchy surface.
  2. Assemble in a cold pan, then turn on the heat - this will melt the cheese gradually rather than risking the bread burning or the cheese not melting.
  3. I “compressed” a bit of the grated cheese as I was assembling it in the pan, so I could get it closer to the edge and fit more cheese in without it all falling out.
  4. Use more cheese than you think you’ll need, because the air gaps in the grated cheese will shrink and melt down.
  5. Low and slow - on a low-medium heat, I did it on a 5/9 on our electric hob, should take about 6-7 minutes per side.
  6. Cover the pan - the steam from the cooking will melt the cheese faster.

Ker-ching, delicious cheesy ooey-gooey goodness.

Miscellany

  • I’m currently reading The Bi-Ble, a Kickstarter-funded book containing a selection of essays and personal narratives about bisexuality. Massive shout-out to Monstrous Regiment Publishing for being really helpful when I thought my package had gotten lost in the mail. It hadn’t disappeared, it just wasn’t logged by our post-room.
  • I’ve been cooking a lot more as a result of not being able to eat out as much, and dare I say enjoying it? I think I had avoided cooking a lot because I was worried that I was terrible at it. I almost certainly was (and probably still am) but you don’t get better unless you do it more.
  • Next Friday will be my one (1) year anniversary of both being at GDS and being a civil servant. There’s a much bigger post coming about this, I think. I’m pretty darn happy with where I am.