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.
Why OO Sucks by Joe Armstrong (2000)
201–210 of 396 posts
Re: Why OO Sucks by Joe Armstrong (2000)
#202Earlier 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...
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.
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)
#204Earlier 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.
Re: Why OO Sucks by Joe Armstrong (2000)
#205Also 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)
#206Both in programming and in real life haha.
Re: Why OO Sucks by Joe Armstrong (2000)
#207Earlier 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?
Because it is principled but also very pragmatic.
Re: Why OO Sucks by Joe Armstrong (2000)
#208Earlier 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…
Re: Why OO Sucks by Joe Armstrong (2000)
#209Earlier 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.
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)
#210Earlier 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.
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.”