Is-a GPL, has-a BSD

Thursday 19 July 2018

When talking about classes, and how they relate, there are two classic relationships. Class Y can inherit from class X (inheritance), or class Y can use class X (composition). In the first case we say that an X is-a Y, in the second that an X has-a Y.

Sometimes it isn’t clear which choice is best, and you can imagine using either. One thought that can help decide: is it part of X’s essence that it is a Y? Is it impossible to think of an X that isn’t a Y? Or is Y just a helpful implementation detail of X, and there are other possible ways to build X?

I don’t want to open a can of worms debating licenses, and probably this is an absurd analogy, but it occurred to me that copyleft license (GPL) advocates view their license choice as an is-a, and permissive license (BSD, MIT, Apache) advocates view theirs as a has-a. is on GitHub

Sunday 24 June 2018

After many years on Bitbucket, today I moved development to GitHub. I’ve long wanted to use Git instead of Mercurial, but I didn’t want to lose the issues that were on Bitbucket.

I thought GitHub issues were the simplest possible bug tracker. But I realized that Bitbucket’s were even simpler: they have no labels. So I bit the bullet, added some features to the Bitbucket issue migration tool, and switched over.

There had been a GitHub mirror of the code, but I started a new repo so that the issues transferred from Bitbucket could keep their old numbers. The old mirror is still around, because there’s a handful of issues and pull requests there that I didn’t want to lose.

This move is also a kind of way to declare some pull request bankruptcy. I’ve embodied the bad habit of letting pull requests languish, sometimes for years. I shouldn’t let that happen, but I can’t promise that I will do better. I’ll try. At least Git will give me a more familiar environment in which to work with them, which I hope will help.

Another side-effect of making a new repo is that I have hardly any stars yet...

Geeky shirts

Thursday 14 June 2018

I wear t-shirts a lot. A lot of them feature geeky topics. They’re are fun because they start conversations among the people I hang out with. The best times are when someone can take the geeky idea, and one-up it with yet another layer of geekiness.

For example, I have a shirt with this melting Rubik’s cube on it:

Melting Rubik's cube

As geeky as this image is, I add to it by pointing out that even before the melting began, this isn’t a possible configuration of a Rubik’s cube. To avoid spoilers, I’ll explain why at the end of this post.

Here’s another shirt from my closet:

My password is the last 8 digits of pi

In this case, other people added to the geekiness of this shirt. One person suggested that the shirt is simply missing some punctuation, and it should say:

My password is “the last 8 digits of pi”

Of course, there’s still the problem of “pi” vs “π”...

Another person suggested that although no one knows the last 8 digits of pi, my security has been compromised, because it’s really easy to brute-force an 8-digit password, no matter what the digits are.

OK, back to the Rubik’s cube question: why is the melted cube not a real cube? Consider a solved Rubik’s cube:

A solved Rubik's cube

Look at the the two faces colored orange and yellow. They meet at one edge, so there are only two corner cubies (the smaller cubes that make up the complete cube) that have both an orange and a yellow face.

Now think about the two orange-yellow corner cubies on a real cube. If you look at the corner, and think about the faces in clockwise order, one of the cubies must go orange then yellow, and the other must go yellow then orange. They have to have opposite handedness, if you will.

If you look at the melted cube, you can see two corner cubies with both orange and yellow, they are the two closest to the viewer. But they have the same handedness! Going around clockwise, they both go orange and then yellow. So this can’t be a real Rubik’s cube, because these two must be the only two orange-yellow corner cubies, and these two aren’t right.

PyCon 2018

Wednesday 16 May 2018

PyCon 2018 is over, and of course I enjoyed the hell out of it. I tweeted a bit this year, so I’ll tell the story partly with tweets.

I did a talk about Big-O notation: Big-O: How Code Slows as Data Grows. People seemed to like it. I was especially gratified when people told me that the “sitting at the adult table” comment exactly described them, and the talk helped. Nice.

I planned on a juggling open space this year, and brought equipment for it. Getting it through airport security was fun:

And everyone has a wise-crack:

Eric Holscher proposed a rule of thumb: if this is your Nth PyCon, then you have to meet N new people every day. My strategy was at breakfast and lunch, when wandering around looking for a table to sit at, choose one with no one I know, and with people that don’t look like me.

Hillel Wayne did a great talk about advanced testing with Hypothesis and contracts, but he also excelled in a different way:

One goof by the program committee this year: it seemed like often same-topic talks were scheduled in the same time slot. There were four testing talks all scheduled at the same time. One was by Justin Crown (“WHAT IS THIS MESS?” — Writing tests for pre-existing code bases), who I met in the hallway:

The juggling open space was great, a lot (15?) of people showed up, including Christy Heaton who I had met that morning at breakfast. We threw things all over the place:

One of the interesting experiences at PyCon is finally meeting face-to-face with people that you’ve built a strong online-only friendship with, like Mariatta Wijaya.

It’s fun to be captured by Kenneth Reitz, but maybe not outside where it’s windy?

David Beazley showed off how to use the latest meta-programming tools in Python 3.6 to implement a parser generator:

Ying Li’s keynote was a masterful explanation of web security as told through a children’s book. Then Qumisha Goss (who I met at breakfast!) did a great keynote about teaching urban kids programming at a public library:

Another day we had an impromptu juggling session, helped along by penny-whistle accompaniment by Justin Myles Holmes:

Turns out this is conference chair Ernest Durbin’s car:

PyCon did a great job including everyone. At registration, you could choose a ribbon to attach to your badge that announced your preferred pronouns. Also:

I hung around for one day of sprints, which I used mostly to talk with people. Trying to help pylint with an installation issue, I was introduced to check-manifest. Where has it been all my life?

If you are looking for videos to watch, in addition to the ones linked above, take a look at these:

It’s kind of dissatisfying writing about PyCon, because it’s hard to include everything that happened. It doesn’t feel like a technical conference, it feels like a family reunion. I belong to a few different sub-communities and I kept shifting from one to the next: Boston people, ex-Boston people, jugglers, testing geeks, IRC people, meetup organizers, open source developers, and so on.

And I’m sure I’ve forgotten about some amazing piece of the four days. If it was with you, I’m sorry!

It’s always a great place to find your tribe, re-energize, cement old friendships, make new ones, learn, teach, and have fun. Next year in Cleveland!

Money for cotton candy

Tuesday 8 May 2018

My autistic son Nat did something last weekend that got my attention. It’s going to seem like a small thing, and in some ways it is a small thing. One of the things that keeps me thinking about it is why it made such an impression on me.

My father likes circuses, and as a result, I like circuses. It’s been an annual tradition my whole life to see the circus with him. When I was a kid, it was Ringling Brothers at Madison Square Garden. Now it’s the Big Apple Circus in Boston. We take along whatever kids of mine want to go. These days, Nat is the only son in town, so this year, it was me and Nat.

As we were getting ready to leave the house, I was doing the usual things: getting my shoes, telling him to get his shoes, making sure I had the tickets, and so on. Suddenly he looks at me and says something that I didn’t catch. I thought it was about Mom (she was staying behind) and candy. I asked him to repeat it, and it was clear: “Money for cotton candy.”

I was very pleased. He was right: I had to make sure I had money for cotton candy. This was even something I had thought about the night before, but had forgotten now that we were scrambling to get ready to go.

Why did this seem so unusual? Nat is usually focused on snacks. It might be that his entire experience of the circus is: watch inexplicable things for an hour, eat cotton candy, watch some more, go home. As it happens, we hadn’t been to see the circus the last two years, but even a three-year gap is not enough to break the memory of an ingrained tradition like getting cotton candy at the circus.

I wouldn’t have been surprised if he had said, “cotton candy,” meaning, let’s make sure to get some cotton candy. As I say, Nat is very focused on snacks. But he went a step further than that: he thought about what we needed in order to get the cotton candy. Usually he does not handle the money when we are out together. But he understands that money is required, and probably has felt the frustration of wanting a snack and being told, “we can’t, I don’t have money.”

So why was it so pleasing to hear, “Money for cotton candy?” He was thinking about his needs, and thinking about how to really get them met. He advocated for himself without me prompting him. He persisted through the small frustration of not being understood. He helped me by thinking of something I had overlooked. And I guess it made me happy that the circus tradition was strong with him too, even in his own snack-centric way.

Abstract shot of circus tent