Object-Oriented Programming Is Bad?

Talk about anything
SOTE
Posts: 784
Joined: 15 Jun 2015, 06:21

Object-Oriented Programming Is Bad?

17 Nov 2018, 16:04

Brian Will argues that programmers are being led astray and explains why he feels Object-Oriented Programming is bad.

https://youtu.be/QM1iUe6IofM (Object-Oriented Programming is Bad)

Brian does more than just talk to talk, he tears apart OOP code and gives examples of what's wrong with what many programmers are doing.

https://youtu.be/IRTfhkiAqPw (Object-Oriented Programming is Embarrassing: 4 Short Examples)
guest3456
Posts: 2661
Joined: 09 Oct 2013, 10:31

Re: Object-Oriented Programming Is Bad?

19 Nov 2018, 11:01

interesting thanks

i've always thought that it was unnecessary and added bulk when it was not needed

but people can mis-use most any thing. there are probably cases where OOP is better, and also cases where OOP shouldn't be used

SOTE
Posts: 784
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

18 Jan 2019, 00:27

Yegor Bugayenko - What's Wrong with Object-Oriented Programming?
(https://www.youtube.com/watch?v=GMrjuuczZkQ)

Goes into detail about why famous programmers and scientists are calling OOP out and calling it a mess. Gives specifics about what is being done wrong.
User avatar
jeeswg
Posts: 6825
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Object-Oriented Programming Is Bad?

20 Jan 2019, 02:26

- Thanks, the Brian Will videos are classic.
- The Yegor Bugayenko video is interesting, he argues that OOP fails by its own standards.
- But it reminds me of the question that: to dismantle or fix OOP, you must first agree what it is.
- I would like some videos, short or long, that most people agree correctly sum up the nature of OOP, both the ideal nature and the real nature.
- But my first inklings re. OOP hit on something far simpler and more fundamental. That people are doing something hard but unnecessary. Here, Casey Muratori, who is a very interesting speaker on all sorts of subjects, gives a good explanation of what I call (and what the person that wrote to him calls) the 'OOP mindset':
Handmade Hero | Getting rid of the OOP mindset - YouTube
https://www.youtube.com/watch?v=GKYCA3UsmrU#t=112
[1:52 to 2:41]
I want the computer to put a red dot here, how do I do that?
[versus]
Oh do I need to abstract the concept of a screen, and red, should red be an object that, oh what is this, is a pixel an object or is it a group of objects, is there a container, do I have to ask a factory to get me a color and that color is red.
- I mentioned that video in this post also:
object classes: coding style - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=48938&p=219679#p219679

- Generally speaking you don't need OOP in AutoHotkey, there isn't a scenario where it's really needed, or more specifically: if you removed the OOP there would be no disadvantages, and possibly several advantages. People are welcome to argue against that.
- So the problem I saw with 'OOP types', people that overuse OOP, is simply that they complicate things unnecessarily. I've tried to understand why they do this, and so far I have two reasons.
- (1) Familiarity: they have been exposed to a lot of OOP, and they are less aware of the degree to which they are overcomplicating things. It would be good if every time they used OOP, a little voice inside their head said: 'OOP might not be necessary, OOP might be a bad idea, you are using OOP therefore you are overcomplicating things'.
- (2) The joy of OOP: in situations where I have dabbled with OOP, it adds a new challenge to programming, quite different from everything else I've done. I could well imagine some naive programmers thinking as they program in OOP: 'this is difficult, this is real programming', but difficult does not mean useful, beneficial, necessary or wise.
- It's interesting to do an Internet search for: OOP considered harmful.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
SOTE
Posts: 784
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

20 Jan 2019, 03:17

jeeswg wrote:
20 Jan 2019, 02:26
- But my first inklings re. OOP hit on something far simpler and more fundamental. That people are doing something hard but unnecessary. Here, Casey Muratori, who is a very interesting speaker on all sorts of subjects, gives a good explanation of what I call (and what the person that wrote to him calls) the 'OOP mindset':
Handmade Hero | Getting rid of the OOP mindset - YouTube
https://www.youtube.com/watch?v=GKYCA3UsmrU#t=112

- Generally speaking you don't need OOP in AutoHotkey, there isn't a scenario where it's really needed, or more specifically: if you removed the OOP there would be no disadvantages, and possibly several advantages. People are welcome to argue against that.
- So the problem I saw with 'OOP types', people that overuse OOP, is simply that they complicate things unnecessarily. I've tried to understand why they do this, and so far I have two reasons.
- (1) Familiarity: they have been exposed to a lot of OOP, and they are less aware of the degree to which they are overcomplicating things. It would be good if every time they used OOP, a little voice inside their head said: 'OOP might not be necessary, OOP might be a bad idea, you are using OOP therefore you are overcomplicating things'.
- (2) The joy of OOP: in situations where I have dabbled with OOP, it adds a new challenge to programming, quite different from everything else I've done. I could well imagine some naive programmers thinking as they program in OOP: 'this is difficult, this is real programming', but difficult does not mean useful, beneficial, necessary or wise.
- It's interesting to do an Internet search for: OOP considered harmful.
More that is quotable from him, "What does the computer need to do to solve the problem that you have?" "Write that as simply as possible, and that is the foundation of coding." Stated from 1:25 of the video.
(Handmade Hero | Getting rid of the OOP mindset- https://youtu.be/GKYCA3UsmrU?t=85)
Another nice keeper phrase he threw out there, "Compression Oriented".

I've learned the importance of the KISS (Keep It Simple Stupid) principle a long time ago via hard experience (to include outside of the programming world). Sometimes we can overthink a problem or over-engineer something, that results in a big mess. It's often better to see if a simpler way works first, before going to the more complicated and difficult. It's not to say the answer will always be simple, but that it's often better to check if it is first, before going up the ladder to the more difficult. That's one of the great aspects of the AutoHotkey language, where arguably simplicity and ease of use is at it's core, which makes it a great tool. It's a kind of programming language "do over", where it can correct the errors and compensate for the difficulties of the language it's written from.

OOP does have its place, put it's clearly not the "be all and end all" answer to everything in programming. Brian Will's videos opens up the eyes to being cautious about how to apply OOP and in thinking about a programming solution. I find the debate fascinating, because it goes into how to approach and look at the problem, before you start coding. It gets into the organizational structures and perspectives, and then the code is a reflection of such thought processes.
User avatar
SL5
Posts: 861
Joined: 12 May 2015, 02:10
GitHub: sl5net
Contact:

Re: Object-Oriented Programming Is Bad?

20 Jan 2019, 03:51

jeeswg wrote:
20 Jan 2019, 02:26
... That people are doing something hard but unnecessary. Here, Casey Muratori, who is a very interesting speaker on all sorts of subjects, gives a good explanation of what I call (and what the person that wrote to him calls) the 'OOP mindset':
Handmade Hero | Getting rid of the OOP mindset - YouTube
https://www.youtube.com/watch?v=GKYCA3UsmrU#t=112
[1:52 to 2:41]
I want the computer to put a red dot here, how do I do that?
[versus]
Oh do I need to abstract the concept of a screen, and red, should red be an object that, oh what is this, is a pixel an object or is it a group of objects, is there a container, do I have to ask a factory to get me a color and that color is red.
... if you removed the OOP there would be no disadvantages, and possibly several advantages. People are welcome to argue against that.
- So the problem I saw with 'OOP types', people that overuse OOP, is simply that they complicate things unnecessarily.
yes the first goal must be that it is understandably. I want to introduce another player here.

or as SOTE said:
SOTE wrote:
20 Jan 2019, 03:17
..."Write that as simply as possible, and that is the foundation of coding." Stated from 1:25 of the video.
(Handmade Hero | Getting rid of the OOP mindset- https://youtu.be/GKYCA3UsmrU?t=85) ...
Sometimes I was already annoyed that I did not write something in a class right from the beginning. if it gets bigger and bigger, classes are sometimes a practical possibility.

writing in kotlin
fun main(args : Arra...
is producing
class MainKt..
The compiler created a class and the free functions is static methods of that class.
(examples are from here: https://fabiomsr.github.io/from-java-to-kotlin/functions.html
jeeswg wrote:
20 Jan 2019, 02:26
... I could well imagine some naive programmers thinking as they program in OOP: 'this is difficult, this is real programming', but difficult does not mean useful, beneficial, necessary or wise. ...
well said :thumbup:
SOTE
Posts: 784
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

29 Jan 2019, 04:32

Why OOP inheritance sucks

Stefan Mischook, well known programmer on YouTube, goes in on OOP and gives hints about inheritance vs interfaces

https://youtu.be/da_Rvn0au-g

The Problem With Object Oriented Programming

James King, graphically demonstrates the problem with OOP's inheritance concept, by showing a basic game design.

https://youtu.be/71qoHW-g9bc

Image

Composition vs. Inheritance

Very good explanation of the differences between them; Bottom-up approach VS Top-down approach. Solving existing small problems en route to solving the bigger problem VS trying to perfectly solve unknown and non-existent future problems. Using small chunks to create bigger chunks VS duplicating the same chunk everywhere or inability to adapt to exceptions of the rule.

https://youtu.be/dYUZiJEy0JE

Image

Composition over Inheritance

Goes into why a person should arguably choose one over the other, with graphics examples.

https://youtu.be/wfMtDGfHWpA

Image
Last edited by SOTE on 29 Jan 2019, 10:21, edited 4 times in total.
SOTE
Posts: 784
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

29 Jan 2019, 08:21

Object-Oriented Programming is Garbage

https://youtu.be/V6VP-2aIcSc

Brian Wall takes a game written using OOP and rips it apart, showing how the same game could have been written better and done procedurally.
SOTE
Posts: 784
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

31 Jan 2019, 03:50

OOP VS ECS (Entity Component System)

Image

What is an Entity Component System and Why should I care about ECS (tutorial)

From Eforen Creates, and goes into the difference between OOP and ECS

https://youtu.be/OJmVBo5HGOY


Entity Component System (1 of 3)

From Rez Bot, and compares various other approaches to OOP

https://youtu.be/5KugyHKsXLQ
User avatar
jeeswg
Posts: 6825
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Object-Oriented Programming Is Bad?

10 Mar 2019, 07:08

- The Brian Will collection:
2011 tutorial video:
Object-oriented programming (old version, watch new version instead) - YouTube
https://www.youtube.com/watch?v=rDXuPBjVfSc
2011 tutorial video (rerecorded in 2012):
Object-Oriented Programming - YouTube
https://www.youtube.com/watch?v=lbXsrHGhBAU

then the 2016 trilogy:
Object-Oriented Programming is Bad - YouTube
https://www.youtube.com/watch?v=QM1iUe6IofM
Object-Oriented Programming is Embarrassing: 4 Short Examples - YouTube
https://www.youtube.com/watch?v=IRTfhkiAqPw
Object-Oriented Programming is Garbage: 3800 SLOC example - YouTube
https://www.youtube.com/watch?v=V6VP-2aIcSc



- @SL5: Thanks.

- @SOTE: Yes, I liked the phrase 'compression-oriented' also.
- Thanks for your efforts, you've been investigating this issue quite thoroughly.
- The recent videos you added were all good choices. Thanks, not everyone is a good selector, a rare gift!
Why OOP inheritance sucks [Stefan Mischook]
The Problem With Object Oriented Programming [Jamie King]
Component Design Pattern for Games [Jamie King] [2nd part]
Composition vs. Inheritance [Source Decoded]
Composition over Inheritance [Fun Fun Function]
Object-Oriented Programming is Garbage: 3800 SLOC example [Brian Will]
UECS0 : What is an Entity Component System and Why should I care about ECS [Eforen Creates]
Entity Component System #1 [Rez Bot]

- Stefan Mischook is classic. For someone so measured and mainstream, it's telling that even he creates a video called 'Why OOP inheritance sucks'. He's too sensible not to notice the flaws of OOP. One wonders if he *really* wanted to say 'Why OOP sucks'.
- Jamie King/Source Decoded/Fun Fun Function, uh oh handle the enemy/platypus/murder robot dog (and banana-gorilla-jungle problem).
- The platypus/murder robot dog examples really highlight the problem of OOP and inheritance, the whole thing becomes a mess instantly.
- Jamie King's smart alec comments were hilarious.
- The Eforen Creates/Rez Bot/Brian Will videos were pretty good also.
- The Source Decoded/Rez Bot/Brian Will videos were surprisingly engaging for their length.

- Brian Will's video highlights how OOP pushes you to do ugly things.

- I feel that all the videos apart from the Brian Will video are heading towards the solution I use.
- In AHK, I just use an array (or struct) to store values (data), and for methods: I either store booleans (or a type name) to indicate which functions can/can't be used, or I store references to functions.
- In OOP they love to talk about separating things for ideological reasons, well what about the big one? Separating functions from data.

- The point that comes across in the videos is that single inheritance generally doesn't work for real-world problems.
- You get what I'd call a 'Christmas tree structure', and a 'tree shuffle problem' where any change shuffles everything underneath, instantly creating a giant mess.

- I would describe the best approach not as top-down, but bottom-up.
- I could call it: 'all you can eat', 'pick 'n' mix' or 'smorgasbord'.
- I.e. there are various values or functions that your array/struct can store, you look around at all the choices, and you pick the ones you want.

- The problem with standard OOP thinking is that top-down appears to be the more common paradigm, whereas bottom-up is perhaps the more useful paradigm.
- The other problem is that single inheritance is prevalent, and multiple inheritance is rare, this appears to be a fundamental flaw, a fatal flaw perhaps.

- In this video, Uncle Bob says that Java doesn't have multiple inheritance because the Java team were too lazy to add it. And that other languages like C# inherited (no pun intended) this problem. And that they created interfaces as a horrible hack.
- The diamond problem is cited as an excuse for this choice.
Bob Martin SOLID Principles of Object Oriented and Agile Design - YouTube
https://www.youtube.com/watch?v=TMuno5RZNeE#t=41m30
41:30-42:23
- I view the diamond problem as something of a canard. Not having multiple inheritance available is far more (magnitudes more) of a problem than the diamond problem.
- In this video, Uncle Bob mentions the false claim of 'we're protecting you programmers from yourselves'.
Robert C Martin - Clean Architecture and Design - YouTube
https://www.youtube.com/watch?v=Nsjsiz2A9mg#t=19m00
19:00-20:41
- Cheers.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
SOTE
Posts: 784
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

12 Mar 2019, 07:25

jeeswg wrote:
10 Mar 2019, 07:08

- In AHK, I just use an array (or struct) to store values (data), and for methods: I either store booleans (or a type name) to indicate which functions can/can't be used, or I store references to functions.
- In OOP they love to talk about separating things for ideological reasons, well what about the big one? Separating functions from data.
It's like confusing nouns with verbs, and creating a mess. In "traditional" C and Pascal, they understood to keep data and functions separate from each other. Passing data between variables or assigning a struct to another struct (C), makes sense. You are not confusing the issue, but when you mix functions with data, then that's where unnecessary trouble appears to start.
- The point that comes across in the videos is that single inheritance generally doesn't work for real-world problems.
- You get what I'd call a 'Christmas tree structure', and a 'tree shuffle problem' where any change shuffles everything underneath, instantly creating a giant mess.

- I would describe the best approach not as top-down, but bottom-up.
- I could call it: 'all you can eat', 'pick 'n' mix' or 'smorgasbord'.
- I.e. there are various values or functions that your array/struct can store, you look around at all the choices, and you pick the ones you want.

- The problem with standard OOP thinking is that top-down appears to be the more common paradigm, whereas bottom-up is perhaps the more useful paradigm.
- The other problem is that single inheritance is prevalent, and multiple inheritance is rare, this appears to be a fundamental flaw, a fatal flaw perhaps.
A "building block" approach often works better. Where you can pick and choose which blocks that you need. Build, test, then add another block, test, then add another, test... Which can be referred to as "composition" or "component" oriented programming. Where with top-down, the mistake is thinking you can perfectly plan out a complex program from the beginning, where everything is inherited from a "god" block. Then you get stuck when things don't go as plan, or blocks of code need to "talk" with each other and go horizontal, as oppose to send data to the top and back down (vertical). Now encapsulation and inheritance is broken, resulting in a mess, and the programmer is stuck with a "philosophical dilemma" of trying to maintain the OOP paradigm. A paradigm he shouldn't feel obliged to stick to, as if it was the only one to use.

And OOP is not something intuitive, nor is it anything the computer understands, as it's reduced to machine code. When a person is starting out in programming, they are usually creating small programs or blocks of code that then can be added together to create larger programs. At the point that their programs become very large, and they are more experienced, then they will usually see redundant code that they can eliminate. Like instead of putting the same code in multiple places, they use a single subroutine or function, that other sections in their program call. This is something sometimes referred to as "compression oriented programming", and is arguably a more common sense approach. But that is not mixing data and functions together into an odd glop of code that they must owe allegiance to, and must only communicate with other code glops in a certain way.


- In this video, Uncle Bob says that Java doesn't have multiple inheritance because the Java team were too lazy to add it. And that other languages like C# inherited (no pun intended) this problem. And that they created interfaces as a horrible hack.
- The diamond problem is cited as an excuse for this choice.
Bob Martin SOLID Principles of Object Oriented and Agile Design - YouTube
https://www.youtube.com/watch?v=TMuno5RZNeE#t=41m30
41:30-42:23
- I view the diamond problem as something of a canard. Not having multiple inheritance available is far more (magnitudes more) of a problem than the diamond problem.
- In this video, Uncle Bob mentions the false claim of 'we're protecting you programmers from yourselves'.
Robert C Martin - Clean Architecture and Design - YouTube
https://www.youtube.com/watch?v=Nsjsiz2A9mg#t=19m00
19:00-20:41
- Cheers.
Uncle Bob does some very good and informative videos.
User avatar
jeeswg
Posts: 6825
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Object-Oriented Programming Is Bad?

12 Mar 2019, 07:53

- Earlier today, I found perhaps the best ever article on the problems of OOP:
Why bad scientific code beats code following "best practices"
http://yosefk.com/blog/why-bad-scientific-code-beats-code-following-best-practices.html
- Further discussion here:
Why bad scientific code beats code following “best practices” (2014) | Hacker News
https://news.ycombinator.com/item?id=12377385

- @SOTE: Yes, I like these terms 'composition-oriented programming' and 'component-oriented programming', something repeated in the videos, it does sound pretty similar to my viewpoint.
- 'Building block' is a good term. To add to my 3 terms, I could also have said 'buffet'.
- I also like the term 'compression-oriented programming', however, I'm not currently sure of the full details and thus to what extent it matches my views.
- Just like OOP, Agile, or indeed any philosophy, it can be hard to pin down exactly what people mean by something.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Offtopic”

Who is online

Users browsing this forum: genaro, Spikea and 4 guests