Archive for May, 2010

I didn’t know it was hard

Sunday, May 23rd, 2010

During the debrief of Steve Freeman’s Paradigms of Programming: Hands On workshop an interesting side discussion emerged about the origins of object oriented programming. Steve’s quote of Ivan Sutherland struck a chord:

small comic. Interviewer asks Ivan Sutherland "How did you invent this" he says "I didn't know it was hard". In between the two character is a display containing objects and a lightpen.

"I didn't know it was hard"

Ivan Sutherland invented the graphical user interface and the lightpen, as well as object oriented programming (he talked about “hens and chickens” instead of objects, a bit more poetic :) ). I found the quote Steve mentioned on Wikipedia:

“How could you possibly have done the first interactive graphics program, the first non-procedural programming language, the first object oriented software system, all in one year?” Ivan replied: “Well, I didn’t know it was hard.”

Ivan Sutherland with Sketchpad

I’m not sure whether Steve and Michael Feathers (his co-host who was stuck in the USA) intended to have ‘creating a programming language is not hard, as long as you don’t think about it’ as a feature of the workshop, but thinking about it afterwards, every single one of us participated in the design of no less than four programming languages in the space of a few hours! Armed with nothing more than pens, papers, peers and a high level description of the language features we managed to create programming languages that were expressive enough to solve the problem at hand. To be fair, we created examples of programming languages and reasoned about how the examples would run in our programming language. But still, the process felt pretty fluid.

Some things, like designing a programming language are hard, if you think about them a lot. I recently wanted to do more with drawing, as developing and communicating ideas visually is often a lot more effective than working with words alone. I started to ask people who were facilitating with visuals (Rachel Davies, Serge Beaumont) or drawing comics (Chris Matts) how they went about it, and I got a few books on drawing. The overall feeling I took away from it, is that it is easy, as long as you don’t believe that it is difficult; drawing doesn’t have to be hard, as long as you don’t believe it has to be art.

What are the things you are doing that other people believe are hard, while you do it easily? What are the things you believe to be hard, that might be easy if you just stopped thinking about it?


Sutherland, Ivan Sketchpad: A man-machine graphical communication systemPDF (3.90 MiB), Ivan Sutherland’s PhD Thesis.

Sketchpad and Ivan Sutherland pages on Wikipedia.

Dan Roam, The back of the napkin, solving problems and selling ideas with pictures.

Betty Edwards, Drawing on the right side of the brain

Cleaner code in other languages

Monday, May 17th, 2010

At SPA2010 Rob Westgeest, Marc Evers and yours truly hosted the workshop “Flying horses, Cleaner code in other languages”. This is a quick writeup accompanied by the flipcharts that were created by the groups to summarize what they learned.

We brought one exercise, to be carried out by pair programming. A pair can choose what ever programming language they want to use. We try of course to get an interesting variety of languages to learn from. We ran three 40 minute timeboxes. Each timebox consists of 25 minutes for actual work, and 15 minutes reflecting (about three different solutions presented on the projector accompanied by discussion). Some people switch pairs from one timebox to the next, so they can get hands-on experience of trying to solve the same problem in different languages. The goal of the exercise is not to finish first, or have the cleverest solution, but develop a solution that is idiomatic in the language one is solving it in, so that we could compare notes afterwards.

This time we had three pairs working in smalltalk (cincom smalltalk as well as squeak), two pairs in ruby, two java, and further pairs in Scala and Haskell.

A few pairs wrote examples using Rspec or Scalaspec, most pairs wrote ‘classic’ XUnit style tests. Some worked completely outside-in, other bottom up, and quite a few from the middle outward (me and my pair amongst others).

Some things that struck me:

  • at least one of the smalltalk solutions I saw did not strike me as very idiomatic smalltalk (admittedly, the presenter said it needed refactoring, so they went for make it work/make it right).
  • Nat Pryce noticed that collections were processed easier (and with less code) in the Haskell and Smalltalk solutions than in Java.
  • The smalltalk pairs were the first ones to finish setting up their development environment and getting to work (Rob did a timecheck, the smalltalkers were the only ones working on the problem already). Having an environment that contains almost all the tools and libraries that you need gives a big speed boost at the beginning. What was more striking still was that all smalltalkers used environments they just installed and had not used before; I installed squeak last weekend, the others were using a fresh beta version of their environment.
  • Many people had not seen (much of) haskell/ruby/smalltalk style of iterating over collections using blocks/closures, luckily these idioms seem to be trickling down to Java and C#.

As with the previous instance of Flying Horses, the Haskell pair was moving towards a complete solution the fastest. This may be because the exercise we use seems to find itself in Haskell’s sweet spot (parsing and manipulating data).

On the whole, the level of engagement was pretty intense (about half the participants continued working through the breaks, even though we emphatically tried to get them to stop ;) ), participants said they got to see some very different ways of solving a problem from what they knew, so they came out of the workshop with puzzles to investigate further.

As one participant mentioned, code presentations work up to a point. They show what a pair has done, but it is hard to see what steps they have taken to get to the solution. Seeing the sequence of steps (and experiencing it) when you are part of a pair (especially with someone you don’t know) is very valuable. I’m interested in suggestions for getting more of the sequence of events (rather than the solution) out into the presentations.

We have tried letting people work with task lists and presenting from there (works somewhat, but may cause pairs to loose to much time on their small design up front).

Let a thousand languages bloom ;) Below are the flipcharts summarizing some of the things people learnt from the workshop.