Skip to content

Instantly share code, notes, and snippets.

View mjball's full-sized avatar

Matt Ball mjball

View GitHub Profile

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

[9:53 AM] Jeff Boulter: The guy in the SuperSucker truck is taking a nap using a roll of paper towels as a pillow.
[9:54 AM] Matt Ball: http://goo.gl/eFuKBI this is him, right?
[9:54 AM] Mike Stephenson: sounds like a good friday
[9:54 AM] Mike Champion: @boulter we don't all have purpose-built Nap Rooms
[9:54 AM] Eric Abbott: He doesn't even have to add quarters to get his bed to vibrate
[9:54 AM] Anand Rajaram: http://en.wikipedia.org/wiki/Jugaad
[9:54 AM] Jared Williams: #leannaproom
[9:56 AM] Jeff Boulter: perhaps the sucking sound is relaxing, like being in the womb again.
[9:57 AM] Mike Champion: @boulter (lol)
[9:58 AM] Ernie Park: i dont really know how to work without it anymore

@mjball
mjball / unSOPA.wiki.user.js
Created January 18, 2012 14:16
Make Wikipedia work on 2012-01-18.
// ==UserScript==
// @name Un-SOPA Wikipedia
// @namespace http://mjball.github.com
// @description Make Wikipedia work on 2012-01-18.
// @include http://*.wikipedia.org/*
// ==/UserScript==
(function ()
{
function unSOPA()
@mjball
mjball / stacktrace.log
Created May 2, 2011 21:10
JAXB stack trace
17:06:03,706 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/Redacted].[JAX-RS Servlet]] Servlet.service() for servlet JAX-RS Servlet threw exception: java.lang.NullPointerException
at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor.get(TransducedAccessor.java:165) [:2.2]
at com.sun.xml.bind.v2.runtime.property.AttributeProperty.<init>(AttributeProperty.java:87) [:2.2]
at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:104) [:2.2]
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:179) [:2.2]
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:515) [:2.2]
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:166) [:2.2]
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:515) [:2.2]
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:534) [:2.2]
at com.sun.xml.bind.v2.runtime.property.SingleElementNodeP
@mjball
mjball / stackExchangeDailyRep.user.js
Created February 14, 2011 14:51
Shows today's reputation score and time till new session begins. Originally written by Nick Craver, maintained by Matt Ball.
// ==UserScript==
// @name SE Show Today's Reputation
// @namespace SE_TODAY_REP
// @description Shows today's reputation score and time till new session begins. Written by Nick Craver, maintained by Matt Ball. http://meta.stackoverflow.com/questions/12053#57813
// @version 1.1
// @include http://stackoverflow.com/*
// @include http://serverfault.com/*
// @include http://superuser.com/*
// @include http://meta.stackoverflow.com/*
// @include http://*.stackexchange.com/*
@mjball
mjball / stackExchangeUserProfileHacks.user.js
Created January 30, 2011 14:47
Shows a SE user's reputation, divided by the number of their questions and answers.
// ==UserScript==
// @name Stack Exchange rep per Q&A
// @namespace http://mjball.github.com
// @description Shows a SE user's reputation, divided by the number of their questions and answers.
// @include http://stackoverflow.com/users/*
// @include http://meta.stackoverflow.com/users/*
// @include http://*.stackexchange.com/users/*
// @include http://superuser.com/users/*
// ==/UserScript==
@mjball
mjball / fixImgurGallery.user.js
Created November 30, 2010 18:02
Fixes imgur gallery's broken zoom feature in chrome
// ==UserScript==
// @name Fix Imgur Gallery
// @namespace http://mjball.github.com
// @description Fixes imgur gallery's broken zoom feature in chrome - no longer needed!
// @include http://imgur.com/gallery/*
// @include http://www.imgur.com/gallery/*
// ==/UserScript==
// No longer needed!