Most active commenters
  • 9rx(4)
  • igouy(3)

←back to thread

873 points belter | 17 comments | | HN request time: 0.657s | source | bottom
1. gorjusborg ◴[] No.42947212[source]
No, objects aren't generally 'good', unless you think keeping multiple state machines in sync is 'good'.

OO is not evil, but it also shouldn't be your default solution to everything.

Also, who is this person? I immediately distrust someone who calls themselves 'a pretty cool guy'. That's for the rest of us to decide.

replies(4): >>42948148 #>>42948743 #>>42949044 #>>42949626 #
2. Insanity ◴[] No.42948148[source]
I had a different read of that point. More along the lines of “don’t throw the baby out with the bath water” (might have butchered that saying?).

I’m also more in the FP camp - even wrote a book on the topic of FP. But I also acknowledge OO is not inherently a bad choice for a project, and many languages nowadays do exist along a spectrum of OO and FP rather than being strictly one of the other.

To me a benefit for OO might be the ubiquity - you can generally assume people will understand an OO codebase if they have done a few years of coding. With more strict FP that is just not a given - even if people took a Haskell course in Uni a decade ago :).

replies(1): >>42948249 #
3. latexr ◴[] No.42948249[source]
> More along the lines of “don’t throw the baby out with the bath water” (might have butchered that saying?).

No, you got it right.

https://en.wikipedia.org/wiki/Don't_throw_the_baby_out_with_...

> even wrote a book on the topic of FP.

Care to share? If not, that’s fine.

replies(1): >>42948607 #
4. Insanity ◴[] No.42948607{3}[source]
Sure, “Functional Programming in Go”, this is the Amazon link: https://a.co/d/htv3BOu
5. karmakaze ◴[] No.42948743[source]
The way I like to use OO (usually not real OO, but rather class-based languages) is to minimize its mutable state. Often mutability is merely a lack of using builder patterns. Some state can be useful as long as it's easy and makes sense to globally reset or control. It's like writing a process as a construction of monads before any data is passed into it. Similarly a tree of processing objects can be assembled before running it on the input.
replies(1): >>42949465 #
6. naasking ◴[] No.42949044[source]
> No, objects aren't generally 'good', unless you think keeping multiple state machines in sync is 'good'.

Sure, if you disregard good object design, like the single responsibility principle and using mutability only when really needed.

7. patrickmay ◴[] No.42949465[source]
Exactly. Automatically adding getters and (especially) setters to a class is something I see far too often.
replies(2): >>42950996 #>>42962149 #
8. 9rx ◴[] No.42949626[source]
> OO is not evil, but it also shouldn't be your default solution to everything.

With Smalltalk and Objective-C both being effectively dead at this point, that really only leaves Ruby (and arguably Erlang) as the only languages that are able to express OO. And neither of those languages are terribly popular either. Chances are it won't be your default solution, even if you want it to be.

replies(2): >>42952253 #>>42953983 #
9. MajimasEyepatch ◴[] No.42950996{3}[source]
I begrudgingly have had to enter the world of Spring Boot over the last couple years, and this drives me nuts. Every damn thing needs getters and setters so that the ten thousand magic Spring annotations can mutate things all over the place. If the business logic is complex, I try to make immutable domain models separate from the models that have to interact with Spring, but that can require a lot of boilerplate.
10. igouy ◴[] No.42952253[source]
J ... J ... Java.
replies(1): >>42952374 #
11. 9rx ◴[] No.42952374{3}[source]
Patrick Naughton came from the Smalltalk world, so Java is definitely inspired by Smalltalk, but he didn't bring along the oriented bits. Its object model is a lot closer to C++'s. To have objects does not imply orientation.
replies(1): >>42956726 #
12. lcnPylGDnU4H9OF ◴[] No.42953983[source]
> and arguably Erlang

Curious about your case for this. I don't know a lot about Erlang other than "it's what Elixir is based on" or whatever technical jargon is more accurate. I thought it was functional.

replies(1): >>42956297 #
13. 9rx ◴[] No.42956297{3}[source]
> Curious about your case for this.

I was mostly riffing on the time Joe Armstrong, creator of Erlang, said that Erlang might be the only object-oriented language in existence. Although he's not exactly wrong, is he?

> I thought it was functional.

I think that is reasonable. Objects, describing encapsulation of data, are what define functional. Without encapsulation, you merely have procedural. Of course, that still does not imply the objects are oriented...

For that you need message passing. But Erlang has message passing too! So there is a good case to be made that is object-oriented.

14. igouy ◴[] No.42956726{4}[source]
“When I use a word,” Humpty Dumpty said in rather a scornful tone, “it means just what I choose it to mean—neither more nor less.”
replies(1): >>42966557 #
15. gorjusborg ◴[] No.42962149{3}[source]
Agree on both of your takes.

I've probably written more Java than any other programming language during my career, and I've seen both good and bad ways of writing Java.

Bad java heavily uses lots of inheritance, seems to think little about minimizing exposed state, and (unrelated to this discussion) uses lots techniques I like to call 'hidden coupling' (where there are dependencies, but you can't see them through code, as there is runtime magic hooking things up).

Good java almost never uses inheritance (instead composes shared pieces to create variation on a theme), prevents mutability wherever possible, and makes any coupling explicit for all to see.

Good java still has classes and objects, but starts to look pretty 'functional'.

16. 9rx ◴[] No.42966557{5}[source]
"I made up the term object-oriented, and I can tell you I did not have C++ in mind.", said Alan Kay.
replies(1): >>42992257 #
17. igouy ◴[] No.42992257{6}[source]
That was the easy laughter set-up line. The follow-up seemed to confound the audience.

What was the follow-up?