Reducing Learning Curve Overhead with OOP

A lot of people don’t understand why object-oriented programming (OOP) practices are getting so much hype. While I can’t explain all the benefits of using OOP in this article, I will cover one of the compelling cases of using OOP, you save time.

Imagine a scenario where a new recruit has just joined your ranks. He was hired into your team to speed up your project. If your code wasn’t designed in an OOP manner, then he’ll most likely have to review a good chunk of the code in order to figure out what’s going on and how the various pieces interconnect. Some code at line 23 might be affecting line 83. Some function might take 2 integers and behave one way, and then take in 3 arrays and behave another. The code might also require certain global parameters to be set in a certain sequence before things can function.

In OOP programming, things you don’t need to know, you don’t need to know. For example, if you were coding a shopping cart, the “scanning system” only cares to know about the price of the item. The “product” object only needs to know it’s “price”. The “shopper” only cares about the price and the total. Each of these objects can have various complex behaviors, but they’re all encapsulated within the object. For example if the “product” was perishable, and price was a function of it’s expiration, the “scanning system” and “shopper” doesn’t need to know about this. If you were to adjust how various item’s price fluctuates, you only need to focus on “product” classes.

Whereas, in a non-OOP class, you might a very long file, class, or function, and it might be filled with all these complex checks to figure out how much the price is, but in an OOP system, the “scanning system” simply asks the “product” for it’s price. OOP code is also more intuitive, since OOP mimics real world objects and relationships.

OOP practices are good to adopt, although there is some overhead, there will definitely be long-term savings in more ways than one.

Leave a comment

Your email address will not be published.