Live data from Hacker News

Ask HN: Why do new(ish) programming languages eschew OOP features?

news.ycombinator.com

181–190 of 234 posts

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#181
post #55

Earlier quoted context omitted.

Unpopular answer to the unpopular answer: OOP was pure fashion .. “Our customers wanted OO prolog so we made OO prolog” .. http://harmful.cat-v.org/software/OO_programming/why_oo_suck... .. screw things up with any idiotic "object model" crap. .. http://harmful.cat-v.org/software/c++/linus

I always figured that the main thing people really wanted out of "OO" was simply namespaces. People forget about dealing with older programming systems with global namespace (C, Matlab, Fortran, etc). Namespaces were a big step forward, and in the early days, most of the languages with them were OO, so it would be easy to mistake the benefits of namespaces for OO magic. OO crapola also mapped reasonably well onto GUI…

> simply namespaces

1980 module, Modula-2

1979? package, Ada

http://www.drdobbs.com/open-source/history-and-goals-of-modu...

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#182

IMO they just expose more of how OOP really works, giving you flexibility. Take Rust. Just because I like their pragmatic approach. They represent objects as structs with functions attached that have access to the struct data. In C++, Java, etc this is roughly how objects actually work underneath. They eliminate inheritance, replacing it with interfaces. Exposing the objects for what they really are, structs with fun…

> They eliminate inheritance, replacing it with interfaces. Exposing the objects for what they really are, structs with functions attached, makes this strategy easier.

I don't see how this is not already achievable in Java or C#. No one is forcing you to use inheritance. And when you really need it, it's there for you to use instead of jumping through hoops.

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#183
post #66

Rust, Go, Julia, Nim are all cruly braced, procedural, mutable, object oriented languages. I think we need languages that bring new paradigms. All that you quoted fail in this respect. https://www.youtube.com/watch?v=0fpDlAEQio4

Neither Go nor Rust has objects or inheritance.

> Neither Go nor Rust has objects

What's an "object" anyway? A collection of data fields bound to a method is what most people would probably consider. In which case, both golang and Rust have objects.

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#184
post #118
post #5

Unpopular answer: pure fashion. There's nothing wrong with object methods (that's 100% pure syntax vs. a function call) and an implicit "this" scope for symbols (which is just a limited form of dynamic scope[1]). They don't make code hard to understand. OO can be abused to produce bad designs, of course, but that's not an indictment of its syntax. Non-syntactic aspects are maybe a more involved discussion. For an exa…

I'll disagree with your popular answer (it's the most upvoted right now). There is a certain degree of fashion, however pure functions and immutable values make data parallelism extremely easy, almost trivial. Our hardware has almost hit the ceiling on single core performance, so easy parallelism is the way to make use of this. I do believe that object orientation as a concept has value. A lot of concepts map easily…

Purity helps a lot but it's far from making automatic parallelism trivial. See for example how few FP languages do it. Not many.

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#185
post #34
post #31

Earlier quoted context omitted.

I'm curious why you find it a breath of fresh air? The Wikipedia link in the post you're responding to specifically states that composition over inheritance is an OOP principle. If one needs to abandon OOP to make use of composition, was OOP actually what was being done or was it instead an exercise in creating an class-based taxonomy? (a lot of people seem to fall into this trap)

It's the way OOP was used from what I saw 10-20 years ago. It was all inheritance, from uni course to patterns used etc. I've only fell into composition when I got into video game development. We saw it a bit more with Silverlight but now it's such a clear movement (composition over inheritance) that it's in my resume's motto.

It's the way many OOP languages went, but it's not intrinsic to OOP.

I recall encountering Emerald in the late 1980s. Here's its 1989 paper on composition over inheritance (code reuse wise): http://www.emeraldprogramminglanguage.org/Raj_ComputerJourna...

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#186
post #55
post #5

Unpopular answer: pure fashion. There's nothing wrong with object methods (that's 100% pure syntax vs. a function call) and an implicit "this" scope for symbols (which is just a limited form of dynamic scope[1]). They don't make code hard to understand. OO can be abused to produce bad designs, of course, but that's not an indictment of its syntax. Non-syntactic aspects are maybe a more involved discussion. For an exa…

Unpopular answer to the unpopular answer: OOP was pure fashion .. “Our customers wanted OO prolog so we made OO prolog” .. http://harmful.cat-v.org/software/OO_programming/why_oo_suck... .. screw things up with any idiotic "object model" crap. .. http://harmful.cat-v.org/software/c++/linus

What surprises me is that (at least judging by job adverts) so many people still think to seem OOP is the best thing since sliced bread, as opposed to a just another tool to be approached pragmatically.

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#187
post #181

Earlier quoted context omitted.

I always figured that the main thing people really wanted out of "OO" was simply namespaces. People forget about dealing with older programming systems with global namespace (C, Matlab, Fortran, etc). Namespaces were a big step forward, and in the early days, most of the languages with them were OO, so it would be easy to mistake the benefits of namespaces for OO magic. OO crapola also mapped reasonably well onto GUI…

> simply namespaces 1980 module, Modula-2 1979? package, Ada http://www.drdobbs.com/open-source/history-and-goals-of-modu...

Not sure what this says, except that this industry remains terrible about learning from the past.

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#188
People don't agree on what OOP even is, so I don't think the question can be answered.

For example, Rust itself doesn't know if it is OOP or not: https://doc.rust-lang.org/book/ch17-01-what-is-oo.html

Go similarly doesn't know: https://golang.org/doc/faq#Is_Go_an_object-oriented_language

Nim claims to be a multi-paradigm language with full support for OOP: https://nim-lang.org/docs/tut2.html

Julia doesn't seem to discuss OOP that I could find. But if Common Lisp has long claimed and been described as supporting OOP, and Julia copying its dispatch system from Common Lisp, it similarly is in a weird place of is it OOP or not?

Bottom line... I think a lot of new and popular languages are at least partially OOP. That they are more hybrids of prior languages, that they dropped certain features and added others is normal, since they are trying to be different and distinguish themselves, but they all seem to still have enough of OOP to not be sure if they should claim to be OOP or not.

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#189

Earlier quoted context omitted.

Pure fashion? I think that's a bit much. Rust was inspired heavily by ML/Haskell/C++, which are not particularly object oriented (C++ is object friendly, not object oriented).

C++ was explicitly about adding support for OOP to C, and most modern languages that have OOP support derive from C++ in that support (often by way of Java), though there area few that remain that are directly inspired by Smalltalk without C++ as an intermediary, and a smaller number that don't come from the class-based OO family rooted in Smalltalk (JS notably, though modern JS has added class-based features.)

Sure, but adding OOP to an imperative language kind of implies it's one of many systems coexisting. Modern C++ is best described as imperative, functional, and object-oriented.

Re: Ask HN: Why do new(ish) programming languages eschew OOP features?

#190
Mostly because the way we approach OOP is wrong, and so developers - who were taught to write software as "instructions given to a machine" (i.e., procedurally) - don't fully understand the paradigm.

That leads to the belief that OOP is unnecessarily difficult.

It's more difficult to properly decompose the problem space than it is to just add code.

It really just boils down to developers being lazy and ignorant.

Post reply on HN