What is OOP (Object-Oriented Programming)?

April 29, 2023

Object-Oriented Programming

The core of this topic is answered very well by ChatGPT and current top links in Google Search. Software.Land aims to reveal nuances of topics that can't be found elsewhere. Educative provides an excellent resource to learn What is OOP?

Nuances

Object-oriented programming can go wrong in many ways. It's usually some form of over-engineering (assuming we've ruled out incompetence). Below are some examples.

Overly Complex Inheritance Hierarchies

Very often, developers/engineers over-engineer an application, resulting in overly complex inheritance hierarchies.

It's important to remember that everything in software (and in life) is a trade-off. Overly complex hierarchies might be enabling more code-reuse and adherence to DRY (Don't Repeat Yourself), but it can also make code more rigid, less maintainable, and less readable. One solution to this is to favor composition over inheritance.

Overuse of Indirection and Abstraction

A similar no-no to creating complex trees of inheritance hierarchies is creating complex trees of function calls. This is often, again, in an effort to adhere strictly to DRY (Don't Repeat Yourself). But it ends up making code more rigid, less maintainable, and less readable. Don't forget that everything is a trade-off. Writing code in a flat architecture is more flexible and often more readable.

Overly Generic Classes and Methods

In an effort to achieve high levels of reusability, it's easy to go too far and to create far too generic foundational building blocks. These ultra-generic foundational building blocks are often never used outside their original purpose. It's great to think of software over a long span of time, but it's also good to remember that predicting evolving requirements 5+ years down the road is nearly impossible. Refactors and migrations to entirely new systems are normal and should not be feared. Genericize what is simple to do based on the requirements that are available at the time with reasonable predictions (difficult without experience).

Intentional and Unnecessary Obfuscation ★★★

This is the most controversial section of this blog post. It's unspoken because it's so hard to prove with 100% certainty. But, anyone who has worked in the industry at enough companies knows it exists. This can be compared to over-engineering, but the intentions are not good when seemingly intentional obfuscation occurs. The purpose behind this is protectionism at a very local scope. Normally, it's not good to shine a light on such bad actors, but it's becoming so prevalent that it's time to shine light on this highly counter-productive strategy.

The truly terrifying reality is that there exist managers (at any level, depending on the company) who support this behavior as a way of forming a social collective backed by technical obfuscation or worse. One of the main goals of Software.Land is to break these arbitrary barriers anywhere they may exist in building software and open the doors to the people before displacement by AI. This type of behavior is not okay, and it's why Software.Land and its creator, Sam Malayek, receive the support that is received -- contrary to underground socialistic, woke, and mob-based rumors.

Learn more about Object-Oriented Programming vs Functional Programming.

Updated: 2024-02-18