In G. Kadoda (Ed). Proc. PPIG 13 Pages 163-172 13 th Workshop of the Psychology of Programming Interest Group, Bournemouth UK, April 2001 www.ppig.org Human and “human-like” type explanations Yang Jun, Greg Michaelson 1 & Phil Trinder Dept. of Computing & Electrical Engineering Heriot-Watt University, Riccarton, EH14 4AS {ceejy1,greg,trinder}@cee.hw.ac.uk} Keywords: POP-II.B. problem comprehension POP-II.B. types of programmer behaviour Abstract The behaviour of a “human-like” polymorphic type explanation system is analysed using the same categories as those used to characterise human expert type explanation behaviour. The results suggest that the computer system has a similar behaviour profile to that of a composite human expert. Introduction We have been investigating techniques for making mechanical polymorphic type inference more understandable. Most type checking algorithms are based on Hindley-Milner type inference (Milner 1978), which introduces new intermediate constructs in the course of type determination. In particular, type variables are used as place holders for the as yet unknown types of sub-expressions. Error reporting systems that build on the Hindley-Milner approach tend to use such intermediate representations in explaining how types are derived, although the programmer did not use introduce them in the original program. Our experience suggests that users, especially naive users, find such explanations hard to understand. A number of explanation systems have been constructed to aid users in elucidating types (Soosaipillai 1990) (Beaven 1993) (Duggan 1996). These tend to be based directly on Hindley-Milner algorithms and use intermediate type variables in their explanations. In contrast, we wished to build a type explanation system that was in some sense “human like”; that is it should incorporates rules intended to mimic the behaviour of people explaining type derivations. Experiments with expert human type checkers confirmed our intuitions that people tend to give explanations that avoid intermediate representations, focusing on concrete aspects of the program being analysed. In building our system, we attempted to incorporate rules that reflect such behaviours. We have recently completed our system (Yang 2001). Its explanations are very unlike those from Hindley-Milner based approaches and appear more human-like to us. We now return to our original analysis of human behaviour, and analyse the system’s behaviour using the same categories on the same problem set. While there are some differences, comparison suggests that our system has similar behaviour to human experts. Original experiment Eight expert subjects were video taped while solving a set of 34 error-free type explanation problems in a pure functional subset of Standard ML, corresponding to that taught to our 1st year undergraduate students. Initial analysis of the results led to the identification of 14 major techniques used to identify types. These were: 1 1. Construct type skeleton for function. A schematic for a type signature is drawn, indicating function and tuple types but omitting fine detail. 1 Contact author.