Is it important to learn object oriented programming?
Little background - I've been programming for a little over 2 years now. I'm pretty comfortable building full stack apps, but most of my programming education has been around functional programming. I know the basics of OOP and have come across it from time to time, but have never found a use case/need.
I'm sure there are plenty of jobs out there that require it, but it feels to me like the world has been shifting towards functional programming. Maybe I'm biased because I hang out here. For those of you with more real-world experience than me, would you recommend I put in the effort to learn it? Or just stick with functional?
2 Replies
I think kinda sorta understanding the concept of OOP is good, but youre right things are moving away from it. I think in general though, some things are moving towards functional programming and others are moving towards more procedural / dependency injected code
my take is
OOP / functional / procedural / dependency injection are all different strategies around sharing code
OOP has its place but. alot of people really hate it because it dominated the industry for a long time and people didnt really want to acknowledge the problems
functional code is great where it works, but its really inefficient because the only way to add a value to your database is to destroy the database and make a new one (in a purely functional state)
functional code also generally just says that side effects shouldnt exist which is almost never completely possible in an entire application (at some point your app is going to need to output data, show a website, or do anything useful)
procedural is IMO pretty underrated and the easiest way to write code in a lot of places, but you end up sharing a lot less than other patterns
and dependency injection helps a lot with testing but you end up with a ton of code because you constantly need to pass things around instead of an object just knowing how to make its dependencies itself so you end up with more and usually harder to read code
these are just my opinions, but thats what you asked for so 🤷♂️
thanks for the response @Tom3! Honestly I haven't even looked into procedural or dependency injection lol, need to do some more research on those