What is wrong with OOP?
spomacguy at gmail.com
Wed Nov 2 16:31:41 UTC 2022
There is a lot of discussion in this thread about the video:
Some items I quickly pulled out are:
- I think the speaker tried to make too strong a point. If he had stuck to "OO Programming isn't the universal solution to all problems", I think his point would be readily accepted. But he reached too far, and tried to make his more general argument "OO is the wrong solution to nearly all problems". But to argue that point, he had to argue against a made-up and limited notion of what OOP is - he made a strawman argument.
- Regardless of how right or wrong the anti-OOP stance may be, I think it is very healthy to have the entire paradigm publicly challenged like this. I think OOP carries a lot of value, but it causes problems when left unchecked. So, it's actually refreshing to hear that good software is written without obsessing over perfectly encapsulating every bit of data in the program.
I've not watched the video, but based on the comments, I think the problem the writer is complaining about has more to do with OOP absolutists who say that it must be OOP or the highway and you must use all the OOP bits. Omnis OOP has been referred to as OOOP (Omnis Object Oriented Programming) because it's not a complete implementation of classic OOP. He apparently makes his arguments that his other way should always be used, which is also an absolutist position.
Just from the title of the two videos, they are clickbait. Overstate the problem using hyperbole so people will come watch it. A lot of the articles on Medium and other sites do this so you'll read the article and they get clicks.
As for the spaghetti code, you can have it in OOP as well. The key is to use Doug Easterbrook's mantra "blue code is good code, black code is bad code". What that means is that the more you can put in common routines that are inherited by child objects/tables/windows, the better off you will be. If the same thing is done in 2 different places, use common code. Refactor whenever you need to instead of writing new code that is almost the same. Add optional parameters or whatever you need to make the code work in multiple situations. Also, don't try to make something reusable too soon. Unless you know you will be calling it from multiple places. Wait until the second time you need the function, then refactor it... by then you will know more about what needs to occur. Oftentimes people will try to pack everything into an object the first time and make it unnecessarily complex before they really know how it will be used.
If you have things in "blue" code, it has been tested in multiple situations. If there is a fix to be made, you can fix in only one location. Of course, if you introduce a bug, it's now a bug everywhere. But that's better than having multiple different bugs in different locations. If you break it, it breaks spectacularly everywhere, but when you fix it, it's fixed everywhere.
Another way of putting it, (I think it was Walt Venable) is that "blue code is tested code, black code is untested code." Of course, both of the quotes are hyperbole, as I've accused the writer of, but they make the point.
Other authors will tell you that all programming should be "functional programming" and that anyone that doesn't do it his way is an idiot. But that's another discussion.
Software is often more an art than a science, but we want to more of a science, where possible.
Hope that helps.
> On Nov 2, 2022, at 3:08 AM, Martin Obongita via omnisdev-en <omnisdev-en at lists.omnis-dev.com> wrote:
> Hi Friends,
> Today, I woke up to a bad start.
> In my Youtube linefeed, I found 2 fairlyold videos of why OOP is bad:
> 1. Object-OrientedProgramming is Bad By Brial Will
> 2. What’s wrong with OOP by Roberto Sasso
> Being a curious cat, I watched them in full.
> I know that this topic of, which is abetter programming paradigm, has been discussed over and over again.
> But, could an old-timer, experienced in thefield, give me hope that Omnis still is a better OOP tool?
> Of much interest to me is how OOP resolves “spaghetticode” that’s common in procedural code.
> I am also still a curious "cat" to know if there is any incentive to move over to procedural.
> Martin Obongita.
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
spomacguy at gmail.com
More information about the omnisdev-en