Live data from Hacker News

Why OO Sucks by Joe Armstrong (2000)

cs.otago.ac.nz

391–396 of 396 posts

Re: Why OO Sucks by Joe Armstrong (2000)

#391

Earlier quoted context omitted.

none of my coworkers use it This sounds like the root of your problem. If you want to do FP, and none of your coworkers want to do FP, then your problem isn't really the language. If you're in a Java shop, maybe start by evangelizing FP rather than a totally different language/platform? It's possible to do FP in Java, and (IMO) it ends up pretty reasonable. But it's not the default habit for J Random Java Programmer,…

Sure, but as John Carmack has said, if the compiler allows something, it will end up in the codebase once it gets sufficiently large. I work for a brand-name big company (I won't mention it here but I'll tell you if you email me) that hires incredibly talented engineers that are a lot smarter than me. The codebase I work on is around ~20 million lines of Java, and I've seen stuff in there that is so incredibly gross…

That loop is totally fine. I wrote it many times in C#, C and C++, and I saw it many more times in other people’s code.

Microsoft DDK sample: https://github.com/Microsoft/Windows-driver-samples/blob/mas...

Microsoft MediaFoundation sample: https://github.com/Microsoft/Windows-classic-samples/blob/ma...

OpenSSL: https://github.com/openssl/openssl/blob/master/crypto/sha/sh...

And many others.

Just because code looks unfamiliar doesn’t mean it’s something wrong with the code.

Re: Why OO Sucks by Joe Armstrong (2000)

#392
post #43

I think this article is quite old, so I can forgive the author for being out of touch with modern OO language practices. Nonetheless, I find myself disagreeing with almost all of his arguments. When he talks about state for example, I assume he means mutable state. Everyone knows this is best avoided if possible. The vast majority of OO languages provide mechanisms to avoid mutability e.g. data classes or keywords to…

> He also rails against private state specifically. I assume again that he means private mutable state. This is generally a bad idea and is accepted pretty uncontroversially as a bad idea. Here's a program that has some mutable state. Do you want that mutable state to be private or public? Do you want anybody to be able to change it, or do you want all changes to have to go through public methods? Given that there ar…

Sorry, I realise on reading that that my response makes it sound like I'm an opponent of making mutable state private. I totally agree with you, what I was trying to say was that mutable state in general is considered as something to be avoided if possible, however, if it is necessary it should be hidden i.e. made private

Re: Why OO Sucks by Joe Armstrong (2000)

#393
post #43

I think this article is quite old, so I can forgive the author for being out of touch with modern OO language practices. Nonetheless, I find myself disagreeing with almost all of his arguments. When he talks about state for example, I assume he means mutable state. Everyone knows this is best avoided if possible. The vast majority of OO languages provide mechanisms to avoid mutability e.g. data classes or keywords to…

> Everyone knows this is best avoided if possible. The vast majority of OO languages provide mechanisms to avoid mutability e.g. data classes or keywords to make references constant. Well, clearly not everyone knows it. My biggest complaint about languages that incorporate functional features is that immutability is most useful when it’s the 99% use case. When it’s a special tag that may or may not be used within the…

Yes, I agree, I don't understand why modern languages don't make references immutable by default. The best I've seen is symmetry between val and var. Talking about safe defaults, I remember being very disappointed when Jetbrains changed the default scope in Kotlin to be public....

Re: Why OO Sucks by Joe Armstrong (2000)

#394
post #43

I think this article is quite old, so I can forgive the author for being out of touch with modern OO language practices. Nonetheless, I find myself disagreeing with almost all of his arguments. When he talks about state for example, I assume he means mutable state. Everyone knows this is best avoided if possible. The vast majority of OO languages provide mechanisms to avoid mutability e.g. data classes or keywords to…

> basic interface that all entities conform to e.g. being able to ask an entity to provide a hash code, or to carry out a comparison check with some other entity What do you do with values that can't be meaningfully hashed/compared? Java is the only place I've come across this odd idea that everything is hashable, and I've never thought of it as a positive thing.

Well, the problem with a value not having a corresponding hash is that it can't be used in any code that relies upon it having a hash. E.g. in Java, there are many hash based data structures that work for any object as they all have hashes. Even if there is no meaningful hash, by default the memory address can be used. This may mean you don't gain the performance benefits of a hash based data structure, but at least it is compatible with the type system.

Re: Why OO Sucks by Joe Armstrong (2000)

#395
post #49
post #43

I think this article is quite old, so I can forgive the author for being out of touch with modern OO language practices. Nonetheless, I find myself disagreeing with almost all of his arguments. When he talks about state for example, I assume he means mutable state. Everyone knows this is best avoided if possible. The vast majority of OO languages provide mechanisms to avoid mutability e.g. data classes or keywords to…

> provide mechanisms to avoid mutability e.g. data classes or keywords to make references constant. So, functional programming? > guarantees some sort of basic interface that all entities conform to e.g. being able to ask an entity to provide a hash code, or to carry out a comparison check with some other entity. Isn't that terrible? You want to provide a generic interface to calculate a hash or perform comparison: N…

You can represent 'primitives' as objects at compile time and treat them as primitives at runtime. Kotlin does this for example.

Re: Why OO Sucks by Joe Armstrong (2000)

#396

Earlier quoted context omitted.

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…

Actually, I said: "I invented the term "object-oriented", and I didn't have C++ in mind".

In other comments here I explain why "object-oriented" was a too quick and bad choice for what I thought I was doing ...

Post reply on HN