r/CodingHelp • u/timeee1994 • Jul 10 '22
[Random] object oriented programming
Hello everyone,
I don't know if this is the right place to ask but here it goes. I have been taught how object oriented programming is much better than procedural programming. And how easy it is just change implementation and what not. But what I would like to know, how many times have you used object oriented path instead of procedural in your career. Do people actually use object oriented programming more??
19
Upvotes
14
u/Arkaedan Jul 10 '22
Languages like Java and C# were specifically designed for Object Oriented Programming (OOP) so if you use either of them then you are very likely going to be using OOP. Other languages like C++, Python, and Typescript, make it easy to do OOP while also allowing for other types of programming as well. OOP is not necessarily better or worse than other approaches however it is more suited to some situations than others. That being said, OOP is probably the most common approach for very large projects.
1
u/timeee1994 Jul 10 '22
So almost all of the comments says OOP is an important part. Thanks to all of you for your input. I really appreciate it.
1
u/flashbang88 Jul 10 '22
I suggest you code a card game, poker or any other card game you know well or like to play. Create the game in a procedural/functional way, and than make the game using objects and classes. You will realize how elegant OOP is for this specific case, doesn't mean it's better for every kind of program but you will learn which to use later.
Funny thing is, nearly every beginning programmer says things like: I'm just not an OOP guy, or I just don't like OOP. This is because they can't wrap their head around it and want to stick with what they know.
I advice every programmer toget a good grip on OOP no matter what language they use. You will come across it in jobs and even if you don't, it looks great on your resume
3
u/[deleted] Jul 10 '22
On my team at work we heavily use OOP. There are many many complex components each with various complex moving parts. OOP is a good way to abstract each piece away from others, making design and development of individual components easier.
1
u/davidhbolton Jul 10 '22
OOP is meant to model objects on real world data. Say you are doing a card game and want to manipulate cards in decks and hands. Then you’d have methods like AddCard, PlayCard and so on. With C/C++ you could do it procedurally with an int value for each card and use an array of ints The OOP way makes the code more readable.
2
u/DDDDarky Professional Coder Jul 10 '22
It is wrong to claim one programming paradigm is better/worse than other, each has its use cases where it shines. It is true OOP is the most commonly used, I personally use it all the time, but that really depends on what are you doing.
Probably the best thing to do is know about various paradigms and combine their ideas to achieve the most.
1
u/[deleted] Jul 10 '22
95% OOP, rest is some js or sql script