top | item 29679060

(no title)

Zalastax | 4 years ago

My view on 2 is that you get into a quite different mindset when you program actors, compared to objects. For starters, since each actor is scheduled separately, it becomes routine to not assume too much about the internal state of the actor. So you won't see many getters + setters in Erlang, for example. You also need to structure your program to not communicate unnecessarily, since communication may fail and requires you to wait for the other actor to reply. This makes you to think about what state should belong to which actor. It is quite subtle and is best seen by experiencing it, but I think the programs turn out quite different, and in my view better. Actors are not perfect for everything but to me they are what object oriented programming should have been.

discuss

order

mwattsun|4 years ago

I realized additionally is that Armstrong has other complaints about OOP like inheritance. What I said above in that classes and functions are like a self-contained programs with structs and functions. I wasn't considering inheritance, but once you start inheriting it gets murky:

Joe Armstrong: Because the problem with object-oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle

But some of his other complaints don't feel as right to me:

http://harmful.cat-v.org/software/OO_programming/why_oo_suck...

I do love the implementation of Erlang and the reliability. I think it would fun to try actors and see if it changes how I view software engineering. I bet it would.