"Real Artists Ship"

Colin Johnson’s blog


Archive for January, 2013

Things I Ought to Know about Programming but Don’t (1)

Monday, January 7th, 2013

I don’t understand why languages like Java don’t provide for “persistent” definitions of relationships between variables. For example, we write code like:

float a0 = 20.5;
float a1 = 17.3;
float midPoint = (a0+a1)/2.0;
...
a1 = 23.7;
print("Mid point is: "+midPoint);

missing out the recalculation of midPoint and printing out the previously-calculated value.

Surely, we more often want to define a permanent relationship between variables? Why don’t we have a “this variable stands for the current relationship between these values” operator:

int midPoint @= (a0+a1)/2.0;

meaning that whenever midPoint is referenced from thereon in within the current scope, it is equal to the value calculated from the current values of a0 and a1? Why do we burden the programmer with having to “remember to recalculate” the value?

Knick-knacks and Gee-gaws

Saturday, January 5th, 2013

Will the rise in internet-based distribution of media content mean that increasing numbers of presents end up being random knick-knacks rather than books, CDs, DVDs? It would be a pity; but there isn’t a particularly elegant way to present a gift of an e-book or MP3 album. Perhaps there is a business opportunity here?

The Right form of Words (1)

Wednesday, January 2nd, 2013

Something that happens from time to time is that I meet someone who I haven’t seen for a while, and who doesn’t know any details about my life over the last couple of years, in which time my mother has died and my father has a number of issues that require me to travel back to Nottingham almost every week.

I’ve struggled for a while to find what my colleague Keith Mander calls “the right form of words” to introduce this. It seems odd to have a casual conversation and wait for the “right moment” to introduce it; indeed, this can just add stress to a conversation as you wait for a moment, and you risk letting the other person feel a fool for not knowing, e.g. if they make some casual jokey comment that seems offensive given the change of circumstances. On the other hand, blurting it all out straight away “Hi! bythewaymymotherdiedand…”.

The “form of words” that I’ve gradually become comfortable with begins with a brief flag; after an initial exchange of pleasantries, I say something like “Have I told you about what has been happening over the last couple of years?” or “I ought to tell you about what’s been happening over the last couple of years.” This then changes the tone of the conversation and allows me to talk about it without feeling that I have blundered into it.