What’s Wrong with OOP and FP

Don x at nospam.com
Thu Nov 14 01:37:20 PST 2013


On Tuesday, 12 November 2013 at 12:19:56 UTC, Paulo Pinto wrote:
> On Tuesday, 12 November 2013 at 11:27:51 UTC, Jonathan M Davis 
> wrote:
>> On Tuesday, November 12, 2013 12:09:23 
>> =?UTF-8?B?Ikx1w61z?=.Marques
>> <luis at luismarques.eu>@puremagic.com wrote:
>>> I think you will be pleased with the argument, given D's
>>> philosophy:
>>> 
>>>     https://yinwang0.wordpress.com/2013/11/09/oop-fp/
>>
>> Yeah. Both OO and functional programming are useful, but 
>> trying to use any one
>> paradigm exclusively always ends up contorting things. To make 
>> this clean, you
>> really need to be able to mix and match paradigms as 
>> appropriate.
>>
>> On a related note, a classic blog post that I quite like on 
>> how Java takes OO
>> too far is
>>
>> http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html
>
> If Java takes OO too far, what to say about Smalltalk and 
> derivatives?

Well, Smalltalk and friends are truly Object oriented, as opposed 
to C++/Java/D etc which are Class oriented. So it is a little 
different.

But something I've been wondering for years - is there a solid 
rebuttal anywhere to Stepanov's criticism of OOP? He takes the 
extreme position that (class oriented) OOP is useless. Surely 
that can't be right, but...

It's trivial to find good procedural code. It's trivial to find 
good generic code. It's trivial to find good functional code.
But finding top-quality OOP code is extremely difficult. Eg, the 
code in the GoF Design Patterns book is widely criticised.

I just can't escape the feeling that class-based runtime 
polyphorphism is almost never an ideal solution, and that most of 
the benefits and success of OOP languages comes from things other 
than OOP itself. And I think it's because OOP is philosophically 
nonsense -- in the real world, similarities between things are 
everywhere, but almost none of them are is-A relationships.

>
>>
>> The balanced approach that C++ and D take is definitely the 
>> better one IMHO
>> (and D tends to do it better IMHO, since it better supports 
>> functional
>> programming than C++ does, meaning that you end up with fewer 
>> FP solutions in
>> C++ even when they'd be appropriate).
>>
>> - Jonathan M Davis
>
>
> The future belongs to multi-paradigm languages, I would say.
>
> What I miss still in languages like D, is the Hindley–Milner 
> type inference,
> algebraic data types and pattern matching.
>
> --
> Paulo



More information about the Digitalmars-d mailing list