Vue.js Computed Property Gotcha

I spent a few hours today trying to track down why a change password form I created wasn’t working. Ultimately, it turned out to be a surprising behavior from the way Vue.js (v2.6.14) computed properties are refreshed.

First, let’s have a quick reminder about how computed properties work. Each computed property runs some code and returns a result as the current value of that property. Vue will cache the value, and automatically re-compute it only when some data it depends upon changes. Normally, this works perfectly, and is completely transparent to the end user. Somehow, Vue just knows which other properties it depends upon.

So, on to my problematic example where it doesn’t just know. Let’s start with a simplified version of the component’s code:

01: computed: {
02:     canSubmit: function() {
03:         result = this.password && this.passwordConfirm;
04:         console.log(`canSubmit() -> #{result}`);
05:         return result;
06:     }
07: }
08: 
09: data: function() {
10:     return {
11:         password: undefined,
12:         passwordConfirm: undefined
13:     }
14: }

Seems pretty straight-forward, no? Well, it doesn’t work.

I have an event handler (not shown) which changes this.password and this.passwordConfirm each time the user types in an input element. For each letter the user types in the “password” box, you see the console statement. However, no matter what the user types into the “confirm” box, the console statement never appears.

The problem, it turns out, was on line 3:

    result = this.password && this.passwordConfirm;

Since this appears inside a computed property, behind the scenes Vue.js is trying to work out what other properties are being used so that it can figure out when this property will need to be refreshed. You would expect it would have have something like this in its dependency graph:

    canSubmit -> password, passwordConfirm

Except, it doesn’t. For some reason, when both this.password and this.passwordConfirm appear on the same line, Vue.js fails to recognize the dependency on this.passwordConfirm, and produces only this dependency graph:

    canSubmit -> password

Therefore, you see the console statements only when this.password changes, and not when this.passwordConfirm changes.

The fix is pretty easy. Just change canSubmit to this:

canSubmit: function() {
    p = this.password
    c = this.passwordConfirm
    return p && c
}

Having the references to this.password and this.passwordConfirm on separate lines appears to do the trick, and causes Vue.js to produce the expected dependency graph.


Why is this happening? To be honest, I don’t know. Here are a few theories…

The method Vue.js uses to detect dependencies:

  1. doesn’t work with multiple properties on the same line
  2. gets confused by the similarity of the two names
  3. get confused by the logical operators

To be honest, I have a hard time accepting that any of these are true, but they’re the only plausible explanations I can come up with. If anyone has a better theory, please leave it in the comments below!

Gamifying Empathy

My son was diagnosed with “high-functioning autism” when he was a toddler. For the purposes of this post, I want to focus on one specific aspect of what that means: a lack of empathy. Mostly though, I want to share a system we have invented to help him with it.

First, let me explain a bit about what “lack of empathy” actually means in his case. In simple terms, it doesn’t naturally cross his mind to try to figure out how what he says and does will affect other people. If he is specifically thinking about it, then yes, he can figure it out, and plan how to behave accordingly. So, in a classroom, for example, where he knows there are specific social rules, he mostly does fine (unless he gets distracted). Same thing when we have company over for dinner. Since he is never required to join us, it’s always a conscious choice for him to engage with our guests, and he generally does well.

However, when he’s not thinking about it, how his words and actions affect others simply doesn’t cross his mind. So, blowing his nose without a tissue continues, despite many outraged protests from us. Same with washing hands after using the bathroom. Likewise, handling our dog roughly continues, despite countless reminders. On and on. And, when we remind him, we get nothing but dismissive sass. Even more frustrating, this has all amplified as he’s reached his teenage years. He has even been able to clearly articulate that he simply doesn’t care that these things (and many others) bother us.

What to do?

Clearly, one could take a punitive route. Heap punishments upon punishments until he’s fearful enough of incurring more that he obeys. My wife and I both find this approach repulsive and sad. We could just ignore it. But, the world at large simply won’t tolerate this kind of behavior, so we’d be doing him a massive disservice by allowing him to not learn this lesson while the consequences are so mild. Not to mention, neither of us could bear to live that way. We needed another way.

The problem is that our feelings don’t register in his value system, and—even more than that—he’s very bad at judging how something will affect us, even if he’s inclined to try. So, our system needs to take a long-term value which is currently outside his ability to project, and map it into a value hierarchy that he does understand right now.

The Goodwill Game

My son is crazy for games. Chess, board games, card games, you name it. He even invents his own. And, he’s a master at almost all of them almost immediately. So, we cooked up a game which helps him “win” at getting along with other people (my wife and I, in this case).

As parents, we need to ensure he learns how to treat people in his environment well. However, he often lacks the insight into how his behavior affects other people, which makes it hard for him to know how well he is doing. This game is intended to provide direct feedback—in a quantifiable way—of how his actions affect the emotional well-being of people around him: both positive and negative. As this is an abstract skill which doesn’t map well to his current values, the points accumulated will be periodically converted into things he does currently value, to help him better relate in terms which are more immediately understandable.

Points Awarded Scale

To set up the game, we started by creating a Points Awarded Scale. All of us sat down together and came up with positive & negative things to put on the scale, and agreed upon the number of points gained & lost for each.

While the points may seem arbitrary: they really aren’t. They quantify how a particular behavior makes us feel in a way that he can understand. So, mildly annoying things (e.g., stomping around the house) have a small negative value, while awesome things (e.g., volunteering to clear up dog vomit) have a large positive value. Apologizing immediately and sincerely (something which is very hard for him) neutralizes any negative points: because they neutralize the bad feelings for us. So the whole points system allows him to better understand how his actions affect us.

As an aside, it was immensely enlightening for him to just make the scale! He was often surprised that we actually cared so much about various items on there, and it frequently provoked extended conversations about why that was the case.

Here’s a small sample of our current scale:

positive negative
1 — humorous banter -1 — reminder to complete chore
2 — saying thank you -2 — isolated rude comment
2 — responding to text message -2 — ignoring a text message
3 — chore completed on time -3 — snarky response to reminders
5 — asking for on a task when needed -5 — dismissive/rude response to feedback
8 — independent follow-through on feedback -8 — performing a chore badly after a reminder
10 — volunteering to help -10 — performing a request in a snotty manner
-20 — attempting to cheat this system

Point Redemption Scale

While the first scale does a great job of helping him understand how he’s affecting us, it still doesn’t bring our feelings into his value hierarchy. So, we added the Point Redemption Scale so that he can “cash in”: thus bringing how he affects us back into a realm that relates to values he currently holds.

The scale has two parts: benefits and punishments. If he accumulates enough points, he can redeem them for things he likes on the benefits side of the scale (e.g., pizza for lunch). If he winds up in negative points, then we choose a punishment from the other side of the scale (e.g., no internet for 24 hours).

As with the first scale, we all sat down together and decided how many points all the various benefits and punishments were worth, and everyone started out in agreement about everything on both sides. However, this scale is the opposite of the first scale in that the first was a subjective measure of our preferences, while this one is a subjective measure of his preferences. All the benefits are things he likes, scaled to his level of preference. Likewise, all the punishments are things that he dislikes, again on his own subjective scale of preference.

This is how the mapping finally occurs. Our subjective preferences are mapped to points on a scale which is public and knowable to him. His preferences are mapped into a scale which is calibrated with ours. So, now he can see a direct correlation between his value hierarchy and our own.

Here’s a sample of our current redemption scale:

benefits punishments
25 — 1 pt gelato 20 — 24h without internet
50 — pizza for lunch 50 — 24h without computer & iPad
75 — $10 extra allowance 75 — 24h restricted to his room
100 — extra family TV episode 100 — 2h extra chores
200 — 1.5h of 3-player board games 200 — 24h restricted to guest room

Running the Game

In order to actually run the game, we adopted the following rules:

  • points gained & lost are awarded in real time (as much as possible) by referencing the Points Awarded Scale
  • points are recorded on a chart which is accessible to the entire family
  • once per day, we all get together and make sure to capture all the points for that day while our memory is still fresh (in case anything is missed)
  • once per week, we tally up all the points gained and lost
  • if there are positive points, then our son can redeem them for items listed in the benefits side of the Point Redemption Scale. He may also bank points for specific items which are “too expensive”
  • if there are negative points, then we select items from the punishments side of the scale
  • points reset to zero each week

How is it working?

We used something very similar to this when our son was much younger (around 10 or so), and we’ve just started in again at around 17. It worked very well when he was little, and it seems to be working even better now. By having a short list of things to be mindful about, it doesn’t seem to be so daunting and nebulous about how to get along with us well. As I mentioned before, he’s also super keen on games, so making this into a game he can win is compelling. I think that—even more than cashing in the points—is what makes this work for him.

I think the real benefit, though, has come from the conversations we had to set things up. We clearly understand one another a lot better now, and we’re able to refer back to the various scales when talking about things. Moreover, when some new behavior comes up which is good or bad, we have a quantifiable scale to relate it to (even if it’s not actually part of the game). That makes conversations about how his actions affect us go SO MUCH more smoothly.

The End Game

Obviously, this is a tool to get past a brief hump we’re having as a family. We used it for a while when he was little because we were having a similar kind of problem. Eventually, he picked up better habits, and we let the game fall by the wayside. When we started having the same problems again recently, I suggested we dust this off, and give it a try again. I fully expect that we’ll use it for a little while until he internalizes some better habits, and we’ll again set it aside.

Except… do you ever really set it aside? While we, as adults, don’t actually tally points and what-not, we certainly do have a sense of “fairness” or getting “value for value” with our spouses, co-workers, and friends. When a relationship feels “unfair”, or like one person is doing all the work, we feel discontented and allow those relationships to wither. In extreme cases, we actually cut them off. Perhaps a topic for another post!

The Quest for the Perfect Beatles Playlist

I needed a break from working the other day, so I decided to make a comprehensive Beatles playlist… all of their songs, in the order which best reflects the evolution of their work over time. It’s harder than it sounds.

The easy part is the full-length albums… but there’s still a little complexity there with “Let It Be” and “Abbey Road”. The former was recoded in Jan 1969, but not released until 1970. The latter was recorded in August 1969, and released later that same year. So… if you go by release date, then “Let It Be” is the last album, but if you go by recording date, then “Abbey Road” is. But, there’s a deeper story.

“Let It Be” was recorded under extremely trying circumstances. They were filming the process for a concept movie, which meant that instead of working in their cozy studio, they were on a film set. It was cold, drafty, and noisy. There were people all around all the time. They knew they were being filmed all the time. Plus, they were all starting to feel pretty worn out on The Beatles as a whole. So, they bickered their way through the entire production. Personally, I think you can feel it in the music.

“Abbey Road” was different. There’s a few stories about it, but the common thread is that it was understood that it was going to be “the one last album”. As such, you can tell that they guys pulled everything they had together to make one final statement. Everyone contributed a song or two (even Ringo, which is pretty unusual), and they are univerally held to be among their very best songs. Plus, the album captures the full breadth of their work from the pop songs of their start, to the orchestral overtones of their middle years, to the wild disonence and heavily distorted guitars of their later years. It feels like “the last album”, and the perfect summary of their work.

So. Recording order it is. But… what about everything else? Many of their best songs didn’t make it onto one of the canonical full-length albums!

Fortunately, long after The Beatles had broken up (and, indeed, long after John died), a collection called “The Past Masters” was released in 1988. This collection was specifically created to collect together all those songs which were released on singles and EPs. Now… where do they go?

One might be tempted to slot them in between the albums by their release dates, but this creates a lot of problems. To start, most of these songs were released multiple times in different formats and in different countries. Many of them, too, were released long after they were recorded. For example, “Across the Universe” was recorded roughly in the same time-frame as “The Beatles (The White Album)”, but wasn’t released until 1970… after “Let It Be”! So, sticking with the recording date comes to the rescue, and solves both problems.

Finally, there’s a few loose ends to tie up. First, “The Past Masters” does include a few songs which did actually make it onto a studio album (alhough almost always a slightly different recording). I decided to remove these in preference of those which appeared on an album. And, second, I just don’t need to listen to “Revolution 9” on a routine basis. So, that makes my final, complete, and “perfect” playlist:

songLove Me Do1962-10-05
albumPlease Please Me1963-02-20
songFrom Me to You1963-04-11
songThank You Girl1963-04-11
songShe Loves You1963-08-23
songI’ll Get You1963-08-23
albumWith the Beatles1963-10-23
songI Want to Hold Your Hand1963-11-29
songThis Boy1963-11-29
songKomm, Gib Mer Deine Hand1964-02-04
songSie Liebt Dich1964-02-04
songLong Tall Sally1964-03-01
songI Call Your Name1964-03-01
songSlow Down1964-06-01
songMatchbox1964-06-01
albumA Hard Day’s Night1964-06-02
songShe’s a Woman1964-10-08
songI Feel Fine1964-10-18
albumBeatles for Sale1964-10-26
songYes It Is1965-02-16
songRain1965-04-16
songBad Boy1965-05-10
songI’m Down1965-06-14
albumHelp!1965-06-17
songDay Tripper1965-10-16
songWe Can Work it Out1965-10-29
albumRubber Soul1965-11-11
songPaperback Writer1966-04-14
albumRevolver1966-06-21
albumSgt. Pepper’s Lonely Hearts Club Band1967-04-21
albumMagical Mystery Tour1967-11-07
songLady Madonna1968-02-06
songThe Inner Light1968-02-08
songAcross the Universe1968-02-08
songRevolution1968-07-13
songHey Jude1968-08-26
albumThe White Album1968-10-14
albumYellow Submarine1968-10-23
songDon’t Let Me Down1969-01-28
albumLet It Be1969-01-31
songThe Ballad of John and Yoko1969-04-14
songOld Brown Shoe1969-04-18
songYou Know My Name1969-04-30
albumAbbey Road1969-08-20

Milton Friedman—Is Capitalism Humane?

My personal politics may best be defined as “pro-freedom”. In some ways that makes me sympathetic to positions espoused (though seldom actually practiced) by both of the major political parties in the US. It makes me much more sympathetic to several of the “third” parties of US politics: most especially the Libertarian party (though not without reservations).

However, I’m much more interested in economics than politics (although the two are inextricably intertwined). And, in that realm, my leanings are entirely towards laissez-faire capitalism. To clarify, this is the form of capitalism in which the government only takes on the role of preventing force or fraud and adjudicating disagreements. No bail-outs, no subsidies, no charity, no public works. Regulations are only in service of preventing fraud and force. Also, there are no favors, no bribes, and very little corruption as there are no hand-outs to be obtained or clubs to he wielded against competitors. Needless to say, the form the US economy has taken since before WWI has only had a passing resemblance to this economic system, even though many people still refer to it as “capitalism.”

Milton Friedman (1912–2006) won the Nobel Prize for economics in 1976, and was perhaps the most famous defender of laissez-faire capitalism in the 20th century. In the talk I’ve linked to here, he defends capitalism on moral grounds by tackling the question: “Is capitalism humane?”.

If you feel as I do about capitalism, I encourage you to listen to this talk. In it, you will witness an excellent and entertaining speaker explaining points you may have heard before, but in an excellently clear and persuasive fashion.

If you do not feel as I do about capitalism, I encourage you to listen to this talk all the more. Not because I think you’ll be persuaded by 45 minutes of listening to Milton Friedman, but because I suspect what you and I think of when we hear the word “capitalism” are miles apart. And when you hear me promote and defend capitalism, and, perhaps, are inclined to persuade me otherwise, it would be great if we started out on the same page. Listening to this talk will bring us a lot closer to that point.

We’re our own journalists now

A friend just posted this article from NPR which describes a new racial outrage where a White woman called the police on a Black man for birdwatching. There’s even a video the man shot documenting the encounter. And, the woman does, indeed, seem pretty unhinged while the man seems very cool and rational. Except, that’s not actually what happened.

Someone else posted an article from the National Review which does some deeper digging. As this second article indicates, the video only shows part of the encounter. You can actually see the original post on Facebook. The description gives a little more information on what happened before the video starts. In particular, the man asks that the woman put her dog back on its leash, and she resists several suggestions of how she could exercise her dog off-leash elsewhere. At which point, the man says (quoted from his Facebook post): “Look, if you’re going to do what you want, I’m going to do what I want, but you’re not going to like it.” At this point, he attempts to offer the dog a treat, the woman becomes alarmed, and the man starts filming.

Judging from this information (as reported by the man, and therefore likely to be biased somewhat in his favor), I think they both handled the situation badly. It’s understandable that the man was annoyed. The woman was clearly violating the rules for that area of the park, and it inhibited his ability to enjoy it by scaring away the birds he came to watch. It’s also understandable that the woman was alarmed. She encountered a stranger in a secluded part of the park who said he was going to do something she wouldn’t like in retaliation for her annoying him.

On the other hand… he could have just walked away. I can’t count the times I’ve been in a big city, saw someone doing something they obviously weren’t supposed to, and did exactly that. He chose to confront the woman when it wasn’t necessary. When she resisted, he upped the ante in a way which was intended to frighten the woman into compliance, and then the situation blew up. And, for her part, the woman clearly knew she was violating the rules, and could have chosen to simply appologize and clip the leash back on her dog (even if only until the stranger had moved along). Moreover, the man was still calm, and keeping his distance, and so was clearly not an imminent threat. Both of them had opportunities to de-escalate the situation, and neither of them made that choice.

Is the woman racist? Maybe, but I don’t think this one incident provides enough data to actually be sure. I expect what the man said and did would have been enough to frighten me, no matter what he looked like. If she has some subconscious association between black men and crime, then she would have been all the more frightened. However, I don’t find it unreasonable that she would have been frighted enough to call the police even without any extra factor from subconscious racism. So, I don’t think we can make any real judgement from the little data this incident provides.

This, of course, calls into question the justice of everything else the woman experienced after this incident became public. However, it’s clear that her employer didn’t want to take the risk of becoming entangled in the situation—no matter what truth was behind it—and cut their losses as soon as it became publicly embarassing. Maybe the woman actually is racist, and this was a good call. Maybe not. As I said, I, personally, don’t think this one incident is enough to go on. To my mind, that makes her company’s actions at least somewhat cowardly, if not blatently unjust.

✧✧✧

I view the original incident as a misunderstanding between two people who wanted to “win” the encounter. When neither was willing to back down, the whole incident blew up.

The real tragedy is what happened later, and I think it demonstrates the value of “classical” journalism as an intermediary between ourselves the messy fragments of truth actually available. However, it’s been a long while since we learned about the world only through the eyes of mature, responsible journalists who knew how to spell “objective.” They’re still out there—to be sure—but they are now largely buried by the flood of social media and clickbait stories designed to stir us up.

This means we’re largely on our own to become such journalists as we used to have as our intellectual first line of defense. We have to take responsibility for turning the messy fragments of reality which find their way onto our screens into a cohesive, objective whole before reacting. I’m certainly guilty of falling short here (all too often, I’m afraid). So, I’m personally taking this as a reminder to check whether I’m falling into the trap of provocative so-called journalism, whether I think I actually am working with all the facts before coming to a judgement of my own.

Muhammed Ali asks: Why is everything white?

click to watch the video

He tells the story as though its a funny anecdote, and everyone’s laughing, but you can still see how earnestly he wants you to hear him and really consider: why is everything white?

Thinking on this and similar subjects has made me make small changes in my own writing. For example, as I was previously thinking a lot about sexism, I started to write about “humans” or “people” instead of “men” when I want to talk about everyone in general, and to use “they” as a singular pronoun when the subject’s gender isn’t known. It’s an easy change for me to make, and demands nothing of my readers. And, it breaks the needless ambiguity that “men” can be used both to mean a group of males as well as a group of people in general.

I suspect, having listened to this, I’ll find more things to subtly alter: not to be more PC (which I generally despise), but to be more clear with my actual desired meaning.

Access Denied! (or how S3 permissions can be super confusing)

I’m currently working on a feature for runbooks.app which allows users to upload images for their runbooks. I’m using the Python boto3 library to make a PutObject API requests. Simply provide the bytes, the target bucket, and object key, and you should be all set. However, to my considerable frustration, I spent most of the morning trying to figure out why I was getting this error:

botocore.exceptions.ClientError:
An error occurred (AccessDenied)
when calling the PutObject operation:
Access Denied

Not super helpful, as there are, of course, a whole host of things which could be wrong.

Access Keys

I wanted my bucket to only be available to a specific IAM user I set up for my application code. This user should only be given permissions for the specific API operations I want my code to perform: and nothing else. When you set up the user, you’re given an Access Key and a Secret Access Key. The former is a jumble of letter which identifies the account, and the latter is a shared secret so AWS can be sure the request comes from a trusted source.

I’m using Heroku, so I went to my application’s settings page to verify that my Config Vars contained the correct values. They did. So, that wasn’t the problem.

User Policy

Each new user you create in IAM has a section which specifically lists what things that user is permitted to do. There are many ways to assign permissions. You can create a separate policy and associate it with that user directly. You could make such a policy, associate it with a group, and then add the user to the group. You could assign the policy to a role, and then have that user don that role temporarily to do its work. You can even create an inline policy which is merely attached directly to that one user.

It turns out, you don’t need any of that if the user is specifically called out in the access policy for the object being accessed. So, in the end, I could simply remove all policies, groups, and roles from the application’s user so long as the S3 bucket call it out specifically.

Bucket Policy

Each S3 bucket can have its own security policy which specifically lists what each user (group, role, etc.) is permitted to do. As I before, I wanted to limit this user’s access to just those functions I knew my code was going to try to perform. So, I created a bucket policy which looked like this:

{
    "Version": "2012-10-17",
    "Id": "policy-123",
    "Statement": [
        {
            "Sid": "statement-id-123
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::<user-id>:<user-name>"
            },
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::<bucket-name>/*"
        }
    ]
}

I knew I was only ever calling the PutObject API, so I didn’t want to grant any more permissions than that. However, no matter what I did, I kept getting the error message at the top of this post stating that I didn’t have permissions to do exactly the action listed!

After much fiddling about and reading of StackOverflow, I found the solution. I needed to grant more permissions!

{
    "Version": "2012-10-17",
    "Id": "policy-123",
    "Statement": [
        {
            "Sid": "statement-id-123
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::<user-id>:<user-name>"
            },
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl",
                "s3:PutObjectTagging"
            ]
            "Resource": "arn:aws:s3:::<bucket-name>/*"
        }
    ]
}

Even though I was only calling PutObject myself, the implementation of that API endpoint was both trying to set up the Access Control List (ACL) for the newly uploaded object, and, since I included some tags in my PutObject request, it was trying to set those as well. It was failing at both because I hadn’t set up those permissions.

The thing which threw me off the scent was the error message. It was merely saying that it couldn’t perform the PutObject API request because some permission was lacking. If it had clearly stated which permission was actually lacking, I would have been past this whole thing in a second. Instead, I erroneously assumed that the “PutObject” part of the message was referring to what I need to know in order to solve the problem (i.e., the name of the missing permission), not what I already knew (i.e., the name of API endpoint)! Since they have the same exact name, I thought telling me that it was lacking the one permission it actually did have!

So, a few lessons learned:

  • User policies aren’t actually needed if the user is specifically mentioned in the bucket policy.
  • If you get an access-denied message from AWS, the error will only mention the API which it couldn’t perform, not the actual permission it is lacking.
  • API calls may require several permissions beyond simply the one which shares the name of the API call. Some of these are conditional, depending upon which additional parameters you provide in your call.
  • AWS continues to have the most byzantine APIs and documentation in the business.

Giving an excellent technical interview

There are several things I do in my technical interviews which I think make the experience quite a bit better than your average interview.

The first step comes before the actual interview in selecting the technical question. I have a few which I’ve created myself based upon actual problems I faced as a professional developer. They are, of course, somewhat simplified to be able to fit into an interview time slot, but they have the ring of a “real” problem rather than some annoying “toy” problem. Each question is intended to have multiple “extra features” you can add to it, so every candidate is able to complete at least part of it, and exceptional candidates can complete several. Only once have I had a candidate who completed all of the sections I had prepared.

Second, as the interview starts, I deliberately adopt a fairly casual, friendly, outgoing attitude, and chit chat. If possible, I try to crack jokes, and put the candidate at ease. I try to get them to tell me stories about something which will give me a sense of whether they’d be a good culture fit with the company and our team.

Then, as I introduce the technical question, I make a few points right up front to try to take some of the anxiety out of it:

  1. This is a pair-programming exercise, and the primary point is to see how well we like working together.
  2. I’m not particularly interested in seeing how much of the language you’ve memorized; if you’re uncertain on something, just ask, and we’ll look it up, if necessary.
  3. I’m not as much interested in how quickly you solve the problem, but how you approach the problem, and how you think it through.

At this point, I turn my laptop around for them, and either project the screen or slide my chair around so I can see what they’re doing. On the laptop is a basic IDE already set up with a “hello world” program and a simple test case. There’s also a browser with Google brought up.

I think this is the most important part.

I want to make the impossibly contrived interview situation as close to actual working conditions as humanly possible. Starting with a simplified, but realistic problem, continuing with real tools (i.e., IDE and Google), and ending with us looking at the same screen, side-by-side, I’ve tried to emulate, as closely as possible, a situation developers find themselves all the time: pairing up to write a piece of code.

As we start to work on the problem, I try to strike a balance between being a helpful part of the pair programming team, and leaving enough of the problem for the candidate to solve that I can evaluate their performance. The more junior the candidate, the more helpful I am. The more senior, the less. If a candidate seems to be stuck at any point, I’ll suggest a possible solution.

During this process, I will deliberately probe a candidate to see how they react when:

  • I suggest something which isn’t the best solution.
  • I directly contradict a course they had chosen.
  • I point out a minor typo or error in their code.
  • I press them to justify a design choice.

I never interrupt the natural flow of the conversation to do these things, but I always have my eyes open for an opportunity to slip them in. In all of them, I’m looking for the candidate to have the best possible answer in mind, and to neither try to boost their own ego or mine.

As we get to the end, I keep my eye on the time (easy, since we’re looking at my laptop where I keep it up in the corner), and let them naturally stop when we get to the end of a part with somewhere between 5–10 minutes left. At this point, I let the candidate ask me questions for the remaining time.

✧✧✧

I think the important take-away here is to try to make the interview feel as much like a pair-programming session on a real problem as possible. Pick a problem which isn’t directly from an algorithms textbook. Set up a real development environment for the candidate (for coding questions). Sit next to the candidate and look at the same screen, just as you would for a pair-programming session (or stand at the whiteboard with them, for a more design-y, less code-y question). Finally, don’t interrogate the candidate, or just let them squirm if they’re stuck; be a good member of the “pair” and help them along.

Go is the founder’s game

I’m currently about two months into founding a company, and, on an unrelated note, I just purchased my first really nice Go board (if you’re not familiar, you’ll probably want to read a bit about Go before continuing). It’s a new game to my wife, so I was explaining some of the basic principles to her this evening, and I was forcibly struck with the similarities to founding a company.

Opportunity cost

Each stone you place on the board during a game can only achieve certain objectives. It may limit the an opponent’s liberties (opportunities for advancement), it may offer your more liberties (sometimes more than one), it might strengthen your established positions, or it might conquer new territory. However, each piece you put down means giving up on other options: sometimes forever, if an opponent takes that place on the board. The best moves are those which do several of these at once.

I find this exactly corresponds to thinking about my business. Every hour I spend on one task is taken away from all the other tasks I might have spent time on. As in the game, it’s very easy spend time on things which are valuable, but not valuable enough. To be most successful, I use the Objectives & Key Results system (from Measure What Matters) to scan the board as a whole (i.e., make goals for the upcoming quarter), and my Getting Things Done (GTD) weekly review to zoom into the details (i.e., select projects and next actions) to pick the best moves I can.

Done is better than perfect

In the game, you often find yourself with a formation (a connected sequence of stones) which is in danger (i.e., about to be captured). In order to save that formation, you need to keep adding stones to it until it is out of danger. However, it’s very tempting to keep adding more stones to make it safer and safer, even though it’s no longer in grave danger (just mild peril). In the meantime, opportunity cost catches up with you. It would have been better to make it “safe enough” and then turn your attention to other, more strategically important, moves.

This is a constant struggle as I work though decisions about my business, since my natural tendency is to make everything “perfect”. For each project I undertake, I challenge myself to find the correct state of “doneness” for the current stage of my business: which is nearly always far, far less than “perfect”. I put “perfect” in quotes because, in the context of getting my business off the ground, taking “perfect” to mean “polished to the utmost degree” is the wrong definition. In this context, the real definition should be “polished to the minimal degree necessary to unlock progress on something more important”.

Keep all the balls in the air

The challenge created by the last principle is that you rapidly wind up with many vulnerable formations on the board at once. With each move, you need to consider each formation to see if it’s in danger of getting taken, or has an opening to extend it to capture new territory. In many cases, an opportunity to start an entirely new formation arises unexpectedly, and now you have one more thing to juggle.

Particularly as a solo founder, this is a daily balancing act. I use my GTD project list to constantly remind myself of the many, varied, projects I have on my plate, and update my action lists daily to deliberately choose which are going to get my attention on a particular day. As I do this, I often choose based upon which important priority hasn’t gotten my attention in a while. Taking this time to reflect is particularly important for me as a technical founder because writing code feels so productive, and therefore can easily absorb an out-sized portion of my time. So, I personally need the constant reminder to keep all the balls in the air: especially those more outside my comfort zone.

Mistakes and sunk costs

Go is a game of capturing territory, and sudden reversals are common. You may be working on building up a certain formation, only to find that your opponent has outflanked you, and that formation is suddenly in danger. If you’re not thoughtful and cautious, it’s very tempting to keep playing more and more stones racing to protect that formation, only to lose it anyway in the end.

The uncertain nature of a new venture means this is a constant danger for my business as well. I need to make a dozen key decisions (and loads more little ones) each week. Most of those are made with too little data, too little expertise, and not remotely enough time to acquire either. Unsurprisingly, those decisions are sometimes sub-optimal, and occasionally terribly wrong. The skill I’m constantly striving to hone is to recognize those mistakes as early as possible: often by seeking out and actually listening to hard feedback. Then, if I discover I’m on the wrong course, to swallow my pride and immediately stop throwing more time and money at it.

Recognizing a lost cause

Most games of Go don’t actually get played all the way until all the stones are on the board. At any point, either player can “pass” on their turn if they don’t think there’s anything productive they can do (it is quite possible to decrease your final score by playing too many stones). If the opponent agrees that there’s nothing productive left to do, then they also pass, and the game is over. I’ve sometimes conceded games where I’ve badly misjudged something within 10 minutes of play (a very short game!). The silver lining is that the sooner you recognize a particular game is over, the sooner you can move on to a game where you’ve got better chances.

Launching a new product starts with a huge pile of hypotheses about what customers want, what they’ll pay, how many people actually want it, etc. And, of course, almost no actual data. The goal, then, is to keep testing hypotheses and converting them into real knowledge of your product, your customers, and your business model. In the happy case, you prove your hypotheses correct, and the business thrives. In the not-so-happy case, you keep finding your hypotheses are incorrect, and eventually, you need to admit that this particular product idea doesn’t have a future. If you’re quick enough to do this, then you might have enough time and money left to try again (and, if you’re extremely good at this, even another time or two after that!).

✧✧✧

Of course, many games rely on these principles to some degree or another. And, it’s entirely possible that my current situation makes me see these principles in everything I do. However, I really do think that Go requires these principles so constantly, and to such a stark, obvious degree that it really is the “founder’s game”.

Reflections on “coming out”

Today, October 11th, is National “Coming Out” day in the US. For those who don’t know, I’m bisexual. I came out publicly last year in this blog post. It’s been almost a year since then, and I thought it would be interesting to reflect back on what’s been like to have been “out” for a year.

Initial reactions

The initial reactions, much to my relief, were universally positive. There were many expressions of how people’s opinions of me didn’t change at all, and how brave I was to have come out at all (esp. considering I’m very straight-passing, and married to a woman). Several people shared their own coming-out stories, and one other friend of mine even decided to come out herself based upon my blog post. I received zero negative remarks (that I ever heard, anyway).

My own reactions were largely of absolute relief to finally have it off my chest. I hadn’t predicted how immense of a relief it would be to no longer be concerned that someone would find out, or “out” me without my permission. Even though it’s still something most strangers don’t know about me, the feeling that I don’t care if they find out is wonderful.

Coming out again, and again, and again…

One thing I hadn’t entirely absorbed before coming out was that you’re really never done coming out. There’s always a new group of people you meet, a new social situation you enter into, that new person who joins your office, whatever. They don’t know you, and eventually it comes up, one way or another, and you find yourself coming out again. And again. And again…

My experience has been that it does get easier over time, but that it’s never easy. I always feel at least a little nervous, and find it difficult to make eye contact. I always feel that little inner cringe of dreading a negative reaction. Even having never received a negative reaction, it’s still a little scary. It has definitely gotten easier, though.

Frequently asked questions

There have been a number of questions which come up pretty often when the subject arises:

  • What did your wife think? (She was cool with it.)
  • What does your son think? (Sex is icky: doesn’t matter who.)
  • Have you ever considered dating a guy? (I was never out enough with myself to consider it until after I was married.)
  • Would you ever consider seeing a guy? (Definitely, but only if I was no longer married.)
  • Do you regret not having dated a guy? (Yes, but in the same way you regret deciding not to go see the Taj Mahal: as a bucket list item you choose to cross off un-done.)

Mostly, people have been very respectful of trying not to pry, but seeing how open I am about it, I get questions which become more and more personal as the conversation progresses. I’ve never received a question I refused to answer outright, but there have been a few for which I give honest, but somewhat circumspect, answers to.

Exploring LGBT+ culture

As I became more comfortable with being “out” myself, I found it increasingly interesting to spend time with or learning about other people who were also “out”. This took the form of reading and posting a lot on Quora, attending the Denver Pride Parade, writing on this blog, talking with LGBT+ friends, and adding some other reading to my usual news feeds.

It’s been eye-opening, to say the least. Getting hit on at the Pride festival following the parade was amusing. Hearing a lot of shared experiences from others (particularly bi people) has been reassuring. Of all of it, though, I’ve found that increased exposure to trans-sexual and poly-amorous people has gotten me past the “feels very foreign” stage to the “fine, but not my thing” stage.

It’s also been interesting to observe that there really isn’t a single LGBT+ culture. There are definitely some cultural norms in there, but it’s more fragmented. Gay men have certain culture norms, as do lesbian women. Bisexuals share common life experience and difficulties, but I’ve not seen a lot of shared “culture” in the same way. As I’ve observed it, the “LGBT+” umbrella gets used mostly when creating a safe space for non-straight genders & sexualities, or when advocating political action. Apart from that, I’ve not seen much evidence of a unified culture across the individual “letters” in the acronym.

Conclusions

Nearly a year later, I’m still very glad I made the choice to come out. I’ve met some fascinating people, had some positive influence on others, and continued to more deeply learn to understand myself, and this larger community I find myself part of. Finally, I continue to feel more and more comfortable with myself, and I think that’s the most important thing of all.