Does OO still Function?

Vladilen Napuri
6 min readJul 30, 2020

Object Oriented programming is a term that that I am pretty confident a large amount of people have heard before. I had always heard it being used but never quite knew the exact details of the definition.

Never had the time…right?

So I took the opportunity of working on this blog post to try and familiarize myself with just what OO programming is. I never imagined the size of the proverbial ‘Can of Worms’ that I had just opened for my own curiosity.

Pick A Paradigm, Any Paradigm

I first had to understand a broader language of what a programming language was, and more importantly how they are all categorized. Programming languages are classified or defined by different paradigms.

Although there are dozens of programming paradigms, the four major types of programming paradigms are Imperative, Functional, Logical and Object-Oriented.

Some languages support just one paradigm, for example Haskell only supports functional programming and Small talk only supports OO programming. While some support multiple paradigms, such as C++, JavaScript, and Ruby. Out of those that offer multiple paradigm support, some of them can be only imperative, purely OO, solely procedural, or can contain elements of both or other paradigms. Software and engineers and programmers decide how to, and when to apply those paradigm elements.

Objectively Speaking

With the general idea of how some languages are categorized and are capable of, I ventured a stack deeper into just what makes OO programming unique.

OO programming is designed on the concept that all parts of a program are ‘Objects’, which can contain data and code. The data we give the ‘Object’ are our attributes. The code we write into the object are procedures or ‘methods’ that we want the object to be able to perform. Most of the popular OO languages are class based which means that the Object we are usually performing on or storing data in are referred to as ‘Instances’.

One of the unique features of OO programming is the inherent idea of ‘self’. To be more specific, what is unique is that the objects own procedure can modify its own data, or attributes.

I have to say that, what I have just written I was somewhat informed on. At least the concepts of Classes and Instance. From this point forward, all of the information was uncharted and fascinating territory!

Didn’t Follow Proto

As we established earlier, Class based languages define a Class beforehand and then Objects are instantiated based on the parameters of the class.

In prototype based languages no classes really exist. Here we have an object called a prototype to which other objects are linked. Every object has one unique prototype link. New objects are created based on the desired prototype. Instead of having an explicit class for instances of a certain object, we create a prototype of a certain object and then make copies of it with changes that make them unique items. The new object would inherit the attributes and methods of the prototype it was created from.

In the act of researching all of the awesome concepts that OO programming implements such as, inheritamce, encapsulation, polymorphism, open recursion, etc. I came upon an article.

In the one and only true way. The object-oriented version of ‘Spaghetti code’ is, of course, ‘Lasagna code’. (Too many layers). -Roberto Waltman

This article introduced an idea that I had heard whispers of. OO programming was dying out.

SoI went down the rabbit hole.

I read a handful of articles, ranging from Reddit posts with hundreds of comments to Articles by dozens of bloggers and tech publications. And What I gathered was revelatory, educational, and befitting the current zeitgeist.

Caught Lacking

From what I could gather , there were three major flaws in OO programming that continued to come up in the literature.

Inheritance/Heirarchy

Encapsulation

Polymorphism

In regards to inheritance in OO languages, there are a couple of issues, the major being duplication of functions from inherited objects and causing bugs.

Also OO applies categorical hierarchies, which are more arbitrary instead of being based on real world objects and instances. In the real world more containment hierarchies can be observed, and make more sense in terms of how the computer stores information ie Files contained IN a Drive.

Polymorphism would be the next knock on OO programming. This was my first time hearing this word in the context of computer programming. Basically it refers to the concept of a subclass having the same functions as their parent class. Being able to be handled in the same way as the parent class, in addition to having unique functions that can perform the same actions in multiple ways.

OO languages are not unable to perform these tasks but from a clean and efficient code perspective I think the consensus is that Functional Polymorphism is the way to go instead of managing classes and subclass inheritances in OO languages.

There is also an issue when it comes to how objects are referenced in OO. Constructor classes use a reference to the object, and then store that information as a private variable. Although it may seem secure being a private variable it is still being stored in the reference itself. To be more secure you would clone the object , but that leads to the inefficiency of having to clone the object within that object and so on.

Scalpels, Chefs Knives and Chainsaws

There is a tool for every job. There is a job for every tool.

As the amount of jobs, research, new technology, and human creativity continue to grow. So will the variety and adaptability of our tools. A LOT of software engineers have been using OO languages for nearly 50 years. During that time many different languages have gone in an out of style. Not solely from whims of an aesthetic nature, but also because we demand it. The incomparable spike in technology has been accompanied in parallel by an equally unique, evolving ecosystem of programming languages.

I don’t buy in to the thought that Object Oriented Programming is going away.

After dipping my toe into the world of computer science, I’ve learned to appreciate the diversity of the tools that we have available to us, and to not just write off an amazing tool because the hype has recently worn off. As a hopeful software engineer I cannot wait to see the future of OO languages.

Sources:

--

--