4 ms·
I gave at talk about this at Scala Days NY, and I'll give it again in Berlin in a few weeks if I remember to actually book transport and a hotel. I'll just try
by noelwelsh 10y ago
I gave at talk about this at Scala Days NY, and I'll give it again in Berlin in a few weeks if I remember to actually book transport and a hotel. I'll just try and summarise here, because I don't have the energy or time to write out my talk :-)
I think FP and OO are fundamentally different in how they approach programming: the way they break down problems, what they consider to be good code, and so on. OO views code as small unit of encapsulated state communicating with one another. FP views code as a series of transformations. OO code is not good FP code, and vice versa.
On a lower level you can find many similarities. OO patterns are largely FP language features, from a time when knowledge of FP was not very widespread. At least five of the Gang of Four patterns are first class functions is disguise. Going the other way, a very typical pattern in functional programming is to build up a description of what should happen, and then have an "interpreter" actually execute that description. These interpreters often look like "coalgebraic" structures, which is an FP term for ... objects. Now isn't that interesting?
In summary, the techniques often look very similar if you squint, but the fundamental way they approach programming is very different.
That's a very quick sketch, which is somewhat hazy on the details. Apologies for the brevity and lack of nuance.
- honua 10y agoThat's really neat you've given a talk about this. If by any chance the talk is recorded it'd be great to watch it!
- SatvikBeri 10y agoLooks like he's posted slides here: https://twitter.com/noelwelsh/status/730449315789934593 https://twitter.com/noelwelsh/status/730449315789934593 I also really liked his talk on probabilistic programming: https://www.youtube.com/watch?v=e1Ykk_CqKTY https://www.youtube.com/watch?v=e1Ykk_CqKTY
- honua 10y agoAwesome, thanks!
- noelwelsh 10y agoThe talk was recorded. I don't know when it will be online. The talk doesn't go heavily into details (no talk of coalgebras) but spends time trying to explore what good code means in the FP and OO paradigms.
- deleted 10y ago[deleted]
- coreload 10y agoWell-defined object systems map objects to objects. Why would it be surprising that category theory can describe these things? The questions for software development are about creativity and economy. The jury us still out on these to the best of my knowledge.