Live data from Hacker News

Why OO Sucks by Joe Armstrong (2000)

cs.otago.ac.nz

201–210 of 396 posts

Re: Why OO Sucks by Joe Armstrong (2000)

#201
post #65

Earlier quoted context omitted.

I don't think what I'm about to say is necessarily inherently true, but it reflects how things seem to work in practice: It seems to me that part of the problem is that OO doesn't force you to have discipline and/or without constant vigilance (which product owners are never willing to schedule for) the system inevitably gets out of control over time. On the other hand, it seems to me that the core principles of funct…

I wish more languages would let you do stuff like mark reference parameters to methods as unable to be changed or reassigned within the method, get a readonly reference to a list without having to make a copy, that sort of thing. It doesn't have to be forced, just give me the option so I can get a guarantee on something if I want to.

Like the 'const' parameter in Free Pascal/Delphi: http://wiki.freepascal.org/Const#Const_Parameter

Re: Why OO Sucks by Joe Armstrong (2000)

#202
post #95
post #80

Earlier quoted context omitted.

The important thing is restricting your public interface, hiding implementation details, and thinking about how easy your code (and code that uses it) will be to change later. It's not an OO vs anything thing. When you want a value from a module/object/function/whatever, whether or not it's fetched from a location in memory is an implementation detail. Java and co provide a short syntax for exposing that implementati…

I don’t think I’ve ever seen a useful “Getter” abstraction...

HTTP GET :-)

Re: Why OO Sucks by Joe Armstrong (2000)

#203

> I think this is a fundamental error since functions and data structures belong in totally different worlds. This is my biggest issue with the article. Blurring the boundary between program and data is one of the core principles at the heart of computer science, and was crucial to the works of Turing, Church, et al, that birthed computer science as a field.

That's an interesting observation, however this discussion is at an abstraction level far removed from those basic concepts. No one is arguing whether OOP can be compiled into logic instructions that are better or worse than some other programming paradigm, we've got that figured out. We know how to convert just about any system of organizing data and functions into the billions of individual transactions that a CPU has to make to execute that program. Copying a byte value from one place into a register, interpreting another byte as an instruction and the next byte as the address for the result and the next as a hardware switch... These are the concepts Turing and Von Neumann figured out, but they're irrelevant to the modern day question of how to organize thousands or millions of lines of code to minimize errors and maximize understanding and efficiency.

In fact, the OOP question isn't as much about science and technology as it is a social question concerning the best way to organize logic and information as a profession. What's the best way to make sure programmers don't screw things up? Is it to make sure the most incompetent developer can be somewhat productive with simple concepts, or are those simplified concepts inherently flawed? Or is it somewhere in the middle?

Re: Why OO Sucks by Joe Armstrong (2000)

#204
post #65

Earlier quoted context omitted.

I wish more languages would let you do stuff like mark reference parameters to methods as unable to be changed or reassigned within the method, get a readonly reference to a list without having to make a copy, that sort of thing. It doesn't have to be forced, just give me the option so I can get a guarantee on something if I want to.

If you mark all fields and variables in Java as final , you get pretty much this experience? If I could go back in time and unilaterally make one change to Java, it would be to make `final` default. But if you just get in the habit of using it (the IDE helps), non-final variables look broken. And once objects have all-final fields, immutability just starts spreading upward in your code.

I’m a bit surprised they haven’t copied Scala’s case class, where you get immutable fields by default and helpers to copy with updated fields, along with a sane hash and equality implementation. Making immutability easier than the alternative makes a huge difference in practice.

Re: Why OO Sucks by Joe Armstrong (2000)

#205
To me OOP is complex and complexity is the enemy of writing good code.

Also simplicity is relative.

Most of us like OOP because we have learned it and invested time in it and most probably defined by it.

Re: Why OO Sucks by Joe Armstrong (2000)

#207
post #94
post #72

Earlier quoted context omitted.

Admittedly I'm somewhat of a FP fanboy, but I seriously cannot disagree with you more on this. Functional Programming (and Logic Programming) are better than other paradigms because, unlike Java (or C++, or C#...) there is an emphasis on correctness , and the people working on FP compilers (like Haskell and Idris) are utilizing mathematics to do this. No idea on your opinion on mathematics, but to me Math/Logic reign…

> How about having to create six different files Took me a few reads but it's better stated "six different classes". At first I was confused about why you rely on `java.io.File` for business logic. So, if I'm stuck on JVM, what's my FP alternative that compiles and runs comparatively? Clojure? Scala?

Scala. Particularly Scala 3.

Because it is principled but also very pragmatic.

Re: Why OO Sucks by Joe Armstrong (2000)

#208

Earlier quoted context omitted.

The basic situation is this. We often have a situation in which N operations contain M cases (for M different types). Without OOP, we have the ugly organization of writing N functions that each dispatch M cases of code by pattern matching or switching on a numeric type field or whatever. OOP lets us break these pieces of logic into separate methods. And then in the physical organizationof the program, we can group th…

Well yeah, that's the expression problem[0]. With OOP I can add a new datatype easily, but when I want to extend the behavior of that type I now need to go to M different places. With a functional style I only need to do one. You're open on types but closed over behaviors. Functional styles are the opposite. In some sense, I would even go as far as saying the idealized 'UNIX philosophy' is a degenerate example of thi…

That's why you need typeclasses like in Haskell or Scala. And then you can be open on behaviors and types at the same time.

Re: Why OO Sucks by Joe Armstrong (2000)

#209
post #65

Earlier quoted context omitted.

I wish more languages would let you do stuff like mark reference parameters to methods as unable to be changed or reassigned within the method, get a readonly reference to a list without having to make a copy, that sort of thing. It doesn't have to be forced, just give me the option so I can get a guarantee on something if I want to.

If you mark all fields and variables in Java as final , you get pretty much this experience? If I could go back in time and unilaterally make one change to Java, it would be to make `final` default. But if you just get in the habit of using it (the IDE helps), non-final variables look broken. And once objects have all-final fields, immutability just starts spreading upward in your code.

Unfortunately unlike C++ etc constness doesn't propagate inside objects marked final. So

    final List x = new ArrayList()
stops x being reassigned but does nothing to stop the downstream code from mutating the contents of the list.

Re: Why OO Sucks by Joe Armstrong (2000)

#210
post #68

Earlier quoted context omitted.

When I was a tutor (TA) at university (collage) here in aus, I marked assignments from my students. We used an automated test suite to check correctness. I went over each assignment to subjectively assess code style. I would open the first assignment which scored full marks with the test suite and find it was a clean 500 line long implementation. Full marks. The next submission also got full marks, but it did it by s…

I think this is mostly a reflection of the thing Java/C#/C++ have popularized as “OOP”: if one uses Common Lisp’s CLOS, much of the boilerplate associated with “design patterns” and OO architecture evaporates.

Yes absolutely. The article was written around 2000 when Java was the new sexy thing. When Joe talks about OOP being overhyped, he wasn’t talking about Rust’s traits or Common Lisp. He’s speaking about the hype around Java and C++, and the then-lauded three pillars of OO: Encapsulation, Inheritance and Polymorphism.

Not all OO works that way. In retrospect, inheritance was probably a mistake. And as far as I can tell, modern “OO-lite” coding styles focussing on composition over inheritance work pretty well. Alan Kay: “When I invented object oriented programming, C++ was not what I had in mind.”

Post reply on HN