Pair Programming, Abstractions, Flimsiness

This is a chain of topics into one post on things I’ve thought about the last week.

Pair Programming

I finally got a chance to pair up with a slippery creature at RC. Nevermind it wasn’t him - I was the slippery creature. It was because every time he asked to work on things together I had to do something else.

But before he left Recurse Center, I got to pair with him on a couple of leetcode problems. It was so interesting.

He blazed through all the problems for that day, and left me speechless. I definitely learned a lot from him, and it left me wonder how he was able to solve these problems so fast. What made him solve them quickly? It’s two things:

  1. Pattern recognition and intuition.

    My buddy seemed to just know what paradigm of thinking to use for these problems. I don’t know how you can train this but through experience.

  2. Flexible Thinking - Normally, when people keep track of an item in a grid, you keep track of one item. But he thought up of a way to keep track of multi-value items in one spot of a grid to solve the problem. I thought that was fascinating.

#2 then led me to think about…

Abstractions

My thought about this pairing session was - what can I learn from it? To expand, what can I learn from doing these toy puzzle computer science problems? And I think what’s important is to think one level above, at a higher abstraction on how the problems are solved. For example, with the above, you have to think about how you can’t assume that a spot in the grid has only one single type of value.

But can we take this principle one level up? Maybe.For example, that for a human being their state can’t be defined by a single word. You can’t define someone’s emotional state as happy. They can be happy and excited. Or happy and also sad (like graduating from college). So a function to get the emotional state of a person isn’t E(p) = 0.9 , where the numerical value indicates happiness.

It’s more like E(p) = [0.9, 0.6, ….] where God knows how many different types of emotion/states define how a person feels at a given point in time.

Another example that I encountered during a pairing session is how if you use a heap, you’re relaxing the constraint that you place on a sorted list that all items have to be in perfect order. The moment you drop that constraint, it leads you with a performance gain and other benefits. Of course, this comes with a certain set of detrimental effects. Similarly the bigger picture is that, dropping a requirement on a project or even a criteria for a recruiting candidate can leave you with so many new options, but dropping that requirement will led you to incur some other cost(i.e. increasing filter time for qualified candidates).

Last topic I thought about was…

Flimsiness

Yesterday I ended up going to the gym really late. But it was an enlightening experience. Before I left, I told my friend Pat that We’d get a dollar slice afterwards.

So I go to the gym and I try to be on the treadmill on my off days. What’s funny is that when I run, I always want to stop when I’m out of breath. Like my mind begs for me to drop the run.

But soon enough, 0.1 miles becomes 0.2 miles. And through the 2.2 mile run, my mind goes through a series of flimsy motivational states.

  • Let’s stop I’m tired.
  • Let’s keep going you’re half way there.
  • Let’s stop you’re close enough - you did better than yesterday.
  • Let’s keep going you only have 0.1 miles to finish it off.

It’s so weird. Anyhoo, I finish my run, and then…

I don’t want the dollar slice pizza anymore after my run. I get a sense of fullness?

So I go back to meet Pat, and since he’s waited for me to come back from the gym, we get that dollar slice.

I don’t want to go at this point, but we go anyway since he’s waited for me.

We go, and now I want 2 slices instead of one because the pizza smells delicious.

And then I eat half the slice of pizza, and now I don’t want that second slice…

Maybe I’m a flake, but damn. We just live in a world where things change constantly. Including our emotions. It’s like, one piece of information or a new way of sensing/observing something is only one step away from fundamentally destroying the state at another level.

It reminded of this Taoist story that my dad told me earlier: (https://medium.com/@davidgallan/who-knows-what-s-good-or-bad-my-tedx-talk-transcript-8404344779ce)

The idea that the world is in a constant flux of where good turns into bad and bad turns into good. To tie this back to my flimsy pizza story, I think the human mind(at least mine) is in a constant state of flux similarly to how the world is in a constant state of change.

But the big abstraction behind my gym pizza story? I’m not too sure. Maybe it’s: know how your mind works, and make decisions at the highest level and stick to it. Or leave multiple options open. If I decided that my life principle was to not get pizza slices after the gym, maybe I could have avoided getting a double whammy of two slices of pizza. Or if I told Pat that we might get a slice of pizza, maybe I would have flexibility to flake. It’s tricky, because sometimes you have to stick to your principles you’ve decided not to violate, but other times the correct answer is breaking your rule. But that’s life.