Russel Winder's Website

FP and OO - two worlds collide and merge

_ The Scala user mailing list regularly and seemingly increasingly frequently has debates about attitude. This is not just about the attitude of the theorists to the pragmatists, it is about newbies to oldbies, trainers to practitioners, etc. Ultimately though, at the core, is the functional programming versus object oriented programming debate. The difficulty is that this is not being debated in a programming paradigms context alone, all the alignmnets of people on all the dimensions are conflated. A posting by Tony Morris:

I don't really buy into the "two worlds coming together" thing. There aren't two worlds -- it's an illusion -- a destructive one in my opinion. The issues at hand are so easily resolvable and indeed, they are regularly resolved for certain individuals. It's comes down to a matter of what is important to whom.

prompted me to write the following, initially as an email to the list but also as this blog entry - which is a slightly amended and extended form from the email. I agree with Tony's view that the way forward is possible and should be trodden, but I disagree with him saying it is an easy technical matter. It isn't. It is about the social structures arising from 30 years of Paradigm Wars. _

In the UK at least, there is very much a "two worlds", at least historically. In the 1980s, the functional programming (FP) folk set themselves up as people involved in the only form of computing that mattered. They got into positions of research power and hence research funding. But they became insular, and indeed dismissive of the non-declarative forms, e.g. object-oriented (OO). Also they did not worry about being relevant to folk making money from software. As OO rose in the late 1980s and early 1990s, the OO folk became an equally arrogant and insular crowd, who were as dismissive of non-believers as the FP folk were. The FP crowd began to demean the approach of being relevant to industry and commerce, a line being trodden by the OO folk. Both sides made jokes about any integrative work, cf. FOOPlog.

There was a real Paradigm War. You were on one side or the other, the two could never merge, cf. making FOOPlog the butt of jokes.

End result: C++ and Java are the only programming languages that matter in an industrial and commercial setting, with a smattering of C for the embedded systems folk. OO won the battle and the war. At least for the hearts and minds of CEOs, CTOs, CIOs and entrepreneurs. Not to mention the VCs.

C++ though led the way for the comeback of FP. The STL opened the door to a more FP approach to data structures in an OO world. Moreover template meta programming is FP.

Simon Peyton Jones (with Simon Marlowe) has been putting Haskell "out there" not just for its FP purity but because it can be made to be industrially and commercially relevant in an increasingly parallel world. Old views of concurrency are (finally after 40 years) almost irrelevant in the post Multicore Revolution world of ubiquitous parallel processors, involving many different hardware architectures.

Nonetheless there is a underlying and pervasive "two worlds" mentality. People are being engaged by the ideas of FP, are even looking to Haskell as an alternative to OCaml (which has a global interpreter lock (GIL) and so is problematic). Yet unless the there is a connection to C++ or Java, languages do not get actually used and hence absorbed into "real world" use.

It is not clear where the future is for native code, is it Go, is it C++, is it a merge of Miranda and C++ totally unlike the Objective-C mashup of C and Smalltalk?

On the JVM there is a much more obvious route given Groovy, Jython, JRuby, Clojure and Scala. Integration is available for free on the JVM, unlike the attempt via p-code 40 years ago.

Scala is in a position to bring the "two worlds" together in association with the Groovy, Jython, JRuby and Clojure communities. By not acknowledging that there really are, from a social perspective, "two worlds" out there, then the opportunity to create a new computing fit for the ubiquitously parallel world will be missed.

Copyright © 2017 Russel Winder -