Object-Oriented Programming Is Bad?

Talk about anything
SOTE
Posts: 1426
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.

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.

Object-Oriented Programming is Embarrassing: 4 Short Examples
Last edited by SOTE on 27 Jan 2020, 20:40, edited 2 times in total.
guest3456
Posts: 3454
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: 1426
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

18 Jan 2019, 00:27

Yegor explains his ideas on properly implementing OOP. 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, and how to fix it. But is the cure (for what ails OOP) worse than the disease?

Yegor Bugayenko - What's Wrong with Object-Oriented Programming?
Last edited by SOTE on 27 Jan 2020, 22:04, edited 4 times in total.
User avatar
jeeswg
Posts: 6902
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: 1426
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
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


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.
Last edited by SOTE on 27 Jan 2020, 21:07, edited 3 times in total.
User avatar
SL5
Posts: 879
Joined: 12 May 2015, 02:10
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: 1426
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

29 Jan 2019, 04:32

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

Why OOP inheritance sucks


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

The Problem With Object Oriented Programming


Image

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.

Composition vs. Inheritance


Image

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

Composition over Inheritance


Image
Last edited by SOTE on 27 Jan 2020, 20:46, edited 5 times in total.
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

29 Jan 2019, 08:21

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.

Object-Oriented Programming is Garbage
Last edited by SOTE on 27 Jan 2020, 20:50, edited 1 time in total.
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

31 Jan 2019, 03:50

OOP VS ECS (Entity Component System)

Image

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

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


From Rez Bot, and compares various other approaches to OOP

Entity Component System (1 of 3)
Last edited by SOTE on 27 Jan 2020, 20:49, edited 1 time in total.
User avatar
jeeswg
Posts: 6902
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: 1426
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: 6902
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
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

24 Nov 2019, 06:01

OOP is the Root of All Evil - Jeff Ward
guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: Object-Oriented Programming Is Bad?

15 Dec 2019, 11:15

SOTE wrote:
29 Jan 2019, 04:32
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

Composition over Inheritance
Goes into why a person should arguably choose one over the other, with graphics examples.
https://youtu.be/wfMtDGfHWpA
excellent links, thanks! seems related to functional programming as well.

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

Re: Object-Oriented Programming Is Bad?

27 Jan 2020, 20:28

Here, Jack Diederich demonstrates how things can be taken too far under the OOP paradigm. It might be a little hard for those not familiar with Python code to follow along, but the point is the concepts and issues involved. Writing more precise and easy to follow code, versus unnecessary fluff.

Stop Writing Classes - Jack Diederich
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

19 Jun 2020, 20:45

The Go Programming Language And Its Rebellion Against Classes And Standard OOP


Go was created by some of the best programming minds in the world (in addition to being backed by Google); Robert Griesemer, Rob Pike, and Ken Thompson. And that is thee Ken Thompson, who helped create the C programming language. So their criticisms and "rebellion" against standard OOP should not be taken lightly. Go also consistently hovers around and breaks into the top 10 of programming languages used. Lastly, in many situations, Go can be used to replace or compete head to head with the likes of C++, C#, Java, and Rust.

Note- Go is arguably not the only rebel. There is of course hybrid languages like Object Pascal and JavaScript, others that have done OOP a bit differently like Eiffel, and Functional Programming languages. But it's noteworthy for more clearly and adamantly rejecting how standard OOP goes about it's 3 main pillars: Polymorphism, Encapsulation, and Inheritance.

A list of reasons why the Go programming languages has broken away from standard OOP and doesn't uses Classes:

1) Greater readability of programs.

2) Simplicity over complexity.

3) Creates easier to maintain code.

4) Standard OOP is harder to debug.

5) Doesn't use inheritance. Prefers composition over inheritance.

6) Methods are assigned to Types versus Classes. Those Types can be embedded into other Types, creating Composition.

7) Programmers should be delivering solutions, not excessive lines of code.

8) Pompous attitudes over creating complex or convoluted solutions is a disservice to companies, customers, and programming in general.

9) Convoluted OOP code is not a slick way to create job security and could mean not getting promoted or fired anyway.

Some great Go videos that explains this point of view and more:

The Why of Go


The Go Language: What Makes it Different?
guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: Object-Oriented Programming Is Bad?

11 Jul 2020, 08:14

first video didn't explain that point of view at all, hardly any mention of OOP
second video is more on topic

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

Re: Object-Oriented Programming Is Bad?

14 Aug 2021, 05:32

Highly experienced polyglot JavaScript programmer (Shai UI) puts the hammer down on Class-based OOP. "Complexity doesn't mean it's better." "Less is more."

I don't like Object Oriented Programming (OOP) 1/2


I don't like Object Oriented Programming (OOP) 2/2
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Object-Oriented Programming Is Bad?

19 Jan 2022, 16:57

The famous game programmer (Braid, The Witness...) Jonathan Blow (Joe Blow), gives his thoughts on OOP (is referring to Class-based OOP not simpler structs or objects).

"...but that's not actually solving the problem, it's just conforming to a belief structure that you have been given."

Where did software go wrong?

Return to “Off-topic Discussion”

Who is online

Users browsing this forum: No registered users and 62 guests