Object-oriented, but for what exactly?

It is not new that object-oriented programming is necessary and almost mandatory today. Those who program in the most popular languages ​​must know how to apply techniques for their application and will hardly be able to create or maintain codes if they are not following an evolution of this technology.

Object-oriented programming was created in the 1960s, and won in the 1990s. Today, all programmers has heard, used or learned in college.

More and more we have seen in codes, that object orientation has been used in an uncontrolled way, probably because it meets this “requirement”. It has become so mandatory that when we speak of “public variable“, everyone looks at them with a frown as they are violating a culture.

Now, let’s think a little: if you have a parameter in your system, which needs to be available during the entire use of the program, and which does not need to be enumerated or controlled in memory, it is really necessary to create an object for assign it, adding more complexity and taking up more memory space?

In fact, today memory is no longer a concern as it used to be. We have space available to allocate a lot of information, and a single variable does not make a difference anymore.

Anyway, it is satisfactory when you have the clarity that your software is allocating as little memory as possible, controlling objects correctly so that they stay only as long as necessary in memory, without repeating properties or variables, and using pointers correctly to having these objects in several places but stored only in one place in memory!

The same situation applies to methods of a class that perform independent tasks. Do we really need to create a new instance of a class just to call a method that has no connection to an object ?!

Let’s think about it a little bit. Leave your comments on what you think of the subject!

Read more about OOP history: https://en.wikipedia.org/wiki/Object-oriented_programming#History

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top