RSSAmplifier

Blog

Tom Stuart

tomstu.artRSS feed ↗17 posts

Latest posts

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. This is a lightly edited transcript of a talk I gave at RubyConf 2021, for which the video , slides and code are available. Some of the…

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. In reality it takes an enormous amount of work to produce each episode — I’d estimate 30–40 hours, which is roughly one working week. That came as a surprise to me, so I’m writing down the details here, partly as a record…

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. In this article I’ll show you how that works in Ruby. This is an expanded transcript of a talk I gave at the London Ruby User Group . A…

Hello, declarative world

A computer is an imperative machine. Its CPU reads a list of instructions and performs one operation after another, with each operation modifying the state of its registers and memory. But that doesn’t mean we always have to write our computer programs as imperative step-by-step recipes; imperative programs are often too low-level and overspecified, which is why we're generally terrible at writing…

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. This is an expanded transcript of a talk I gave at RubyConf Australia 2015 , for which the…

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. This is an article about abstraction: where it comes from, what it’s for, and how we can use it to make our programs…

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. Forget all that! In…

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. There are plenty of cycle docking stations around the city, and it doesn’t take me long to reach the nearest one on foot. There’s a row of bikes locked…

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 . Wow, it’s difficult to think, type and talk at the same time! As I worked on the problem I had lots of ideas that I almost verbalised, but in the end I kept them to myself. That was probably for the best — we ran…

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,…

The DHH Problem

A lightning talk from Scottish Ruby Conference 2014 . More…

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. That’s…

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. This article is adapted from a talk I gave at RubyConf 2013 , which itself was…

Impossible Programs

At Scottish Ruby Conference 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. More…

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. I chose a simple solution based on web technologies: proxy the HTTP requests to the GOV.UK site,…

Understanding Computation

I’ve written a book called “Understanding Computation” for O’Reilly Media . You can buy it from the O’Reilly shop or Amazon ( US , UK ). Here’s a sample chapter and all the code . It’s a book about old, deep ideas from theoretical computer science, deconstructed and explained in an engaging, practical way for an audience of working programmers. More…

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. This article is adapted from a talk I gave at the Ru3y Manor conference, for which…