Live data from Hacker News

Joe Armstrong: Why OO Sucks

harmful.cat-v.org

211–220 of 267 posts

Re: Joe Armstrong: Why OO Sucks

#211

Earlier quoted context omitted.

Turing machines have mutable state. The lambda calculus does not. Yet any algorithm which can be expressed by one can also be expressed by the other. We have proof that state is merely an implementation detail, which happens to be widespread in today's hardware because we figured out how to implement it at scale. Programmers need to understand the difference between the abstract algorithm they're trying to express an…

State is an implementation detail to today's hardware And yesterday's hadware And the day before that And pretty long time, frankly - do you see a pattern here? And it does have its deep reasons. Programming is not about algorithms. It's about making inanimate matter behave. CS might be about algorithms, but CS is not programming.

Your hard-line stance is a little bit too far IMHO. That inanimate matter programming is all about manipulating also has no notion of objects or object orientation... or (for the most part) methods, fields, functions, procedures, arrays, modules, encapsulation, interfaces, garbage collection, databases ... and so on and so on. All that abstraction exists to make programming easier for humans to grok, and for teams to deliver some "useful work".

To borrow from Robin Milner, who worked on ML: "Types are the leaven of computer programming; they make it digestible." All that abstraction makes programming more digestible, or more palatable. Functional programming is just some more abstraction to make it more digestible. To say that it's a redefinition of programming is just a distraction, since programming has already been redefined.

Also, you're right that CS isn't programming, and viewed in a certain light one could argue CS is basically just a branch of math. But on the other hand, programming without CS really wouldn't be that useful. It's just not a helpful distinction to make in this way.

Re: Joe Armstrong: Why OO Sucks

#212

Earlier quoted context omitted.

>Immutable data objects and all the stuff are not the basics of programming. They never were. Unless you single-handedly redefine the meaning of "programming". Immutability was considered to be more fundamental when I took my first programming course at MIT. I received a very good education. We, of course, eventually moved onto objects with mutable, but they were definitely considered to be more dangerous and less fu…

It means the course wasn't about programming. Maybe it was misnamed or maybe you approximate its real title. Me, not really interested in what people who never wrote any widely used software consider more what and less what. Programming is what happens (and always happened) on top of computing devices that have, you know, memory, registers and opcodes. It's just the hard truth. That's what programming is. Writing cod…

>It means the course wasn't about programming. Maybe it was misnamed or maybe you approximate its real title.

Oops, my mistake. I took you for a serious poster, not a troll.

The class I took at MIT (SICP) and the textbook that was used are world-famous, and it was certainly a programming class.

As to having "never written any widely used software": Among other things, I wrote the software that was used to configure a NASA space telescope (Rossi X-ray Timing Explorer), from which about 1,000 peer-reviewed astronomy papers were published. I've worked on brain surgery software (3D Slicer) and now I work on software used for doing RNA Interference-based cancer research.

But I guess you've made your point: All that is just "Computer Science" noodling, not real programming. So, sure don't listen to what I say.

Re: Joe Armstrong: Why OO Sucks

#213
post #150

So I have very limited experience with FP, and a reasonable amount with OO (mostly dynamically typed). I can really see the benefits of FP, but there are some problems I have trouble modelling with FP. For instance, if I have a simple 2D rendering engine, I just want to say "add this object to the screen". The object might be a geometric primitive (square, circle, etc.), it might be generated particles, or it might b…

I encourage you to read Philip Wadler's essay The Expression Problem, which addressed precisely the dilemma you point out: http://www.daimi.au.dk/~madst/tool/papers/expression.txt In brief, if you think of data types are rows, and behaviors as columns, the question is how to extend either the rows or the columns naturally. In your example, it is easy to add a new row (datatype) – create a Triangle class which impleme…

Thanks for the sources - will sit down and read them later.

The row, column analogy is pretty apt - it's an interesting way of looking at things.

While it is true that adding a new behaviour in OOP is a pain in the ass, I definitely find myself adding new datatypes far more frequently than adding new behaviours for an interface.

Isn't adding a lot of new behaviours to data typically a sign than the interface is bloated and is now dealing with too many things?

Re: Joe Armstrong: Why OO Sucks

#214

Earlier quoted context omitted.

It means the course wasn't about programming. Maybe it was misnamed or maybe you approximate its real title. Me, not really interested in what people who never wrote any widely used software consider more what and less what. Programming is what happens (and always happened) on top of computing devices that have, you know, memory, registers and opcodes. It's just the hard truth. That's what programming is. Writing cod…

> It means the course wasn't about programming. Parent of your comment might have been talking the Structure and Interpretation of Computer Programs. Likely it needs no introduction, but it is absolutely about programming, and goes right down the rabbit-hole to implementing interpreters, virtual register machines, and a compiler for said machine. Yes, the first couple of chapters is mostly purely functional, but that…

Yes, the class was SICP. I can't say enough good things about how it influenced my still-forming mind. I went to MIT because I wanted to study black holes and neutron stars, and after this class, I learned that there was something even cooler than that!

Re: Joe Armstrong: Why OO Sucks

#215
post #168
post #150

So I have very limited experience with FP, and a reasonable amount with OO (mostly dynamically typed). I can really see the benefits of FP, but there are some problems I have trouble modelling with FP. For instance, if I have a simple 2D rendering engine, I just want to say "add this object to the screen". The object might be a geometric primitive (square, circle, etc.), it might be generated particles, or it might b…

To attach behaviour to data in a functional language, you typically use first-class functions. Your draw function would look for a function in each drawable object and call it. To your second question: find some great open source projects and read their code.

The problem with open source projects is that great != popular.

There are certainly a lot of very successful projects that have painfully unmaintainable code that still get maintained because so many people are invested.

And the problem with great open source projects is that they'll only show you how they did their problem right - but seeing how to do it wrong and _why_ it's wrong is typically a more useful process.

I think it's generally easier to avoid doing bad things you understand the problem with than try to write excellent code by blindly following patterns that you assume are good because someone well known uses them.

Re: Joe Armstrong: Why OO Sucks

#216
post #185
post #36

Earlier quoted context omitted.

The problem is that OO thinking tends to inflate systems, spreading code all over the place even though it logically belongs in one place and adding object wrappers to things that don't need it. In my experience taking over Python code written by Java developers, I can usually shrink their OO code and make it more reliable by refactoring it into conceptually equivalent functional code wherever it makes sense and fall…

If you trying to write FP in Python - you're in trouble. (Python is my main language for several years) It does not have "mandatory OOP" but it remains as mainly imperative OO-language with some FP-goodness. C# is the same, Java - not.

If you try to do your entire program as pure FP then I guess that is true, but it's often possible and beneficial to do a lot of the work in a functional style.

Honestly though, this misses the point. If your language forces you to use an unsuitable paradigm, it's time to use another language if you can.

Re: Joe Armstrong: Why OO Sucks

#217

"Reason 2 - It was thought to make code reuse easier. I see no evidence of 1 and 2." https://rubygems.org/stats

Code reuse works at the library level, not the individual object level. You're not exactly fishing an object out of a worldwide sea of classes there.

Actually, immutability can code reuse pretty easy, but many OO systems make no effort to encourage that (one reason Python is not my favorite language).

Re: Joe Armstrong: Why OO Sucks

#218
post #178

Earlier quoted context omitted.

Coming off conceited doesn't make him wrong regarding CS curriculum. He believes that people should have strong underpinnings in functional programming principles before learning oop. I think fp plays off required math classes pretty well. Consider function composition which is commonly taught in required pre-calc courses. f(x) = ...... f(g(x)) = ...... I will submit that first-class functions map more directly to fu…

Okay, but CS is not programming. After all, programming is not CS. And by the way, I don't think anybody should first know anything before learning how to program. Programming is like breathing. Do you need to study anything before you breathe? No you don't! So anybody who argues that you should learn all sorts of not useful things before having the privilege of trying useful things, is a strange person indeed to me.

Programming is not like breathing.

Re: Joe Armstrong: Why OO Sucks

#219
post #9

I don't get it. If people don't like OO, why don't they just not use it. Just use your favorite methodology to get the job done. Why do they have to bad mouth it?

We, the software development professionals, have learned some things about the properties of OO techniques and should share that knowledge.

People use OO as a way to attack good design and defend junk. Here is an example:

> We believe bound method references are harmful because they detract from the simplicity of the Java programming language and the pervasively object-oriented character of the APIs.

From here:

http://java.sun.com/docs/white/delegates.html

Re: Joe Armstrong: Why OO Sucks

#220
Author does not understand OO, or argues against strawman OO:

> In an OOPL I have to choose some base object in which I will define the ubiquitous data structure, all other objects that want to use this data structure must inherit this object.

Post reply on HN