Home
subscribe

L'etat, c'est moi

Mere Complexities sells the consulting and development services of me, Paul Wilson.

Conferences

Organising Scotland on Rails
Speaker, RailsConf Europe '08

Archive

Code like a chimp

stolen chimp at keyboard image


public static final String HTTP = "http";
public static final String COLON = ":";
public static final String FORWARD_SLASH = "/assets/";
private String url;

public void setUrl(String host, String path)
{
   url = HTTP + COLON + FORWARD_SLASH + FORWARD_SLASH + host + FORWARD_SLASH + path;
}

The above is based on some code I came across recently; amongst other things it protects against accidental misspelling of “:”. It’s a classic example of following a practice without considering the principles.

A recent study(*) compared the methods that chimpanzees used to retreive an object from a translucent box, with those employed by 3 to 4 year old children. The children were happy to exactly copy all the actions of demonstrators. The chimps only followed those actions that actually had some obvious function: one of the things set sets us apart from animals is the facility for mindless imitation.

Chimps don’t do cargo cults. Despite any evolutionary advantages, I’d rather the coders that I work with didn’t either.

All