Author Archives: david

With enough context, everything makes sense

From the work IRC channel earlier:

11:30 < DRMacIver> Oh by the way. There’s ice hiding inside the towel under the bowl. For reasons that totally make sense.

They do, too.

The ice was wrapped in a towel to keep it from melting. The bowl was on top of this because it had contained some of the ice for usage, on top of the rest seemed like a convenient location, and I figured a bit of evaporative cooling from the water couldn’t hurt even if it probably didn’t help very much.

I had the ice and the towel because I’d had to improvise a cooler box inside my backpack this morning. I put a bunch of ice in zip-lock backs, packed it around a Tupperware box, which I wrapped in a towel, which I put inside another bag, which I put in my backpack.

I needed this in order to be able to transport a mix containing raw pork and eggs at a sensible temperature in the heat, especially because my backpack tends to get quite warm from my body heat whilst cycling. Once at work I transferred it to the fridge.

I had this mix because I decided to make rosemary and paprika pork burger mix last night.

Which I need to transport to a barbecue tonight.

Because it’s Monday night burger club.

Which meets on a Tuesday.

Monday night burger club meets on a Tuesday because it used to meet on a Monday and we got attached to the name, so when we collectively decided that Tuesdays were much more convenient we were OK with the date change but changing the name would have been unacceptable.

Which is why, on this particular Tuesday, there is ice wrapped in a towel sitting on in our office kitchen area.

This entry was posted in Isn't my life interesting? on by .

Towards a more perfect democracy

Note from the future (2019): There are much more mainstream proportional representation systems than this one. I do think this one is a great idea, but it’s a political nonstarter, so don’t get too hung up on it.


A long time ago I wrote A “perfect” voting system. It’s my most popular post ever. Unfortunately it’s really badly written. This is an attempt to write a replacement version of it. I’ve written a lot about the idea since, and this will incorporate some of that, but it’s very much intended to be a stand-alone piece.

Modern British democracy is broken. It’s not a problem unique to us by any means, but it’s a problem we feel acutely. We have an entrenched two party system, with the Liberal Democrats being the only real contender for a third candidate. Small parties find it incredibly hard to get a foot in the door because the system works in such a way that the amount of representation you get is massively out of line with the amount of support you have. Regardless of whether you believe full proportional representation is a desirable goal, what we have is so far from it that it’s hard to even call it democracy: Most peoples’ votes simply don’t matter because they live in a constituency which is “safe”: In the 2010 general election, the electoral reform society predicted the outcome of 382 safe seats. They got two wrong.

Much of the blame for this has been leveled at the first past the post voting system. This is entirely fair – it really is an awful system. However equally a lot of the blame can be leveled at any of the commonly used systems when applied to geographic constituencies: It causes the geographic distribution of your voters to matter intensely.

One way this problem manifests is through gerrymandering: By manipulating the boundaries you can significantly change the number of seats a party gets. Here’s a good explanation of how it works.

It’s important to note that this is true with any of the normal class of voting systems applied to each constituency: If you have a system where in a two party fight the person with the most support always wins (which is true of basically every system commonly proposed. Indeed you might currently be thinking that it’s a property every system should have. Hold on to that thought) you can gerrymander to manipulate the result.

The obvious solution to this is to switch away from a regional constituency system to a  proportional representation based one. This is a perfectly valid solution and one that works for a number of countries.

I’d like to propose a… well not an alternative per se, in that the system I am proposing is also in many ways a proportional system. A different way of achieving proportional representation which preserves the regional constituencies.

Why might we want that?

Well the main reason from my point of view (there are many other reasons, and different people will find different ones important) is to ensure every region of the country has its interests represented: It’s all very well having proportional representation by party, but surely you also want proportional representation by region? Otherwise you can end up with your political interests represented but your local interests neglected.

There are ways to achieve this under PR: Essentially you form larger constituencies, have each be multi-member and elect those members under a PR system. This is an entirely respectable hybrid solution.

It does however end up inheriting the problems of both worlds – the smaller your regions are the more vulnerable you are to gerrymandering, the larger your regions are the less individual areas are represented. There is surely a decent middle ground that trades off optimally between the two, but what that is depends on your priorities, and both will remain at least partial issues.

Fortunately it turns out there is a way we can do better. There is a system with small constituencies in which everyone votes locally but we get global proportional representation.

The system in question has many major advantages. In particular:

  • It has true proportional representation across every axis, not just party. If 40% of votes go to people who support a specific issue, about 40% of candidates elected will support that issue. The same is true of things like race, class, gender, etc. This system might actually successfully reduce the prevalence of old rich white men in parliament (they’d probably remain a majority for some time due to being who people vote for, but it should even out)
  • Despite being a regional method it is completely immune to gerrymandering. The only way to distort the results by manipulating regions is to make some regions larger or smaller than others, which is intrinsically a problem with regional systems and comparatively easy to avoid.
  • There is no incentive for tactical voting. The optimal vote for you to cast is a tick next to the name of the person you most want elected.
  • There are no safe seats. Politicians remain extremely accountable to their electorate, regardless of whether they have a majority. They will always want and need more people to vote for them unless they literally have 100% of the vote (though they’ll probably be feeling pretty comfortable at upwards of 99.9% of the vote I imagine).

This sounds like a pipe dream. There are mathematical theorems (Arrow’s impossibility theorem and the Gibbard–Satterthwaite theorem) which constrain the possibilities for voting systems. How does this supposedly perfect voting system defeat the mathematics?

Well, it does that simply by not being part of the class of voting systems to which they apply. Arrow is very restrictive indeed – it only applies to preferential voting systems. Gibbard-Satterthwaite is less restrictive – it says that any non-dictatorial deterministic system which can elect at least three candidates is subject to tactical voting.

It’s time to come clean and stop teasing: We avoid this by not using a deterministic voting system. The system we use instead is one called Random Ballot. Conceptually it works as follows:

  1. Every voter casts a single vote for their preferred candidate, as under our current system of first past the post
  2. When all the votes are cast, we select a random voter and elect the person they voted for

This is not an implementation strategy you would actually want to use (it’s quite fragile), but fortunately there is a robust equivalent strategy that I will mention later. So if you have practical implementation based objections to this idea, hold on. They’ll be addressed. For now, keep this in mind as your mental model of how the system works.

Lets look at the consequences of this systems.

Functionally what we are doing is saying that each candidate has a chance of winning equal to the fraction of the votes they hold. Say for the sake of simplicity we have three parties and 100 votes in a constituency. The Red party have 60 votes, the Blue party have 35 and the Teal party have 5. You can think of each of these votes as lottery tickets with a guarantee that someone will win – the more you’ve bought, the more likely you are to be that winner. So Red are a bit less than twice as likely to win as Blue and are twelve times as likely to win as Teal. But even poor little Teal there is in with a shot at winning – the fact that they’re a minority party means they’re very unlikely to but it’s not completely infeasible.

So what I’m saying is that a party with a tiny minority can sometimes get into power in a seat. Is that not massively unfair?

Well, no, not really.

The thing about random systems is that if you run them enough times they start to look very predictable – sure you can’t predict what any given one will do, but you can make pretty good  bets as to the number that will do a specific thing.

If we were electing a president, random ballot would be a colossally bad idea. We don’t elect many presidents (in this country none at all, but that’s not important right now), so the randomness factor will play up massively. On the other hand when you’re electing 650 constituencies at once as we are in a general election, you’re running the result so many times that the results start to look downright deterministic.

Supposing you capture 1% of the popular vote. Under this system we expect you to have about 1% of the seats – i.e. about 6 or 7. You might have more, you might have less. But you’re not going to have a lot more or a lot less. It would be surprising if you had more than 10 or fewer than 2 or 3. It would be extremely surprising if you had no seats or more than about 15. It’s pretty much inconceivable that you’d get more than 20 – you’re better off banking on winning the national lottery and using that to fund your next election campaign to improve your chances.

This averaging effect also works over multiple general elections, though there are fewer of those than seats so its effect is necessarily a bit more random. But assuming its numbers stay roughly the same our hypothetical constituency would be Red about 60% of the time, Blue about 35% of the time and Teal about 5% of the time.

One thing that often concerns people about this system is the possibility of it putting a party into power over all who doesn’t deserve it. Allow me to state categorically: This doesn’t happen. If you’re going to get a majority of seats, you need to get incredibly close to a majority of votes. At around 48-49% of the popular vote you’re in with a chance at a majority. At 50% it’s a coin flip. Much above 50% you’re probably going to get that majority. Compare this with the current system: Literally the only general election under the current system where the party in power has had the majority popular vote happened in 1931. There have been some extremely high 40s (in 1955 and 1959 for example the conservative party had 49.7% and 49.4% of the popular vote), but we have never since that point broken 50%. If anything, election by random ballot is an excellent defence against parties who gain power without real support.

And remember: All of these things are true not just for parties, but for every other characteristic you choose to imagine. Are our parties not actually along our desired political lines? No problem! Not only can we vote for independents who better support us, parties become free to run multiple candidates in a given constituency which reflect different aspects of their ideology: If you’re a progressive party you can run two candidates, once who is more economically progressive than the other to see if you’re getting the social or the economic vote. Yes this splits the vote but that’s OK because it doesn’t reduce the total vote for your party (and may even increase it): If the votes simply split between your two candidates then each of them is less likely to be elected, but the chances that one of them will get elected remain the same.

So that’s why it’s fair and balanced at the country level, but what about our constituencies? Are we sacrificing their good for the common good by making them take candidates that they don’t want?

It turns out not.

You see, although our candidates may not be from the party that the constituency wanted, they have a really strong incentive to make their constituency as happy as possible.

Right now, and indeed this would remain true with any deterministic regional single-candidate method, suppose a party captures 60% of the vote in a constituency. What do they do about the remaining 40%? Well, they ignore it mostly.

If you manage to capture a strong majority under a more traditional system then you can pretty much rest on your laurels. You have a safe seat, it’s going to be hard to kick you out unless you manage to really alienate your constituents.

Under random ballot every vote counts. Those 40% who don’t vote for you? That  represents a 40% chance that you will not be re-elected. If you want to keep your cushy job in parliament you’re surely going to do your best to appeal to every voter in that 40% and convince them you’re a great MP – anything to get your numbers up and boost your re-election chance.

It’s very much the AV “Make your MPs work for their seat” position, only more so. The MPs must care profoundly an deeply about their numbers of votes, and it’s in their best interests to keep their local populace happy. It’s representative accountability on an unprecedented scale.

So we have a system which is pretty close to ideal and a local and national level. What’s not to like?

There are some common objections. I will try to address them.

The implementation you describe is fragile and easy to game

This is true. Actually selecting a random ballot is a bad way to implement this – there’s possibility for sleight of hand, it’s very hard to verify and the whole election can come down to a debate about whether a specific ballot is spoiled. Here is how to fix that:

Rather than selecting a random ballot, we count up the votes as we currently do. Calls for recounts are permitted, but must be performed before the next stage. Once a candidate has been elected it is too late to call for a recount.

What we then do is use these counts to simulate drawing a random ballot: We create one virtual ballot for each counted one, lay them out in order and use a computer program to pick a random one.

This program must be open source so that it can be verified and run by third parties. It uses a pseudo-random number generator seeded by a commitment scheme from each of the candidates to be elected and an impartial administrator. These commitments and their corresponding secrets are published at the time of the election.

If you didn’t understand that, don’t worry. The highlights of it are:

  • The results are entirely reproducible. Although they are effectively random they are generated from a process with known inputs that are kept secret up until the time of the election. Given those (published) secrets the full result can be reproduced
  • Any third party with a computer can verify the results are correct
  • It requires a collusion between every single candidate plus the election administrator to fix the results

People just won’t understand it

I’m getting a little tired of this objection, truth be told. It’s the most common objection I get to the idea, and there’s definitely some validity to it.

But the framing makes me uncomfortable. You see every single person I have explained this scheme to in person has got it fairly rapidly, as have most people who have read about it online – there have been objections, but they’ve generally been objections that showed that they understood the core idea but thought it had other crucial problems with it. Granted there’s selection bias going on here – the audience for my blog and the people I’ve described it to are definitely more mathematically inclined than most, but it definitely suggests that it’s really not all that hard to understand.

This makes this objection much more along the lines of “Well I understand it obviously, but those stupid proles won’t, will they?”

I’m pretty uncomfortable with this sort of paternalism.

Yes, understanding the fairness of this system is tricky and involves maths and probability, which people aren’t that good at. Yes, it would require education for people to truly understand it. But participation in the system is incredibly easy, for people who truly care enough to want to understand the details it’s decidedly within their capabilities, and for those who aren’t that interested they will still be much better off participating in a fair system they half understand than an unfair one they fully understand.

Why not just use a sortition?

Excellent question! I’m glad I asked me.

For those who don’t know, a sortition is when you simply draw your MP at random from the eligible population.

Using a sortition instead of my proposed system may in fact be an entirely good idea. One of the nice things about this system is that it transitions seamlessly into a sortition if people decide they want one – Anyone can run, and if everyone runs then what you get is precisely a sortition. Some of the practical details will need changing and scaling, and you’d need to lower or remove the barrier to entry of becoming an MP (there’s a deposit you pay at the moment which you get back if you get enough votes), but fundamentally there’s nothing stopping this behaving exactly like a sortition.

Here are some of the possible advantages of this system over a sortition:

  • It keeps more experienced candidates in the house, much like traditional voting systems.
  • It has much higher accountability of candidates to those whom they represent – under a sortition you have no chance of re-election, so no incentive to endear yourself to your constituency. Under this system you are strongly encouraged to do so.
  • Not every member of a group is well suited to representing that group. Disadvantaged groups and those who experience prejudice pay a much greater cost for being in the public eye, and as a result many of them will be strongly disinclined to speak out for group issues. By allowing them to delegate to someone they feel will represent those issues well and fairly you are in fact giving them more power rather than less.

What if a party with barely any votes gets a seat?

There’s no doubt: This can happen. A party with 1/1000th of the vote has about a 50% chance of getting a seat (this is not unreasonable – they’re “owed” about 0.65 seats). They’ve even got a small but appreciable (about 1 in 2000) chance of getting as many as 5 seats. If the party is some extremist group that you don’t want to get power this can be perceived as bad. How dare parliament represent this group?

First off, the important thing to note is that this balances out. You’re not going to get a parliament which is dominated by many tiny parties that together are not capturing an appreciable proportion of the vote. The bottom 1% of the vote occupies no more than about 20-30 seats in parliament – anything above that is less probable than a meteor strike. It’s an appreciable voting block to be sure, but it’s not a unified one – all the different minority party voices are likely to be at odds with each other rather than a single reinforcing block.

But back to the single party case, what do we do if an unpleasant group like the BNP get themselves a couple seats in parliament?

My inclination is to sit back and watch the show.

British news has a bit of an obsession with our fascist minority parties, far out of proportion to their actual voice. I think the only reason they can get away with this is that there’s no visible signal for how much support they get. It’s much easier if you can go “Yes, but you only have 1 seat in parliament. Clearly no one cares that much about you, do they?”. Also, honestly, I expect them to do a pretty bad job if they gain power and be laughed out at the next election.

It’s certainly possible that this won’t happen, they’ll actually do a “good” job as MPs and this will build their support. That would be… unfortunate. But if that happens we will have a level playing field to fight them on which we can and should do. In the meantime, we shouldn’t let a fear of fascism be used as an excuse to throw away democracy.

This will limit the experience of MPs in parliament – too many people will lose their second election

This turns out not to be the case. Although any individual may have a high chance of losing their second election, over all the strong proportionality feature means that the total number of MPs who have made it through a previous election is a direct sign of how much people like the current government: The fraction of people who vote for their incumbent MP will be approximately the same as the fraction of MPs in parliament who retained their seat from the last election.

This is a nice feature. It essentially means that people get exactly as much change as they want – if people are generally satisfied with their current representation in the house they will generally vote for the incumbent, if they are dissatisfied they will vote for change. And unlike in the current system they will get it.

It is worth noting that this does tend to limit term lengths. If an MP has only 50% of the vote they’ve a decent chance of re-election once, but they’re unlikely to make it two or three times. On the other hand, if they have 75% of the vote they’ve a decent chance of a few more terms than that. This too is a nice feature: It means the MPs with the most experience are the ones who do the best job at keeping their constituents happy.

It just feels wrong

A friend used a great analogy the other day. When your objections come down to “it just feels wrong” you are no longer making a reasoned argument, you are that guy who is saying “But baby, I don’t want to wear a condom because it just doesn’t feel the same” and you are sacrificing other peoples’ health and wellbeing for your own aesthetic preferences. Don’t do that.

This system is unfamiliar certainly. There is some historic precedent (indeed, Athenian Democracy had a high reliance on lotteries. More recently the Doges of Venice were elected through an outrageously complicated system involving iterating a sequence of votes and lotteries), but it’s been a long time since we’ve done anything like this.

But unfamiliar is not the same as bad, and in the face of such overwhelming advantages, the fact that it’s different from the current extremely broken class of systems should not be taken as a downside. We are used to living in a democracy that simply doesn’t work as one. Is it any surprise that when given the opportunity to live in a more perfect system we find it unfamiliar and strange? Let us have the courage to believe we can achieve perfection, and not let its unfamiliarity deter us.

This entry was posted in voting on by .

Valid arguments from my opponent believes something

(Title a reference to this post by Scott Alexander, though actual content of this post not so much)

I’ve been talking with Pozorvlak and Paul Crowley about this on Twitter. I wanted somewhere slightly longer than 140 characters to express my argument, so here you go.

My thesis is this: Given someone has known extremely false beliefs (homeopaths, young earth creationists, global warming deniers, people against social healthcare, etc), that they believe something should in many cases be taken as weak evidence against it.

Certainly not strong evidence against it, and certainly not enough to override other more compelling evidence (if they tell me the sky is blue I will nevertheless continue to believe that the sky is blue despite their having provided me with weak evidence against it), but evidence nevertheless.

Why?

Two reasons: First, they have demonstrated that their judgment is suspect. Therefore their beliefs should at most be taken as extremely weak positive evidence for something depending on how much judgment is required (I am more likely to believe “it was quite warm  yesterday” than “the current pattern of warming is part of a natural cycle” for example).

Secondly: They have a process for producing false beliefs and eliminating true ones. Thus one false belief tends to seed many.

What is this process? Well, there are two actually, which both feed on each other.

The first is simple: People want to have consistent belief systems and want to be able to argue for their beliefs. Therefore if they believe one false thing, they will look for facts to justify it. Through a process of motivated reasoning and cherry picking of data they will happily find all sorts of “facts” that support their opinions. So a belief held by  such a person may well have been selected by this process in order to support more overtly false beliefs. Similarly, true beliefs are likely to be rejected where they disagree with false beliefs, so as well as being more likely to believe false things they are less likely to believe true ones.

Secondly: People with false beliefs tend to congregate. Sometimes around their specific area of their false belief, sometimes around related areas, sometimes just because they’re “anti-establishment” and want to show some solidarity. Unfortunately this means that our people with false beliefs who we have previously mentioned have poor judgment in discerning truth-hood are awash in a lovely warm bath of false memes. Some of these will catch and they’ll get a whole new set of false beliefs to hold, which will then feed back into their process of building a self-consistent belief system and generate new ones. Wash, rinse, repeat.

This process tends to focus on areas related to their existing false beliefs, so you should definitely treat proximity as a signal for how heavily to treat another belief as evidence, but the social aspect definitely means that it’s not confined to that exclusively.

In general I would probably not apply this heuristic too aggressively – it’s easier to just not believe what they say one way or the other – but I find it sometimes useful to bear in mind.

It’s also important not to apply this heuristic to people you merely disagree with, or just think are a bit dim. It’s entirely possible for reasonable people to disagree and it is unproductive to react to this by disagreeing with everything your opponent is saying. This heuristic is reserved for people whose beliefs are so out there that you cannot see a reasonable way to believe them.

This entry was posted in Uncategorized on by .

Best of drmaciver.com

In an act of self-indulgent navel-gazing I decided to have a look through Google analytics and see what my most popular articles of all time were. This then caused me to want to signal boost and resurrect some old and not-so-old posts. It’s closer to what I think is interesting and worth a read than just the most popular because, well, most of my serious traffic comes from reddit and hacker news, and I don’t necessarily agree with their opinions of which ones are worth reading, but all of the most popular ones are in here too.

I don’t expect you to read all of them. There are a lot, and who the hell has the time? This blog has been going for about 7 years and I don’t know where in that I found the time to write all of these, but I’ve tried to arrange them in such a way that a skim through should find you something interesting.

Also, some advance warning: Some of these posts are quite old. Some of them may contain opinions I no longer hold. Most of them were probably well thought out at the time (or at least I thought they were), but it turns out that that’s no protection against being wrong.

So here you have it. Some highlights from the archive.

Edit: Updated May 13 with some links to fiction

Sections

Some quick navigation links for you if you’re not interested in all of this:

A perfect voting system

At 14k visits (yes I know that’s not a lot), this is my most read article ever. It got linked from a bunch of places, including one of the new scientist blogs.

Which really makes me wish it weren’t so badly written. In order to compensate for that I rewrote it. The new version is substantially better written but was so much less topical by then that it’s not had nearly the same level traffic.

The essential idea, which I proposed mostly as a thought experiment, is that when electing a large number geographic constituencies the correct election procedure to use is random ballot – everyone votes, you pick a random voter and use their choice. I’ve since come around to thinking this is actually a really good idea, but alas it will never get implemented.

I’ve written more on this subject since:

A less perfect system for which I will nevertheless be voting

I got very vocal and angry about the AV referendum. This is in fact what prompted the random ballot post. I had recently written Hammer Principle and so gone down a bit of a rabbit hole of voting theory. As a result it was really obvious to me how bad the existing system was. The fact that the no to AV group were lying through their teeth helped fuel my outrage.

I’ve since written various things both on the practical details of the vote in the UK and on voting theory at large:

Understanding Scala Arrays

I stopped using Scala long ago, and this article is no longer relevant to the current implementation, which I believe uses an explicit manifest object and is much more reliable. This was my description of the old mechanism where arrays could be backed by either an object array or a primitive array and what would happen was essentially that when you realised it as a primitive array the implementation would “snap” to that form. It was a very clever but ultimately quite flaky way of getting around the limitations of the JVM for generics.

The reason it’s got quite so much traffic over the years is that it’s linked from the proposal for the fixed array implementation that came in in 2.8.

Some other “Here’s how this bit of Scala works” posts:

  • How packages work in Scala. This is the old system. I still think it was a good system in itself, but unfortunately it was completely shafted by the combination of the Java conventions and the way package resolution from the file system worked.
  • A note on a useful feature of the Scala class system that most people seemed to miss. I believe this one to still be valid.
  • An introduction to implicit arguments. There are very few programming languages so bad that they have nothing to recommend them (Scala is pretty far from being one), so as a result pretty much every language I’ve ever used has features I miss when I’m not using it. Scala has a few of them, but implicit arguments unquestionably top the list. This is my attempt to write an introduction with lots of an examples on how to use them. I believe it to still be accurate – certainly it still gets linked from places and gets some traffic, so I hope its’ still accurate.
  • A little detail on the difference between Java wildcards and Scala existential types.
  • A more substantiative post about Scala existential types work. This seems likely to still be mostly accurate but I don’t know if it’s still 100%. It’s certainly still quite popular.
  • Once upon a time there was a Scala trait called Application which broke everything. You ended up running your entire application inside class initialization. This turns out to be a really bad idea on the JVM. I believe this was fixed by introducing deferred initialization rather than by removing Application.

Other posts from the Scala years:

  • No, seriously, why scala? An attempt at a pro-Scala advocacy piece that was a little more interesting than the standard “zomg functional programming is amazing!!1” fluff pieces
  • Why not Scala? A post on its downsides. Obviously some of these have now changed. I could write an updated piece, but I’m not going to. Someone who actually still uses the language is far better placed to complain about it.
  • How do you talk about Scala? In which I asked people about how they sold other programmers on Scala.

Understanding Timsort, Part 1: Adaptive Mergesort

One of my more read articles, mostly because it’s linked from the Wikipedia page on Timsort (not my doing, I promise).

I unfortunately never followed up with a part 2. I got about a third of one written before it got stuck in the eternal drafts folder of doom but decided not to bother – I got further with my understanding (although I certainly couldn’t recite all the details off from memory) but then realised I wasn’t all that interested in learning the details of the sorting algorithm.

A manifesto for error reporting

This was part of the storm of activity I had at the beginning of this year. I think I had three popular articles going in a week (and yet unlike last week HN didn’t bring my site down once. Oops). I forget what triggered this. I think it might have been the way Padrino handled certain problems, but really it could have been anything Ruby related. Basically: People who handle and report errors often seem to go out of their way to make things difficult to debug. This makes me sad and angry and you, the reader, thus get to listen to me being sad and angry. Apparently this sad angriness (sandgriness?) struck a chord with a lot of other people.

I also published A rewritten version of the manifesto because some people misunderstood the first one. There’s less shouting and more condescending prescriptivism. A friend described it as “the most passive aggressive thing she’d ever read” because of how obviously pissed off I was and yet going out of my way to be scrupulously polite in it. This is almost as popular as the inspiring post.

Relatedly, I appear to have strong opinions on exceptions:

How to quickly become effective when joining a new company

(original title: How did you get started so quickly?)

A rather recent post, so if you’re reading this archive post close to when I wrote it you’ve probably already read it. This post had the surprising characteristic of being remarkable well received on hacker news and derided on reddit. Clearly this means that Hacker News are better people than Reddit. Um.

This starts out with some practical advice on the philosophy of learning and rapidly descends into some very speculative things about mental models and how to apply them. I actually have more of the mental models stuff to come which I’m currently procrastinating from by writing this post instead. Such is life.

I’ve written a follow on post about how to apply this technique as a way of reading code.

In general I care quite a lot about the art of problem solving and how it’s applied to software development, and I have a few other posts on that subject:

OpenVPN repeatedly losing connections with inactivity timeout

You have no need to read this post. I practically guarantee it. If you’re not experiencing this problem then you don’t care. If you are experiencing this problem then you’ve probably found this page due to my advanced SEO skills (read: I struggled for ages to find anyone explaining what in the actual was going on, couldn’t find anything, so when I figured it out made sure that other people would not suffer this problem). This still gets a lot of traffic and every now and then someone will give me warm fuzzies by saying “Thanks! This completely solved a really annoying problem for me”.

Another example of my doing this that you don’t really care about is my posts on Linux wifi recently. Unfortunately those are less helpful because I haven’t actually solved the problem (I still haven’t. I’ve avoided it with a £15 wifi dongle).

Writing things right

This was a surprisingly popular article about a cute hack you can do in Haskell. I totally stole it from someone else at the time but was never able to figure out who I stole it from (I think it was someone on some mailing list). Basically: You can mess with Haskell syntax to make it look almost exactly like an OO language with surprisingly little difficulty.

This is part of what I think of as “The programming language years”. I still care about programming languages and like picking up new ones (it’s pretty easy using the “How did you get started so quickly?” guide, though knowing a variety of them already definitely helps with that). But once upon a time I was really quite obsessed with languages and thought that solving them was the key to a lot of software development’s problems. These days I think not being so completely dysfunctional is the key to solving a lot of software development’s problems and that most of our problems are social. I miss the days when I thought it was about programming languages. Those were nice, cuddly, delusions.

Other things from the programming language years:

  • Tell us why your language sucks. The thesis is that all languages suck in one way or another, and most criticisms of languages are shallow because they come from people who don’t use that language. This was an opportunity for people to complain about the languages they actually use and like. I think it went pretty well.
  • Criticizing programming languages. Me deliberately saying some good and bad things about different languages I used. Some of these are quite shallow (e.g. I could probably say more interesting things about python now), some of them are pretty fair.
  • Functional code != Good code. This might actually be an early sign of my disillusionment. A post that spells out in detail the seemingly obvious point that making your code more functional doesn’t automatically make it better and that what you actually need is better factoring and more modularity.
  • Functional programming lies. AKA “Please engage in truth-based advocacy, thanks”.
  • A problem of language.  What do we actually mean when we say “This is a functional programming language”? Draws the distinction between “This thing exhibits X behaviours” and “This is an X thing”, which I think is important and undervalued. I keep meaning to write another post on a similar subject in a different context.
  • I later elaborated on how you don’t actually need definitions to seek agreement.
  • Notes on the design of a Haskell API. Some problems I had when trying to design a metric space API in Haskell.
  • What’s a monad? So, yeah, I’ve written a monad tutorial. I’m not proud of this.
  • Then I accidentally wrote another one.
  • Interest bandwidth. The theory that interest in programming languages is strongly correlated to lack of interest in what you’re doing with them. This was my theory at the time for my waning interest in the subject. I think it was true but incomplete.

A more recent thing which isn’t from the programming years but fits into a similar category is How learning Scala made me a better programmer, in which I reflect on the fact that writing code in a language with a buggy compiler is surprisingly useful.

Commiting to calling out sexism

This was a bit of a transition point for me. The actual post itself is not that phenomenal, but it marks the point where I started writing about feminism and related issues and started being more vocal about them, both online and in person. I’d been what I suppose you might call a closet feminist before that – it’s not that I was secret about my feminism, but I didn’t make a big deal of it. This was the point at which I realised that this was not OK and that I needed to start getting on with helping make the world a slightly less shit place.

Annoyingly I haven’t actually done all that much explicit calling out of sexism recently (I’ve corrected some people on various things, but it was more of a “Hey, actually the world works like this” “oh, ok” scenario than “Hey you’re being sexist. Can you stop?”). I think this is mostly because I haven’t been in situations where it was necessary, but I’m not sure why that is and I think I’ll keep an eye on this.

I have done a certain amount of shouting on twitter on the subject, and I’ve definitely been a bit more vocal on the subject in casual conversation, but I’m not sure how substantial that’s really been.

I also promised at the time to try and document this. Again, failure. The only documented case of it was relatively near the beginning with if programming language articles were people. A workplace incident in which someone forward around a “If programming languages were women” post. I was not amused.

A more recent example is my I am angry too piece, in which I write about men’s tendency to dismiss women’s anger as a way to avoid hearing about things that make us uncomfortable.

This discussion around hiring practices maybe also counts. I think I might be reaching though.

I do have a bunch of posts about identity, which are clearly inspired by a lot of thoughts around intersectional feminism. I don’t know if I would call them explicitly feminist, but I think that’s clearly where I’m coming from:

  • I believe I can fly. Some thoughts about what we consider part of our identity and how these may not correspond to “objective” reality. I’m clearly on the fence on the subject (and remain so) but as a result people from both sides basically went “Yes exactly! This completely supports my point!” about it. I still think it’s an interesting exploration though.
  • You are not your labels. A post about the difference between your identity and the words you use to describe your identity, especially in the context of sexuality. In it I attempt to explain everything ever by the failure to understand the difference between these two. This had an interesting split in its reactions. People who knew me received it mostly positively (they didn’t necessarily agree, but they thought it was an interesting point). People who didn’t know me so well were… more mixed. Apparently a mostly-straight cis white dude who works in tech gets pattern matched to some relatively unpleasant behaviours when talking about identity. Not all that surprising and hard to blame people for.
  • So I wrote a follow up post in which I made it fairly explicit that I wasn’t saying that identity wasn’t important.

How to write good software

In which I outline my three step program for writing better software. It approximately goes:

  1. Smash the system
  2. Smash the patriarchy
  3. Figure out how to write good software

It’s proven to be fairly popular, I think mostly because people who are interested in both social justice and software are extremely keen to share it.

Ignorance is bliss for whom?

Also on a more or less feminist topic. Basically: Knowing more can make your life worse. The reason for this is not that knowing more is harmful it’s that your life was currently “better” because you were less aware that you were causing problems for other people.

Related are:

Questions for prospective employers

A distilled list of questions to ask companies before joining. I did ask all of these at my current employer, but I confess I didn’t guide my decision by these as thoroughly as I might have. To be honest, I completely failed to stick to my guns. Next time, whenever that is, I will do better.

Also, the long list from which the short list was distilled.

A manifesto for what I will do when I take over the country

(And the world)

Also in this series:

How to legally(?) and efficiently bribe a democracy

I’m pretty disillusioned with the state of modern democracy, which meant I was very receptive when Terence Edent gave a talk about how to effect real political change: By bribing MPs, because they turn out to be really quite cheap. This then collided with my peculiar obsession with randomisation and came up with this model for bribing MPs without directly bribing MPs. I then came up with another one.

Fiction

I sometimes write fiction. I’m not actually very good at it (mainly due to being unable to write good dialogue) but sometimes it turns out well anyway (mainly due to being able to avoid needing to write dialogue). Notable examples:

  • Gates – a story being told to you in a bar
  • Spam – my contribution to the rare genre of post-singularity humour
  • They called me mad – secret agent vs mad scientist. Contains actual dialogue. Also contains my favourite line from any of the fiction I have written.

Less notable but still decent examples:

  • Dark Lord – a hero rises to defeat the dark lord. Unfortunately the dark lord was already defeated with high explosives.
  • The man who named the stars – a vaguely lord Dunsany inspired fairy tail / creation myth..

A freemium model for scheduling

This was actually inspired by my world domination ideas for health care systems.

It’s an interesting way to do a business model: Give the service away for free, but dedicate a certain percentage of resources to the people who pay you the most, with people being able to pay as much or as little as they like to get access to this (and the amount of access you get scaling with the amount of money you’ve paid (plus some bonuses for regular customers). It has some problems, some of which I later patched.

On vegetarians who eat chicken

A practical and linguistic defence of people who describe themselves as “Vegetarian but I eat chicken” against people who immediately go “Well you’re not vegetarian then, are you?!” in a self-righteous “Gotcha!”. I get a surprising amount of Google traffic for this post.

Some simple theorems about dominance of probability distributions

I spent a little bit of time looking at the question of when one real valued random variable is “better” than another, where a higher score is always better but we’re not sure about the distributions. I gave a nice definition of the minimal possible partial order we accept has to be included in this and explored some of its properties.

I later proved that this was equivalent to the nice characterisation that one distribution dominated another iff it had greater or equal expectation under every monotonic increasing transformation.

I also characterised this for normal distributions. In short, a normal distribution dominates another iff it has greater or equal mean and the same variance. Normal distributions with distinct variances are incomparable under this order.

Studying a certain notion of “decision strategy”

I defined a thing I called a subset consistent decision strategy. I provided a full characterisation of all finite ones, and then did some work on characterising infinite ones:

How to get free tea from pret a manger

One of various “isn’t my life interesting?” amusing stories. Occasionally funny things happen to me and I blog about them. These tend to be surprisingly well received, although never get that much traffic. Other examples include:

Customers who read this blog might also like…

As if the 80-some links that I’m already providing in this post weren’t enough, here’s a whole bunch of book recommendations.

I also have a similar post for webcomics.

Miscellaneous

I have no idea where else to put these but think they’re worth reading

That’s it for now. I’ve missed out the cooking and fiction sections entirely, and I suspect there’s some interesting stuff lurking in the early days of my archive, but the process of curating this is exhausting. I may come back to it later, but I don’t have a good track record of doing that.

This entry was posted in Uncategorized on by .

Hammer Principle back online

You might have noticed that Hammer Principle has been down for a while. It should be back up now, and I’ll continue to try to keep it so.

The TLDR of what was going on is that its codebase is really old and hasn’t seen much love in a while. In particular all its dependencies hadn’t been updated in about 3 years. Oops. My bad. (It wasn’t running anything with security critical vulnerabilities that I know of – certainly none of the big news remote code execution ones that have come out in the ruby world in the last year or so are present). My last experience of trying to bring a similar set of dependencies in another project up to date was somewhere between “unpleasant” and “intractable”, so I’d been putting this off.

Which was fine, but about a month ago it started regularly eating up 100% CPU and making my hosting provider sad and fretful at me (sorry, dude), so I turned it off until I could look at it. I then repeatedly failed to getting around to looking at it.

I have now finally got around to looking at it after someone poked me about it recently. I decided the first thing to do was just to get the dependencies upgraded – running an ancient version of datamapper on an ancient version of ruby was basically never going to go well. To my embarrassment this turned out to be one of those tasks you put off for ages and then it turns out to be really easy. Took me a couple of hours last evening. I’ve also set up website monitoring and set things up so that unicorn workers will regularly be killed off rather than letting them get too big.

Then on further investigation I discovered that the varnish setup that was supposed to protect it from large numbers of visits was completely broken. It was completely broken in no less than three ways:

  1. The app was setting session cookies for everyone who arrived. This is something I’d fixed in the past. I’m not sure when it regressed
  2. Varnish was set up to run behind another web server, which was just silly
  3. The config pointing it to varnish was commented out and wrong

Err. Yeah. Ops: I’m still not especially good at it, but I was especially bad at it when I first set hammer principle up.

That should be fixed now.

Anyway, so hopefully hammer principle should be pretty stable now. If it isn’t, I’ll fix it. I’d like to do some more work on it, but I’ve got to admit that my track record of doing so is not astoundingly good, so no promises for now.

This entry was posted in Uncategorized on by .