AstonJ

AstonJ

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?

Showing Posts 1 to 6

Korbin73

Korbin73

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:

AstonJ

AstonJ OP

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:

sashaafm

sashaafm

uranther

uranther

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

:043:

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.

krahul3790

krahul3790

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

AstonJ

AstonJ OP

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:)

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
AstonJ
The obligatory hello world thread! Who are you and where are you from? :stuck_out_tongue:
4616 55835 594
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
matt-savvy
Is there a word for the ~> symbol used in Version strings? Do you also just call it a Squiggle Arrow™ ?!
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews