My topic at XP2016 will be about what XP can learn from functional programming (FP) and vice-versa. I hope to have some discussion before the conference, so that the discussion at the conference is productive.
First question is: why should I think that a style of teamwork would have anything much to do with a class of programming languages? Why wouldn’t it be that you could do all of XP with no reference to whether the code was being written in Smalltalk, Java, Ruby, Haskell, Clojure, or Elixir?
One reason is that history matters. As Jerry Weinberg has said, “things are the way they are because they got that way.” This note sketches what I know of relevant history. I expect to be corrected by readers.
My potted history of XP goes something like this: It started with Smalltalk, which introduced a particular set of people to a language+environment that was highly manipulable: that encouraged the “molding” or “growth” of programs. For reasons including coincidence, Smalltalk led to the patterns movement, which had some interesting characteristics:
- Reasoning tended toward the metaphorical rather than the mathematical. (Lots of talk about “resolving forces” and “generative patterns”.)
- Alexander’s A Pattern Language was an explicitly rhetorical work, one whose goal was partly to persuade you that the pattern being described was something you already “had” but hadn’t thought about explicitly. Patterns were written with a particular – though loose – structure that, importantly, wasn’t slavishly followed.
- Patterns were anti-innovative in the sense that pattern writers were supposed to be collecting solutions that were “in the air” among the experts. They were about making certain tacit knowledge more explicit. As such, the patterns movement was ill-fitted for academia.
Smalltalk also inspired a particular exodus of the Knights of the Square Bracket. Smalltalk seemed to transition rather quickly from something supported by research labs like Xerox PARC and Tektronix Labs to a language that was used in particular odd and unfashionable niches such as insurance companies, tractor manufacturers, and the like. In such cases, you’d expect the researchers to shrug and move onto the next hot thing. Instead, a core set of people moved with their language into environments where technologies (like SQL!) were ugly, and the business logic was… not at all logical. Not even close. Unbearably messy.
XP, I claim, was in part an attempt by a particular set of ambitious, thoughtful, and inventive people to come to grips with a new and forbidding environment, bringing to bear attitudes and habits developed via Smalltalk and patterns.
Meanwhile, over in the land of Functional Programming…
Here’s where I make a disclaimer. I was peripherally involved with the Smalltalk -> Patterns -> XP world, mostly as a result of being attached to Ralph Johnson’s patterns reading group. Over at my day job, I was for a time even more peripherally attached to the Lisp world because I was involved in writing a virtual machine for Common Lisp during the AI Boom of the early 1980’s.
Although Lisp and functional programming are lumped together today, and were even in the 1980’s (with a series of conferences on Lisp and Functional Programming), they didn’t really seem so to me. Lisp looked upward to a messy domain (intelligence, artificial or not) and system-building, whereas functional languages looked to the clarity of mathematics for inspiration. The sentence “Functional languages are easier to reason about” was common even back then, and it was even more clear than now that “reason about” entailed “prove theorems about”.
After the AI Boom turned into the AI Winter, Lisp (together with its fancy and expensive personal workstations) fell greatly out of favor. It (in the form of Scheme) was used in teaching, but production uses were limited to die-hards in niches (much like Smalltalk).
Meanwhile, the functional languages chugged along in academia. Because of their mathematical slant and emphasis on innovative applications of core ideas, they could encyst themselves there until a favorable environment allowed a sudden epidemic breakout. It’s perhaps early to say, but we may be in the midst of a global pandemic. I hope so, because – for an awful lot of problems, especially today’s problems – FP programs really are easier to reason about, and not just in the “prove properties of” sense.
When I refer to “functional languages” in this series of posts, I’ll be referring to ones from the academic tradition. I believe that even Clojure, which uses Lisp syntax, is more akin – in style and features and, perhaps, community – to them than it is to the Lisp tradition that culminated in Common Lisp. That’s unfortunate for my talk, in that I don’t have the experience in Haskell or F# programming that I should.
The missing piece in my story is Erlang. Its adoption was long hampered by an obscure syntax. Elixir, which puts a Ruby-like syntax on top of the Erlang virtual machine, is now a valid choice for early adopters, especially those writing applications like those for which Ruby on Rails is usually used. Unfortunately, I know little about Erlang’s history and have only a very novice understanding of its style and idioms (and that only through Elixir).
So, historians: what have I gotten all wrong?