Live data from Hacker News

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

news.ycombinator.com

61–70 of 234 posts

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

#61

Many systems people want to build with computers cannot be easily conceptualised as graphs of largely self-contained objects, interacting through swapping messages. These problems instead revolve around complex data processing, and are more easily conceptualised as data flowing through a network of functions, and into and out of containers. It is possible to build these systems using OO, by reifying the network of fu…

> I suspect in 100 years, if humans are still doing any programming, all popular languages will be mixed-paradigm

What makes you think we'll need to wait that long? C#, C++, JavaScript, Java, Swift, Kotlin, Dart, Scala, Python, and Ruby all have objects, methods, polymorphism, first-class functions, lambdas, closures, and higher-order functions.

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

#62

People just don't have enough experience with Functional Programming to really know how awful it is. So now it is the new kid on the block (in terms of going mainstream) so people think it is the best thing ever. The most telling sign is how many FP languages are in existence today. If it was such a good thing we wouldn't need them all. It is a mess that cause many other types of problems without any clear benefit. I…

We don’t have more FP languages than OOP languages, and several languages that are considered FP have their own implementation of OOP (OCaml, Common Lisp...) in addition, several OOP languages are now implementing classic FP features like lambdas and pattern matching.

Also, the question asked doesn’t actually care about FP. Go isn’t a functional language, bit neither is it OO.

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

#63
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…

You have some good points. But have you tried Idris or Agda?

My problem with OO is one of culture. If and only if you work with big codebases you start to feel that you can’t make assumptions about anything. For all I know the plus operator can send nukes. Then they say it doesn’t matter because they made the perfect lasagna with a million layers.

I know there’s a million ways to code with oo to make it better. But I never saw that enforced by tools which is a must if we are a thousand developers in the same company.

Meanwhile if I see a concept in Haskell I can in most cases just trust the assumptions.

Also the compiler researchers that I adore are those that focus on making proofs and stable code, not the ones trying to dumb down programming to make it accessible.

You build a house, which is more important, a good foundation (built on math) or accessibility for the beginner builders?

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

#64
post #21

Depending on who you ask, "trend" could be replaced with "progression". I'm with you in that I never really found the OOP style to mesh well with my brain. I always felt like I had to fight it and dealing with massive chains of class inheritance can make it really hard to reason about and change code. I've spent years building web apps with Python and Ruby too. Having only spent a short while with Elixir, I'm finding…

I don't have a huge social circle but in it among the professional devs I am the sole person for whom OOP style does not mesh well with their brain.

I've known most of these folks since the '80s and something that we've discussed a few times is wondering if it's when we got serious about computers, what platform (e.g. C64 or Apple II), or continuous employment in the field (I have a history of going off to do other things most of my dev friends have always been devs), preferred platform today (mostly WinTel vs. Linux), or the niche we work in (I mostly work in embedded stuff, lots of my friends work with stuff related to pretty big systems, either big back end stuff or user facing I/O).

Anyway I find the recent popularity of alternative styles to a welcome recurring innovation, especially the idea of having a "Functional Core with an Imperative Shell".

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

#65

Maybe because traditional OOP is already well represented by popular languages with large ecosystems? Creators of new languages want to do something new. There is Elixir / Erlang which many consider to stick more closely to the original idea of OOP.

Agreed. There is definitely a problem where most people think OOP = Java. But, if you think a bit more abstractly you find that Erlang is a much better OOP while being famous for being so very functional. Also, you get bits like http://wiki.c2.com/?ClosuresAndObjectsAreEquivalent

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

#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.

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

#67

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…

I disagree with it being OO when it doesn’t have inheritance. No classes or class hierarkies, no passing things along to children. Seems very different than what those who invented OO had in mind.

Structs with functions attached is easy, and not entirely uncommon in procedural and even functional languages.

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

#68
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…

pure fashion

pun intended?

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

#69

People just don't have enough experience with Functional Programming to really know how awful it is. So now it is the new kid on the block (in terms of going mainstream) so people think it is the best thing ever. The most telling sign is how many FP languages are in existence today. If it was such a good thing we wouldn't need them all. It is a mess that cause many other types of problems without any clear benefit. I…

> The most telling sign is how many FP languages are in existence today. If it was such a good thing we wouldn't need them all.

This is a silly argument. FP means only first-class functions and immutable values, and the vast majority of FP languages agree on those.

But there are many other design decisions for a programming language - type system, laziness, purity, homoiconicity, and whatever other features, paradigms or constraints people might find desirable. THIS is what explains the diversity of FP languages.

Btw, there's the exact same phenomenon in OOP languages. They all agree on classes, and differ on hundreds of other aspects.

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

#70
post #62

People just don't have enough experience with Functional Programming to really know how awful it is. So now it is the new kid on the block (in terms of going mainstream) so people think it is the best thing ever. The most telling sign is how many FP languages are in existence today. If it was such a good thing we wouldn't need them all. It is a mess that cause many other types of problems without any clear benefit. I…

We don’t have more FP languages than OOP languages, and several languages that are considered FP have their own implementation of OOP (OCaml, Common Lisp...) in addition, several OOP languages are now implementing classic FP features like lambdas and pattern matching. Also, the question asked doesn’t actually care about FP. Go isn’t a functional language, bit neither is it OO.

You are right, it should have been a comment to another person on this thread. Not the OP.

My point regarding the number of FP languages that it is not a silver bullet, neither is OOP to be sure, but FP has its own set of problems hence the many different implementations.

Regarding OOP languages implementing classic FP features, which is true and a blessing! These are good features which IMHO gives more credit to OOP languages.

Post reply on HN