What is wrong with OOP?

Scotte Meredith spomacguy at gmail.com
Wed Nov 2 20:31:15 UTC 2022



> On Nov 2, 2022, at 1:11 PM, Martin Obongita <martin.obongita at yahoo.com> wrote:
> 
> Your analysis is spot on.
> 
> What is Doug Easterbrook's mantra on windows and objects?

It's that "blue code is good code, black code is bad code". That means that is you have it in a parent object multiple children are using, you see it as blue code in Omnis. It's OK to override a big of code to change parameters, but it should be brief and call back with a Do Inherited. Black code is custom code you write for a specific window/table/object. Try to always call common code. And use DRY (Don't Repeat Yourself). If you do the same thing in different places, don't just copy and paste the code.

> 
> I am still not sure about the gains and losses of creating objects for every window class to process variables created in the window.

You want to try to separate the display of information from the code that manipulates the information and interacts with the database. Imagine a situation where you have a desktop app that does certain things. Then you want to create a JS Client portion so people can run it from a browser. You don't want to rewrite the code in the JS Client window and now have two similar copies of the code. Instead, have an object that does the manipulation and the window class and remote form are just displaying things. Then you have a single object doing all the control with all your business logic. ("One ring to rule them all...")


> I have seen some sample libraries process the variables in the super window class.

You can do things in the superclass window, but not a good idea to process the data in a window class. It should be in objects and/or table classes. This is often referred to as the Model-View-Contoller pattern. (https://en.wikipedia.org/wiki/Model–view–controller)


> While others do this in object class.
> 
> My library is growing big and I do not wish to cook a huge spaghetti code.
> 
> 
> 
> 
> 
> 
> On Wednesday, November 2, 2022 at 07:31:43 PM GMT+3, Scotte Meredith <spomacguy at gmail.com> wrote:
> 
> 
> There is a lot of discussion in this thread about the video:
> https://www.reddit.com/r/programming/comments/41jf45/objectoriented_programming_is_bad_brian_will/ <https://www.reddit.com/r/programming/comments/41jf45/objectoriented_programming_is_bad_brian_will/>
> 
> 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 <mailto: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 <https://lists.omnis-dev.com/>
> > Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com <mailto:omnisdev-en at lists.omnis-dev.com> 
> 
> 
> 
> Scotte Meredith
> spomacguy at gmail.com <mailto:spomacguy at gmail.com>
> 509/998-0991
> 
> 
> 
> 



Scotte Meredith
spomacguy at gmail.com
509/998-0991






More information about the omnisdev-en mailing list