As Ruby on Rails is our main stack, it’s natural that we’ve already paid attention to object-oriented programming with Ruby. But today we’ll present you 3 cons of Object Oriented Programming that you can apply to other languages as well.
So here there are:
- Inheritance. Object Oriented languages don’t make Contain and Delegate easy to do. They were designed to make Inheritance easy.
Encapsulation. Object state variables are protected from outside access, i.e. they’re Encapsulated in the Object. Encapsulation is Safe for your variables.
Polymorphism. Interfaces will give you this. And without all of the baggage of OO. And with Interfaces, there isn’t a limit to how many different behaviors you can mix in.
Want to see more examples? Check them here.
If you are a fan of functional programming, this material about pros and cons of functional programming will be useful for you.