Tom Stuart

Articles


Programming with Something

The computational behaviour of Ruby procs (aka “lambdas” and “anonymous functions”) gives us enough power to implement any data structure and algorithm. Let’s reimplement that behaviour from scratch and then explore how to make our implementation more efficient.

Making a podcast

I make a sporadic podcast called Why Are Computers. I started doing it because I like listening to podcasts and thought it’d be easy and fun to make my own. I was half right.

Automatic differentiation in Ruby

Finding the derivative of a mathematical function on a computer can be difficult, but there’s a clever trick that makes it easy: first write a program that computes the function, then execute it under a non-standard interpretation of its values and operations.

Hello, declarative world

In this article I want to encourage you to think outside of your normal programming habits. I’ll present a more abstract and declarative style called relational programming, and show you how to implement a minimal relational language in Ruby.

The problem with BDD, and why I write

The title of the discussion is “WTF is BDD?”, and the idea is to try to get everyone to agree on a simple, clear, concrete description of what BDD is and literally how to do it. I don’t know if that’s a realistic goal, but I thought it would be interesting to try.

Consider static typing

Matz announced in his RubyConf 2014 keynote that Ruby 3.0 might have a static type system. What does that really mean? How should we feel about it? Will Ruby 3.0 still be Ruby? In this article I’ll unpack what Matz said and make some educated guesses at what it tells us about the future of the language.

A Lever for the Mind

Abstraction is a tool that magnifies the force of the human mind. The use of abstraction to make complex ideas manageable is fundamental to our work as programmers and to human culture as a whole. That’s why mathematics — the study of abstraction — is so important and powerful.

Refactoring Ruby with Monads

Monads are in danger of becoming a bit of a joke: for every person who raves about them, there’s another person asking what in the world they are, and a third person writing a confusing tutorial about them. With their technical-sounding name and forbidding reputation, monads can seem like a complex, abstract idea that’s only relevant to mathematicians and Haskell programmers.

How to hire a bike in London

I live in London, and I have a meeting across town. I’d originally planned to walk there, but I’m running slightly late and I know that Transport for London has a cycle hire scheme, so I decide to cycle and shave a few minutes off the journey.

Notes on “Counting Tree Nodes”

I was the first guest on Drew Neil’s Peer to Peer interview series. Drew gave me a programming problem and sat with me as I solved it. I had lots of fun; you can watch the episode here.

I Have No Idea What I’m Doing

I have no idea what I’m doing, but that’s not necessarily a bad thing. To explain why, I’ll touch on evolutionary biology, the impostor syndrome, the Dunning–Kruger effect, video games, test-driven development, material exploration, beavers, judo and Douglas Adams. I hope to convince you that wilful ignorance is a vital ingredient of human creativity, and therefore of programmer creativity, because a programmer is a type of human.

How testability can help

In David Heinemeier Hansson’s RailsConf 2014 keynote and accompanying blog post, he criticises “testability” as a meaningless goal. His argument characterises TDD practitioners as being fixated on testing qua testing, driven to pursue testability and associated metrics (coverage, ratio, speed) in their own right, as if they blindly believe those things to have intrinsic value.

Compilers for Free

Programs that manipulate other programs are powerful, interesting and fun. I’ll use Ruby to take you on a tour of how interpreters and compilers work, introduce the ideas behind a technique called partial evaluation, and explain a surprising computer science result which allows compilers to be generated automatically.

Impossible Programs

At Scottish Ruby Conference 2013 and GoGaRuCo 2013 I gave a talk called Impossible Programs, adapted from chapter 8 of Understanding Computation. It’s a talk about programs that are impossible to write in Ruby — it covers computational universality, undecidability, the halting problem and Rice’s theorem, explained in plain English and illustrated with Ruby code.

Building a GOV.UK exhibit

The GOV.UK website is being shown at the Design Museum as part of the 2013 Designs of the Year awards. GDS asked me to develop an interactive exhibit to highlight GOV.UK’s responsive design by allowing gallery visitors to browse the site on a desktop computer, an iPhone and an iPad simultaneously.

Programming with Nothing

Ruby is a powerful language, but how much power does it have if you remove all of its datatypes except for Proc and all of its features except for Proc.new and Proc#call? I’ll investigate by building proc-only representations of numbers, booleans, lists and strings, and using them to write an executable program.