Object Oriented Programming seems harder on the mind

If it doesn't relate to Debian, but you still want to share it, please do it here

Object Oriented Programming seems harder on the mind

Postby larienna » 2018-03-25 12:54

When Object Oriented Programming (OOP) first came out, it seems likes magic. I even said to my friend that it was much easier to code this way because you delegate all the work to classes. But my friend remained suspicious. Then later I jumped more deeply in Java and learned to do real OOP code instead of the C/C++ hybrid paradigm. Then I read some documents about Object paterns.

Now I always found object oriented programming more complicated due to the dispersion of data. Also OOP is used a lot in Event based Programming which has a complex program flow that jumps rapidly from an object to another making it very hard to follow without a debugger. You even have to make flow diagrams. Finally, the additional complexity, is that instead of trying to remember what a method requires and return, you need to remember an object's behavior and it's communication with nearby objects requiring more of your memory when you are coding.

At first, I thought that I simply lacked of experience with OOP, but now I have taken medication since almost a year, which set my mind on stun,when I try to code with OOP, I have so much brain fog that I can simply not code at all. If I was to be given a class with an expected behavior, I could probably code it. But when it's about conception of classes and determining how they interact with each other, I am brain dead. On the other hand, I don't really have trouble coding in plain C, or assembly because they are procedural paradigm.

I tried to do some research on the subject, and some long time OO programmer, has stated that they loved coding back in C and that it was actually faster than in OOP. I also found that there is a paradigm called Data Oriented Programming which tries to separate data from code. (the opposite of OOP) It seems popular in video game programming to gain speed. It looks similar to a project of mine where all the data was in the database, and the code only modify the content of the DB.

I am not sure if there are some guidelines for data Oriented programming while using an OO language like java. I was thinking it placing zero native variable in classes ( references are OK) where each class could be some kind of code module that modifies the data. Making all classes use static methods(utility class) is a solution, but it could also be possible keep a reference to a class to call their method, so that concepts like dependency inversion could be used. So keeping a certain level of modularity would be nice.

The biggest challenge is Event Based GUI programming. OOP seems like the only way to manage user interfaces (thanks to windows). The only thing I see that could be done is to auto-generate user interface based on data inside a database (ex: a list of widget with their properties).

Does some of you had similar "mind blowing" issues with OOP?
Does any of you know any good reading ( Book or Internet) about Data- Oriented Programming?

Any other comments are welcomed
larienna
 
Posts: 41
Joined: 2014-09-27 20:54

Re: Object Oriented Programming seems harder on the mind

Postby TonyT » 2018-03-26 09:50

I have taken medication since almost a year, which set my mind on stun

Change medications or get off them completely. Without going into details of OOP vs others I would suggest handling the reasons for having to be medicted as the first priority. A clear, distraction free mind is necessary for any type of coding. The mind is a tool, and like any other machine, it needs to be well oiled and operating smoothly, else it cannot be used effectively. After that, have a new, fresh look at OOP, and perhaps your viewpoint will have shifted.
TonyT
 
Posts: 545
Joined: 2006-09-04 11:57

Re: Object Oriented Programming seems harder on the mind

Postby larienna » 2018-03-28 01:15

Unfortunately for now, getting off medication is not an option unless I want to be in constant pain and not be able to walk and sleep.

I did some research on Data-Oriented Paradigms and anti-objected orient point of view, and it has been very interesting to read. There is even this link that is pretty long and that I have not finished reading yet:

http://www.smashcompany.com/technology/ ... h-must-end

Unfortunately, there is little books and even articles on the subject of data-oriented programming. From what I read so far, the only place where OOP is necessary is for graphic user interface. There could be ways to massively reduce the amount of widgets on the screen by let say placing the content in an HTML page a bit like Steam. You could even use table of data to contain widget information, but in the end, that data will be used to create objects.

It's interesting how languages has evolved over the years. In my assembly class, they talked about non-pure programs that modified themselves in order to save memory. Today, such thing is unconceivable. The creation of garbage collections brought the concept of functional programming which was impossible before. The only restriction I think OOP has failed to take into account is the memory size ... of the programmer.

I found a quote in the link above that sumarize pretty well my point of view

Even if you don’t have concurrency, I think that large objected-oriented programs struggle with increasing complexity as you build this large object graph of mutable objects. You know, trying to understand and keep in your mind what will happen when you call a method and what will the side-effects be.
Rich Hickey
larienna
 
Posts: 41
Joined: 2014-09-27 20:54


Return to Offtopic

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable