Objects vs Processes

First, listen to Joe Armstrong talk about processes…
(32m14s in)

I suppose when you put it like that - it makes total sense. But the funny thing is when OOP was first explained to me I thought that made perfect sense :043:

Does anyone else feel like they are being torn between universes? :lol: It’s actually a fascinatingly new experience for me!

But back to the topic - do you think in processes?


This might get long-winded… Joe makes some incredibly valid points. Like you, when I first learned OOP, it made perfect sense to me. But does it? If you have a bike object, does it make sense that it has a method called bike.ride() on it? Or does it make more sense that an action is HAPPENENING to it like ride(bike)?

In a hotel reservation system, does it make sense that a customer is being modeled like this: customer.check_in()? Or does it make more sense that something is being done to the customer like check_in(customer)?

I had always struggled with the mental model of having a model with actions on it even though I have been in OOP languages for 16 years. It ALWAYS made more sense that something gets done to a model than a object(model) taking action. At the time I learned OOP I knew it “didn’t feel right” but I continued to model my program in such a way where an object gets “injected” (in a loose way) into another object and the model is actually what “takes an action” instead of an action being done to it because that’s how I learned you are supposed to do it. I believe this is the part that Joe is referring to that “defies the law of physics”. Does it makes sense to inject a car rental object into a reservation object so the customer can reserve a car? Or does it make more sense for the reservation process to send a message to the car rental process to reserve a car? I would even go as far to say that OOP is a failed model. Actually, let me rephrase… OOP without message passing is a failed model.

When I talk to programmers and they say that OOP fits their mental model better than functional programming, the first thing you have to ask yourself is if they are saying that because it’s true? Or are they saying that because the only paradigm they have learned is OOP and it’s all they know? By definition, you have try more than one thing to know if it is a better fit for you :slight_smile:


Great post @Korbin73. It certainly makes sense to say you want to ride a (bike) or check_in a (customer).

I also agree that sometimes OOP didn’t feel quite right :confused: particularly in the way you describe, but often times it did (especially for newbies). For example:

user = Person.new('Aston', 'South Wales')
user.name # Aston
user.location # South Wales

I am definitely going to revisit this thread once I have learned the language :icon_biggrin:

1 Like

@AstonJ you might enjoy this post :lol:

Erlang is the most object oriented language


And if you program it in NodeJS, your brain will melt!


In the PHP/Java world, you most definitely need a getter and setter for (almost) every one of those properties, or you are violating the OOP directive. I think this is what Rich Hickey means when he complains about OOP “ceremony” - it is an utter waste of time. Then you get into object reflection when you need to write tests or deal with a broken/leaky interface, and then it really starts to feel as if you are doing something fundamentally wrong. OOP never really made sense to me, but everyone was doing it, so I had to follow along in my work.


@AstonJ curious to hear your thoughts about objects vs processes at this point in time :slight_smile:

1 Like

Funnily enough @Exadra37 posted a snippet about processes in our Programming Erlang book club on DT a few days ago which I think is a good way to look at them :smiley:

(The whole thread may be worth a read if you are interested in Erlang, Joe, or the book :003:)