Skip to content

Instantly share code, notes, and snippets.

Rusty's API Design Manifesto

The idea

Application Programming Interface (API) design is hard. But it's even harder to change once you get it wrong. So what you should do is to spend the effort to get it right the first time around.

In the Linux Kernel community Rusty Russell came up with a API rating scheme to help us determine if our API is sensible, or not. It's a rating from -10 to 10, where 10 is perfect is -10 is hell. Unfortunately there are too many examples at the wrong end of the scale.

Rusty's original descriptions

@andrep
andrep / configure.ios
Created December 3, 2013 23:51
A script to run `./configure` for various iOS devices. Lightly tested and WorksForMe™.
#!/bin/sh -x -e
case "$ARCH" in
armv6-apple-darwin10|armv7-apple-darwin10|armv7s-apple-darwin10|arm64-apple-darwin10|i386-apple-darwin11)
;;
*)
cat <<EOF
Must set ARCH environment variable to
armv6-apple-darwin10 = All iOS devices
@andrep
andrep / HaskellClosureTest.hs
Created April 2, 2011 18:53
A gotcha when using Apple's blocks in (Objective-)C: what do you think this prints to the screen?
module HaskellClosureTest where
strings = ["do", "re", "mi"]
main = do
let printFunctions = map (\s -> putStrLn s) strings
-- prints "do, re, mi"
mapM_ id printFunctions