Writing Accessible Go


A talk presented at GopherCon 2018. Full slides: PDF


Slide 0 Hi, my name is Julia Ferraioli and this is Writing Accessible Go.

Slide 1 First off, for those who would prefer to read a transcript alongside this talk, you can find a preliminary one here. Once the video is posted, I’ll go update that transcript to match what I’ve said here – hopefully there won’t be too many differences!

Slide 2 I work at Google’s Open Source Office, developing tools to help people and teams with their open source projects and contributions. I joined this team a couple of years ago, and I was really excited because I had been wanting to dive into Go, but hadn’t had the justification before then. I came from a pretty varied background – everything from C to LISP to Python. And, I’m often described as “stubborn” or more nicely, “persistent”, which came in pretty handy over the past two years, because my vision started to decline shortly after started to learn Go.

Slide 3 And it’s kind of kept degrading since then. I say that I’m vision-impaired off-and-on because my eyes kind of act like an autofocus camera that’s misbehaving. I’ve got approximately 40% of the time when my vision’s okay, but it cycles in and out every 15-30 seconds or so.

I’m going to show a pretty good approximation of how I see most of the time. If you’re prone to motion sickness, you might want to look away.

Slide 4 Simulation link

Slide 5 Okay, we’ve moved away.

While I do sometimes have sections that are in focus, but the window of clarity is pretty small.

Now, we work in technology. You all know that one of the worst things that can happen is…

Slide 6 An intermittent failure. They make debugging absolutely hellish. I got a beautiful high-resolution screen – no dice. Glasses? No effect. High contrast? Somewhat helpful, but not enough. Turns out when the problem’s in your brain, assisting the eyes isn’t going to work. I had to make my peace with the fact that I was, am, and probably always will be intermittently disabled.

Slide 7 That’s a word that gives people a lot of pause. It’s a highly personal label. So what is a disability?

Slide 8 I could give you examples and lots of medical terms to look up later, but the WHO gives a really good overarching description of disability. It’s when there’s this gap between the environment a person lives in, and the capabilities of their body. It means that people who live with one or more disabilities have to work harder to do various things, because their environment is designed for someone else.

And disability isn’t uncommon. The WHO estimates that 15% of the world’s population currently lives with a disability.

Slide 9 But how does it apply to development?

Well, I want you to think about your development setup. When we get going from scratch, we have so many tools to configure – from the operating system level, to the editor, to the debugger, to the version control system. How many of you know how well any of these work with accessibility tooling? I sure didn’t when all this started.

Slide 10 Demo video

Let look at a quick video of navigating code with VoiceOver on. Kind of painful, right? As I was trying to adjust to some of the standard accessibility tools, methods, and research what was available, it struck me that…

Slide 11 …We make products accessible, but not the processes by which they are built. Our development practices themselves are inaccessible.

Slide 12 Tooling just isn’t enough. Tooling helps, but we can do more to make code accessible, to close that gap between the capabilities of our bodies and our environment – in this case, our development practices!

Slide 13 So here are some of the lessons I’ve learned over the past two years. None of what I’m going to show you should look revolutionary – they may even be practices you’re already following. But I hope to cast them in a different light and give you additional reasons for continuing and prioritizing them.

Slide 14 What we have here is a straightforward code snippet. We declare two vectors, then swap them. Then we declare a third, and sum all three together.

Slide 15 Functionally identical, in this snippet we declare all three at once, then perform the swap and summation.

Slide 16 You want to declare your variables close to where they are actually used. You want to make sure that the context around them isn’t lost by the time they come into play. The same goes for other types of declarations – interfaces, structs, etc… By logically grouping components together, you have to keep less in your mental buffer – which is great if you use a screenreader – and you have to navigate around the code base less to find definitions or declarations – and that’s great if you have difficulties with fine motor control. Either way, you’re minimizing the amount of navigation needed to comprehend a block of code.

Slide 17 Short variable names – which Go encourages anyway. Single letters are okay! Eliminate redundancy – repeating “vector” in the variable name is unnecessary, and increases the amount of time it takes to go through a block of code.

Slide 18 Using meaningful names reduces the amount of work that a person has to do to understand what’s going on in your code. They don’t have to keep as much context in their head about what that variable does. They don’t have to jump around to find definitions, usage, etc… It can also help distinguish important variables from temporary placeholders.

Slide 19 Now, something you may have noticed during the demo, is how screen readers handle variable names. It’s rough, right?

I spent about 15 minutes scratching my head the other day, wondering what “gee-thub” was, before I realized that it was reading “GitHub”. Turns out that’s not actually an English word, contrary to what we may think.

So make sure you use pronounceable names. Don’t make up words. Think of how they would be spoken. Avoid concatenated variable names when possible. Various screen readers won’t necessarily make it clear that the variable name is one word.

Slide 20 If we revisit the recommended organization, we can also see the usage of new lines. Newlines are something we kind of pepper in our code without really thinking about it. However, they can be really powerful signals. I recommend that you treat them like paragraph breaks – if you don’t use any at all, your reader is lost. If you use them too much, your message is fragmented. They can help guide the user to where the logical components are.

Be intentional with them!

Slide 21 Probably the hardest recommendation I make here is about consistency. Whatever patterns the previous recommendations make you follow, use them consistently. * Easy to do when starting; harder with more mature codebases * Pick styles and stick to them * Changing conventions necessitates updating the whole codebase * Spend a bit of time at the outset to nail these down as a team * Enforce them during code reviews

All of this is in service of reducing cognitive load. You want to reduce the extra effort that people need to do to understand the code.

Slide 22 You might be saying “I don’t have any disabled developers on my team. I can just keep going the way I am, right?” Well…hate to break it to you, but no. Why?

Slide 23 Well, first off, you can’t tell if someone has a disability by looking at them. I imagine that if we were just chatting, you wouldn’t be able to tell that most of the time I can’t see my code. Disability doesn’t announce itself.

Slide 24 It’s also not a binary state of disabled or not. People’s capabilities can vary day by day. There are some days when I can churn out code, and some when I can’t read anything at all. Add in the number of people who are temporarily disabled – it’s a good investment.

Slide 25 Lastly, accessibility helps everyone.

Slide 26 There’s something called the “curb cut effect” – you may have heard of it. To make cities more accessible to wheelchair users, city planners started putting in curb cuts – ramps from the sidewalk to the street. But something unexpected happened. The city became more navigable for new parents, for tourists. They found that curb cuts helped them out too.

Slide 27 The curb cut effect is when something designed for one population winds up helping people outside of that population as well. The practices I describe are code curb cuts. Why? These practices actually benefit everyone.

Slide 28 They both attract and help newcomers. The code becomes more navigable, easier to understand, and healthier. People looking for a new project to participate in can get a better grasp of your practices and get a sense of where they can contribute. Keeping some of these practices in mind make the development environment itself more welcoming, and by prioritizing it you’ve also painted your project as welcoming too.

Slide 29 So remember:

  • Organize your code logically. Keep things close to where they are used, and make sure you are conscious about white space
  • Use pronounceable names. Not only do they work better with screen readers, but they also help teams talk about code.
  • Be consistent. That’s probably the easiest one, right? We’re all consistent…eventually.

Slide 30 Here’s that transcript of the talk again, as well as some good links to follow. There was a great lightning talk at Pycon on a similar topic that I highly recommend watching. If you’re an emacs user, you can check out TV Raman’s emacs plugin, emacspeak. Read a bit more on tooling for blind programmers, and listen to this non-tech-focused podcast on curb cuts.

Slide 31 I look forward to speaking with you after the talk!

Slide 32 Obligatory octopus signoff.

comments powered by Disqus