Routes Editing is the Real MVP

Erin Beachkofski
strava-engineering
Published in
7 min readSep 16, 2020

The Stars Aligned

Tired, feet sore, and throat hoarse from nothing but networking the previous few days, I happened to glance up and see a booth plastered in athletic graphics. I was at the Grace Hopper Conference in Orlando, Florida, and I didn’t realize it at the moment, but I was looking at the Strava booth. I consider exercising a hobby of mine, so I walked up to a recruiter and started chatting with them. Fast forward a couple days, and I was submitting my application to Strava for an Android Engineer Intern position. Come November 2019, I received my offer, and I was beyond enthusiastic. It seemed too good to be true — living in San Francisco working for a start-up.

Turns out it was too good to be true, because as I’m sure you are aware, we were in the midst of a global pandemic, and the internship was shifted from an in-person internship to a virtual internship. It was only a tiny less “good” than I was expecting though, and that’s only because I was really looking forward to spending the summer in San Francisco, the WOW’s, and all of the in-person events Strava has. All that aside, I have to give major kudos to everyone at Strava who put in the time and effort into transitioning the internship to a virtual internship!! It pains me to think about everything I would have missed out on had the internship program been canceled.

How good can a virtual internship even be?

If you’re at Strava, it’ll be awesome. I was a little worried that a virtual internship would not provide the challenges, opportunities, and connections that an in-person internship would be able to offer; however, Strava’s Engineering Internship Program blew any expectations I had — even for the in-person internship — out of the water. Albeit being a virtual experience, Strava was the most organized company I’ve interned for as well as the only company I’ve felt who truly gives their interns meaningful, impactful projects to work on. Literally, on Day Three of the internship, my mentor said there was a bug that I could fix if I was up for it, and to that, I responded, “Let’s squash this bug.”

It took me a long time and lots of help to figure out this one-liner bug. I’ll blame it on the fact that I was overwhelmed by the size of the codebase and the fact that they were letting ME, an intern, work on the ACTUAL codebase and do something that would be shipped out to MILLIONS of users.

MVP? Most Valuable Player? Minimum Viable Product?

My manager, Zack, and I decided that my main project would be to work on Route Editing on Mobile as well as owning the remainder of the project. Specifically, we would be working on editing the ephemeral routes. Prior to this internship, I had only worked with basic Android layouts. How I would go about editing points on a map was beyond me.

I came into this internship with a very limited understanding of how MVP Architecture worked, and I really struggled to understand its implementation the first couple of days. MVP stands for Model, View, Presenter, and this is a design pattern intended to make testing easier and enforces the Single Responsibility principle. After a couple days of ripping my hair out, my mentor, Jeremy, drew me a diagram explaining how all the pieces fit together. Jeremy definitely deserves an award or something after that because I’m sure I tested his patience and explanation skills like they’ve never been tested before. It finally clicked for me, and I was able to see the whole picture — and now I’m going to be explaining it to you! The diagram below explains how MVP is implemented in Routes Editing, mainly concentrating on how the ViewDelegate and Presenter work together.

Here, we have two main pieces of MVP, the ViewDelegate, RoutesEditViewDelegate, and the Presenter, RoutesEditPresenter. The ViewDelegate listens for interactions on the user interface, and when it observes an interaction, it sends an Event to the Presenter. On the other hand the Presenter waits to receive an event, generates new data based on the new event and pushes it back to the ViewDelegate as a State. The ViewDelegate then uses this new state to change the information displayed on the UI. The states and events, specifically the RoutesEditViewStates and RoutesEditViewEvents, deal with the Route object, the underlying structure for all of the domain data. The difference between states and events is that a state is derived from the Route object to display the appropriate information on the UI while an event object notifies the presenter which in turn performs changes on the Route object. This Route object is the Model of the Routes Editing MVP architecture, but as I mentioned earlier, we’re mainly focusing on the ViewDelegate and Presenter.

To make this concept a little more concrete, let’s break this diagram down with an example. Say the user selects a waypoint, a point along the polyline. The user interacted with the interface, so the ViewDelegate notices this and responds to this interaction by pushing an event, specifically the OnWaypointSelected event, to the Presenter. This triggers presenter.OnEvent() inside the Presenter. Which RoutesViewEvent is passed into the Presenter depends on the type of user interaction. After the Presenter does its thing (manipulates the data in response to the specific user interaction), it pushes the new state, WaypointState. When we select a waypoint, we know that the expected behavior is to change the waypoint from the default circle style to the selected circle style, so the Presenter assigns these “selected” properties to the newly selected waypoint. After the Presenter pushes WaypointState, inside the ViewDelegate, viewDelegate.render() is triggered and renders the new RoutesEditViewState. The ViewDelegate now shows a selected circle where there used to be a default circle, and it waits for the next user interaction. We find ourselves back inside the ViewDelegate, and there we have it! This cycle represents the relationship between the ViewDelegate and the Presenter.

Challenges

There were many parts of this project that tested my grit. As I mentioned before, learning how to implement MVP was one of the greatest challenges I faced. In addition, since I was contributing code dealing with the MVP design pattern, I had to also make test cases for my code. Creating test cases was challenging for me as well. I learned the flow of developing unit tests, from creating mock objects to assertions. When test cases failed, I had to determine whether it was my code or the tests that were incorrectly written. Peer coding, time when my mentor and I would hop on Zoom and work through code together, proved to be a critical factor in my development throughout my internship. Coming into this internship, I was slightly worried that it might be harder to learn and get assistance over Zoom, but it hardly posed an obstacle.

Fun Stuff!

I joined the #women-in-tech Slack channel, and each month, we all gathered on Zoom for a fun activity. In June, we did a “Sleepy Sheep” Guided Meditation with a lady, her daughter, and all of their sheep in Scotland. I never imagined watching a lady pet her sheep could be so soothing.

Then, in July, we did chocolate tasting through Dandelion Chocolates. Unfortunately, I realized I’ve been wasting my money on “fancy” chocolates my entire life because I’ve been eating them incorrectly. Now I know how to look for the sweet strawberry wine and mushroom undertones in chocolates. Can’t wait to be a chocolate snob when I eat my next fancy chocolate bar.

Lastly, although I never met any of them in person, I’ll miss all of the other interns! (Sorry Trey, I think you were at an appointment when I took this screenshot.) It was truly a unique experience doing a remote internship, but we were all experiencing it together.

Chigozie, or Hype Man C, entertaining all of us.

Acknowledgements

Special thanks to my mentor, Jeremy Payne, for teaching me almost everything I learned during this internship, my manager, Zack Issacs, for his honest life advice and good convos, and the rest of the Guide Team and the Android Guild for all their time, help, and support to make sure I had a fulfilling internship! Also, many thanks to everyone who made the virtual internship program possible and for all their time and effort to make sure there would be a Strava Intern Class of 2020!

--

--