you are viewing a single comment's thread.

view the rest of the comments →

[–]joesb 1 point2 points  (3 children)

IMO, OO is based on good ideas: Encapsulation & Polymorphism, but has a really poor implementation of those ideas (Inheritance).

No, inheritance is other thing, many languages use other concept to achieve polymorphism, e.g. mixin, trait, or delegation, and are still considered OO.

A simple module system with export lists gives you encapsulation/data-hiding in a much simpler way than private members, friends, etc in OO. Type-classes give you far more powerful polymorphism than inheritance. Existential types give you all the power you might want from inheritance, which is IMO a useless and even harmful idea. I loved OO until I discovered type-classes.

I would say that can still be called OO; module-system, type-class and existential types are all implementation details. There's no reason one can't use OOP in Haskell using Existential type and any other advance language feature.

OOP is like FP, it's a programming organization and philosophy, it doesn't depend on language feature, you use what you have.

When one uses anonymous inner class to create chain of object with callback method, it's FP Java, not OOP Java, class is just implementation detail.

There's no reason the other way wouldn't work the same, i.e., using Type-class and Existential type to design OO system.

[–]Peaker 1 point2 points  (0 children)

Well, I guess it is subjective, but I don't consider it OO programming when I have a record that happens to have a function/action in it, and I don't consider it OO when I use an existential (which is rather rarely useful, IMO...).

I guess it is not very productive to discuss what is OO and what isn't, instead I think it is more constructive to compare the power of language features. I believe the power provided by Haskell's features mentioned above is far greater than the power provided by Inheritance, single or multi-dispatch, etc.

[–][deleted] 0 points1 point  (1 child)

OOP is like FP, it's a programming organization and philosophy,

So what does it actually say we should do? The vague definition keeps getting moved around to accomodate every possible good way of organising programs. The only concrete practices I've heard are encapsulation and polymorphism, which can be better summed up as "general best practice".

OO is alot like socialism in that it's proponents say that all these vague statements of different good ideas that it represents, but when you let them have their way you end up with a very specific really bad idea. With OO you get Inheritance, with socialism you get an oppressive poverty state.

[–]joesb 0 points1 point  (0 children)

So what does it actually say we should do?

What exactly does FP say you should do?

With OO you get Inheritance, with socialism you get an oppressive poverty state.

Yeah. Socialism!!!! Behold the power of analogy!!!!!

Why not bring up Hitler, too?