4 ms·
If OO is a better fit for parallel programming, why are functional programming models such as Hadoop or Spark, so much easier than message passing alternatives
by willtim 10y ago
If OO is a better fit for parallel programming, why are functional programming models such as Hadoop or Spark, so much easier than message passing alternatives such as MPI? My answer is that they bring abstraction and composition, which classical OO does not easily allow, thanks to mutable state.
- chubot 10y agoI think the key point is it's not either/or. The post I linked was saying that you can use a functional ARCHITECTURE (immutable data, explicit dependencies like monads) inside an OO language. Hadoop is written in an OO language -- Java. But it has a functional architecture (MapReduce). So really the two camps aren't that far apart. They both have something to bring to the table. Opponents of OOP are thinking of all the spaghetti imperative code with globals dressed up as classes, which people have realized is a mistake, but there's still hundreds of millions of lines of code out there like that. And there are tons of "frameworks" which actually FORCE you to write in that style. But yeah there is no real contradiction that I see. Thinking that you can write a for loop to update a hash table is as big a mistake as writing spaghetti objects.