Authoritative Viewpoints on OOP

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
TI-994A
Addict
Addict
Posts: 2698
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Authoritative Viewpoints on OOP

Post 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:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Authoritative Viewpoints on OOP

Post by Dude »

Image
Julian
Enthusiast
Enthusiast
Posts: 276
Joined: Tue May 24, 2011 1:36 pm

Re: Authoritative Viewpoints on OOP

Post by Julian »

Image
User avatar
TI-994A
Addict
Addict
Posts: 2698
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Authoritative Viewpoints on OOP

Post by TI-994A »

Image

Spot on! :lol:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

Re: Authoritative Viewpoints on OOP

Post 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.
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

OOP is designed for non-programmer control of software.

Post 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.
Keep it BASIC.
User avatar
TI-994A
Addict
Addict
Posts: 2698
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Authoritative Viewpoints on OOP

Post 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. :)
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
coder14
Enthusiast
Enthusiast
Posts: 327
Joined: Tue Jun 21, 2011 10:39 am

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

Post 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:
User avatar
the.weavster
Addict
Addict
Posts: 1576
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: Authoritative Viewpoints on OOP

Post 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.
User avatar
Tenaja
Addict
Addict
Posts: 1959
Joined: Tue Nov 09, 2010 10:15 pm

Re: Authoritative Viewpoints on OOP

Post 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.
User avatar
skywalk
Addict
Addict
Posts: 4210
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Authoritative Viewpoints on OOP

Post 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.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Authoritative Viewpoints on OOP

Post 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.
sancho2
User
User
Posts: 44
Joined: Wed Apr 15, 2015 5:14 am

Re: Authoritative Viewpoints on OOP

Post 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
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Authoritative Viewpoints on OOP

Post 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.
HanPBF
Enthusiast
Enthusiast
Posts: 570
Joined: Fri Feb 19, 2010 3:42 am

Re: Authoritative Viewpoints on OOP

Post 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.
Post Reply