An Internship Worth Dyeing For

Emily Tomz
strava-engineering
Published in
7 min readAug 25, 2021

When I started interviewing for an internship at Strava I made a plan to dye my armpits orange if I got an offer. And no, not just any orange — Strava orange. I drove to the nearest CVS and bought a Kit Kat bar (my usual) and a can of hair dye. Unfortunately, CVS wasn’t cool enough to have Strava orange, but I thought, “this will do.” In the end, I never did it. As it turns out, I also wasn’t cool enough.

The one thing that was very much cool enough? My internship at Strava.

Activities Team happy hour (left to right: Megan, me, Youssef, Emma, Merty)

Buzz Buzz

Most of my introductions started with “Hi, my name is Emily. I go to Pomona College and should be a senior but I’m actually a junior.” For many reasons, I took the past year off school. I worked as a mobile engineer for a startup and a babysitter for a seven-year-old named Bea (pronounced BEE). My project title? BEES. As Edna Mode says in the movie The Incredibles, “Coincidence? I think not!”

This summer I worked on the Activities Team as a server-side software engineering intern with the particular task of completing BEES, the Best Ever Efforts Service. This service has two main components:

  1. Storage and access system for bestEfforts
  2. Storage, access, and maintenance system for bestEverEfforts

The first component addresses the bestEfforts class. For each running or biking activity that an athlete uploads, Strava stores an aggregation of stream data that represents the best subset of one or more streams. Examples of bestEfforts could be the fastest 5k within a run, or the biggest climb within a bike ride. These are nothing new! For years Strava has been calculating athletes’ bestEfforts through Active, Strava’s legacy Ruby on Rails codebase. However, this system is getting old and only supports bestEfforts for running and cycling (1 mile, 5k, 10k, biggest climb, etc.). BEES, however, is written in Scala and is designed to support any future best effort types athletes might want, such as your best power hour for biking or best lap time for swimming.

The second component addresses a new class: bestEverEfforts. These represent an athlete’s historic bestEfforts, or their PRs over time. Before this implementation Strava only showed an athlete’s current bestEverEffort for each type in their profile. This new service allows athletes to view all PRs they’ve ever had, which is a helpful tool for understanding their progress. The Activities Team began working on BEES last year, so it was my job to finish up the service and complete the bestEverEffort (BEE) component.

The implementation of Best Ever Efforts has been in the top 10 athlete feature requests for the past 5 years, so it’s an incredible honor that I could work on something so many athletes will love.

The Process

My first few tasks revolved around learning how to create the BEE table from scratch using SQL and Slick. Then, using Slick and Scala, I began to write queries to access athletes’ BEEs. These queries accept parameters such as athleteId, visibility, bestEffortType, or time range, which will allow us to show athletes their bestEverEfforts in ways that are most meaningful to them.

I then continued onto the meat of the project and created a method that takes bestEfforts and transforms them into BEEs. Consider the chart below. Let’s say I just joined Strava and ran a 5k every day this week. In order to calculate my BEEs, the method compares each bestEffort one by one in date order. Monday is my first 5k PR, so it’s a BEE. Tuesday’s 25 min 5k is faster than 30, so it’s my new PR and therefore a BEE. 28 and 29, however, are both slower than 25, so those aren’t BEEs. Lastly, 23 is faster than 25, so it’s a BEE.

So that’s it, right? Well, not quite. What if there are changes in the bestEffort table? It would be inefficient to recalculate an athlete’s entire BEE history every time the bestEffort table changes, so I wrote a method that, instead of calculating BEE history, maintains BEE history. This method handles three scenarios:

  1. A new bestEffort is upserted
  2. An old activity and its bestEfforts are deleted
  3. An old activity and its bestEfforts are invalidated

Using the same 5k example, let’s say that Tuesday’s 25 min 5k gets deleted. We need to consider two main questions:

  1. Do any current BEEs need to be removed from the BEE table?
  2. Do any new bestEfforts need to be added to the BEE table?

First, 25 is not a bestEffort so it shouldn’t exist in the BEE table. Delete. Second, we need to do a little recalculation to determine which bestEfforts need to be added. Wednesday’s 28 min 5k is faster than Monday’s 30, so it’s a BEE. 29 is slower than 28, so it’s not a BEE. 23 is faster than the previous 5k PR, 28, so it stays in the BEE table.

One interesting nuance I had to take into consideration when constructing this method was visibility. Athletes can choose to make their activities visible to the public, visible to only their followers, or visible to only themselves. Hence, their bestEverEfforts must mirror those selections. Continuing from the previous example, if my Wednesday 28 min 5k is private, then I see my BEEs as 30, 28, 23. However, everyone else sees my BEEs as 30, 29, 23, since they don’t have visibility access to Wednesday’s activity.

Future Uses

As I progressed through the summer, I couldn’t help but dream about when this service would actually be implemented into Strava’s app and in the hands of athletes. With three weeks left I held a brainstorming session with my team to think about what exactly BEES could do. I was absolutely blown away by the countless ideas the team produced. Here are some of the coolest ones:

  1. Graph of PR history for specific effort types and time ranges
  2. Track progress for a variety of new best effort types
  3. Create challenges for athletes to beat a specific PR
  4. Use machine learning to track other trends in life (sleep, meals, etc.) that associate with hitting PRs

Jams

Unfortunately, while there exists a Jams week, there does not exist a Peanut Butter week at Strava. Thinking about it now… maybe creating that week should be my jams project. Anyway, Jams is one of the coolest weeks at Strava. Everyone sets aside their current work and “jams” on a new project with people from various teams. Well, everyone except for me that is. Very willingly, I continued to work on BEES with my manager, Merty, my mentor, Megan, and a few other Activities Team members. Simply, we all just wanted to see this feature rolled out to every single Strava athlete! The BEES feature we decided to create was a series of graphs depicting an athlete’s BEEs for various bestEffort types, found in the profile’s Progress tab. To celebrate you know for sure I’ll be having a pb&jam sandwich.

Cool Humans

While most of my summer work revolved around BEES, the very best moments revolved around people. One of my summer goals was to talk with someone from every team at Strava. Every single 1:1 “coffee chat” (although there was literally never coffee involved) was the most incredible experience. I learned about everything from machine learning, business, and the Metro team to people’s dogs, children, and hobbies. I left every conversation feeling inspired.

Intern trivia lunch (left to right: Dylan, Andrea, me, Maura)

Beyond 1:1s, every Wednesday at lunch all the interns would hop on a Zoom call and complete the weekly Water Cooler Trivia. I once hopped on a crafting meeting full of people crocheting. I painted a scene of SF with the rest of the interns. Heck, I even asked Michael Horvath (Strava founder and CEO) what his hobbies are!

In a remote internship, some of the most memorable moments were the ones that could luckily be in person. I hung out with some interns in the Bay Area, I worked from the SF office a few times, and I went on a Strava Women’s Bike Ride through Golden Gate Park. Moreso, the day before I returned to school my team held a post-work happy hour and internship celebration for me. I can’t even begin to explain how meaningful all these moments were and how absolutely included I felt every minute of these past 11 weeks.

Strava Women’s Ride in SF (left to right: me, Merty, Claire, Adiel)

Reflections

When applying for this internship almost a year ago, I read countless blog posts about interns’ experiences working at Strava. Two in particular, written by wonderful humans I was lucky enough to actually meet this summer (Noa and Julia), revolved around the aspect of a team. The foundation of Strava’s entire culture is based on this idea of team. Every single person at the company is on your team and has your back, no matter their role, status, or expertise. As a collegiate soccer player, my teammates always keep me grounded but inspired, confident but ambitious. Strava was no different. In particular, my manager Merty and mentor Megan helped me a tremendous amount, but they also inspired me to be as hard working and passionate as they are. They put such confidence in me but also always supported me in my search to learn and do more (even though that resulted in me writing the majority of this blog post over the last three days of my internship).

Initially I wanted to dye my armpits Strava orange to celebrate getting an internship offer. But now, with a successful and wonderful internship behind me, there’s definitely more to celebrate. And, consequently, two armpits that still need dyeing.

--

--