Page 1 of 6

Authoritative Viewpoints on OOP

Posted: Wed Jun 24, 2015 11:39 am
by TI-994A
Being an oft-requested feature for PureBasic, here are some thoughts on the object-oriented programming model by three respected authorities on the subject, vindicating the Fantaisie Team's decision not to implement it as a sound and practical one.

Bravo to the team!

An excerpt from a blog post by Eric Lippert, Principal Developer of Microsoft C#
What I sometimes see when I interview people and review code is symptoms of a disease I call Object Happiness. Object Happy people feel the need to apply principles of OO design to small, trivial, throwaway projects. They invest lots of unnecessary time making pure virtual abstract base classes -- writing programs where IFoos talk to IBars but there is only one implementation of each interface! I suspect that early exposure to OO design principles divorced from any practical context that motivates those principles leads to object happiness. People come away as OO True Believers rather than OO pragmatists. Hopefully the co-op program shocks them out of it, but better to not get Happy in the first place.
An excerpt from an interview with Rich Hickey, Developer of Clojure
When we drop down to the algorithm level, I think OO can seriously thwart reuse. In particular, the use of objects to represent simple informational data is almost criminal in its generation of per-piece-of-information micro-languages, i.e. the class methods, versus far more powerful, declarative, and generic methods like relational algebra. Inventing a class with its own interface to hold a piece of information is like inventing a new language to write every short story. This is anti-reuse, and, I think, results in an explosion of code in typical OO applications.

That said, I certainly was a fan of C++ in the day, and five more years of it cured me of that. The complexity is stunning. It failed as the library language it purported to be, due to lack of GC, in my opinion, and static typing failed to keep large OO systems from becoming wretched balls of mud.
An excerpt from an interview with Joe Armstrong, Principal Designer of Erlang
I think the lack of reusability comes in object-oriented languages, not in functional languages. Because the problem with object-oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.

If you have referentially transparent code, if you have pure functions - all the data comes in its input arguments and everything goes out and leaves no state behind - it's incredibly reusable.

Programmers have been conned into using all these different programming languages and they've been conned into not using easy ways to connect programs together.

There must be big commercial interests for whom it is very desirable that stuff won't work together. It creates thousands of jobs for consultants. And thousands of tools to solve problems that shouldn't exist. Problems that were solved years ago.
Don't believe the hype! :wink:

Re: Authoritative Viewpoints on OOP

Posted: Wed Jun 24, 2015 11:54 am
by Dude
Image

Re: Authoritative Viewpoints on OOP

Posted: Wed Jun 24, 2015 12:44 pm
by Julian
Image

Re: Authoritative Viewpoints on OOP

Posted: Wed Jun 24, 2015 12:47 pm
by TI-994A
Image

Spot on! :lol:

Re: Authoritative Viewpoints on OOP

Posted: Wed Jun 24, 2015 1:42 pm
by HanPBF
But, there's no reason not to have polymorphy:
add(*ContainerGadget, *TextboxGadget)
add(*ContainerGadget, *ButtonGadget)
add(*DBXYZ, *TableABC)
etc.

What I must do today is
add_ContainerGadget_TextboxGadget(*ContainerGadget, *TextboxGadget)
etc.
if I want to have my own implementation for different types.

Currently, for the above given cases, I use a type in the structure and build up a key for a map to find the implementation.

The map is about 5 times slower than the direct call.
But as PB runs at lightspeed...

The compiler can not do this when You allow dynamic dispatch.
So, for PB the implementation can only respect one type (which must be cast before, if You want to call ancestors implementation).
But, I think that's not a big problem.

OOP is designed for non-programmer control of software.

Posted: Wed Jun 24, 2015 5:07 pm
by heartbone
TI-994A wrote:Being an oft-requested feature for PureBasic, here are some thoughts on the object-oriented programming model by three respected authorities on the subject, vindicating the Fantaisie Team's decision not to implement it as a sound and practical one.

Bravo to the team!

An excerpt from an interview with Rich Hickey, Developer of Clojure
That said, I certainly was a fan of C++ in the day, and five more years of it cured me of that. The complexity is stunning. It failed as the library language it purported to be, due to lack of GC, in my opinion, and static typing failed to keep large OO systems from becoming wretched balls of mud.
Don't believe the hype! :wink:
This is an excellent thread and presentation TI. Thanks.

There are only two ways to set a binary switch.
All that software programs can do are to set these digital switches.
How much support is necessary to create a comfort level to properly flip these boolean switches is a personal preference.

I truly feel sorry for the multitude of victims who've had their minds warped by the object oriented paradigms used in university academic programs.
Such a waste of intellect.

Re: Authoritative Viewpoints on OOP

Posted: Wed Jun 24, 2015 5:24 pm
by TI-994A
HanPBF wrote:But, there's no reason not to have polymorphy:
add(*ContainerGadget, *TextboxGadget)
add(*ContainerGadget, *ButtonGadget)
add(*DBXYZ, *TableABC)
etc.

What I must do today is
add_ContainerGadget_TextboxGadget(*ContainerGadget, *TextboxGadget)
etc.
if I want to have my own implementation for different types.
Hi HanPBF. Since your add() function only takes pointers as parameters, why do you need to create separate implementations?
heartbone wrote:I truly feel sorry for the multitude of victims who've had their minds warped by the object oriented paradigms used in university academic programs.
I appreciate your kind comments. Glad you like it. :)

Re: OOP is designed for non-programmer control of software.

Posted: Wed Jun 24, 2015 7:58 pm
by coder14
heartbone wrote:This is an excellent thread and presentation TI. Thanks.
I agree 100%. I always felt that I missed out on OOP, but not anymore. Thank you for clearing it up.

Edit: enjoyed the picture too - very funny. :lol:

Re: Authoritative Viewpoints on OOP

Posted: Wed Jun 24, 2015 10:12 pm
by the.weavster
TI-994A wrote:Being an oft-requested feature for PureBasic, here are some thoughts on the object-oriented programming model by three respected authorities on the subject, vindicating the Fantaisie Team's decision not to implement it as a sound and practical one.
In this context I'm guessing "respected authorities" means anybody that agrees with you.

Surprise, surprise TI-994A doesn't like OOP.

Re: Authoritative Viewpoints on OOP

Posted: Wed Jun 24, 2015 11:39 pm
by Tenaja
I like Niklaus Wirth's opinion:
Many people tend to look at programming styles and languages like religions: if you belong to one, you cannot belong to others. But this analogy is another fallacy. It is maintained for commercial reasons only. Object-oriented programming (OOP) solidly rests on the principles and concepts of traditional procedural programming (PP). OOP has not added a single novel concept, but it emphasizes two concepts much more strongly that was done with procedural programming.
Takeaway: Use the tool that suits you, your project, and your customer.

Re: Authoritative Viewpoints on OOP

Posted: Thu Jun 25, 2015 12:40 am
by skywalk
The same can be said for Data Normalisation. Taken to the extremes(4th or 5th normal form), you have quite a crazy relational database to query and support.
The developer should know when it's best to get off the "ideal train" and deliver.
OOP can help or hinder.
Best line from above is asking for a banana, but carrying gorilla and jungle.

Re: Authoritative Viewpoints on OOP

Posted: Thu Jun 25, 2015 12:43 am
by Samuel
Many people tend to look at programming styles and languages like religions: if you belong to one, you cannot belong to others. But this analogy is another fallacy.
I agree with this completely. There is no good reason why someone shouldn't learn and use as many languages as they possibly can.
If you know several languages you can use whichever one is best suited for your current project. Besides one trick ponies get old fast.

Re: Authoritative Viewpoints on OOP

Posted: Thu Jun 25, 2015 3:39 am
by sancho2
TI-994A wrote:vindicating the Fantaisie Team's decision not to implement it as a sound and practical one.
An excerpt from a blog post by Eric Lippert, Principal Developer of Microsoft C#
What I sometimes see when I interview people and review code is symptoms of a disease I call Object Happiness. Object Happy people feel the need to apply principles of OO design to small, trivial, throwaway projects. They invest lots of unnecessary time making pure virtual abstract base classes -- writing programs where IFoos talk to IBars but there is only one implementation of each interface! I suspect that early exposure to OO design principles divorced from any practical context that motivates those principles leads to object happiness. People come away as OO True Believers rather than OO pragmatists. Hopefully the co-op program shocks them out of it, but better to not get Happy in the first place.
When you first posted quotes from this man, I checked him out. As the C# guy I couldn't understand why he would dis oop. So I figured the quote is probably taken out of context. And it is.
The following is a link to the entire blog post where he talks about oop being an non-practical or unwise programming concept to teach to new programmers.
You have taken his quote out of context, to make it seem as though he is negative towards oop at any level. That is just wrong.
http://blogs.msdn.com/b/ericlippert/arc ... ected=true

Re: Authoritative Viewpoints on OOP

Posted: Thu Jun 25, 2015 5:50 am
by Samuel
Nice find, sancho2. :D

For those of you who don't want to read the entire blog. Here are the two paragraphs right before the one TI-994A took out of context.
Which brings me to my second point -- why do we have OO principles in the first place? Not because they are cool, I hope. Rather, because OOP is a style of programming which emphasizes encapsulation, abstraction, contracts, information hiding, extension through inheritance, etc, etc, etc. These are things which help in the design and implementation of large scale software.

Super. That's goodness for me -- I work on systems like that. But in an introductory course in computer science, typically the students are working on small, simple programs by themselves. OO languages are not necessarily good pedagogically at the introductory level.

What I sometimes see when I interview people and review code is symptoms of a disease I call Object Happiness. Object Happy people feel the need to apply principles of OO design to small, trivial, throwaway projects. They invest lots of unnecessary time making pure virtual abstract base classes -- writing programs where IFoos talk to IBars but there is only one implementation of each interface! I suspect that early exposure to OO design principles divorced from any practical context that motivates those principles leads to object happiness. People come away as OO True Believers rather than OO pragmatists. Hopefully the co-op program shocks them out of it, but better to not get Happy in the first place.

Re: Authoritative Viewpoints on OOP

Posted: Thu Jun 25, 2015 7:55 am
by HanPBF
Hi TI-994A,

my examples where a little bit to short.
Of course, the pointers are 'typed' as pointers to structures.

It's about procedure overloading.
http://www.purebasic.fr/english/viewtop ... verloading



Some words to OOP.

What You learn when You first see JAVA is:
123.+(456) // o.k., it's scala...
The object 456 is added to 123.

It's single dispatch, and is in function syntax style:
+(123, 456)
But only the first argument is used to find the implementation.
(s. CLOS for multiple dispatch).

And the real problem is:
- this is seen as the one and only truth by OOP fans
- the class hierarchy of course is a tree structure; and that's the biggest problem

Compare Your folders in Win/Linux/OSX explorer vs. tagging (cintanotes, tag cloud).

So, for me OOP is meanwhile an all and nothing term.
Important is to let the compiler help You as much as it can while Your are developping.