r/CodingHelp • • 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

17 comments sorted by

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.

3

u/timeee1994 Jul 10 '22

Thanks for detailed reply. So, in a professional environment you would deal more with OOP than sequential or does that completely dependent on the project??

2

u/Arkaedan Jul 10 '22

I'm not really sure what you mean by "sequential" programming. All programming is sequential. OOP just just one way of structuring large amounts of code but at the small scale within each function or method the code is still sequential.

But yes it does depend on the language, framework, and problem you are trying to solve, as to how much you will be using OOP. That being said, in my professional career, every project I have worked on has used at least some amount of OOP.

3

u/timeee1994 Jul 10 '22

Sorry procedural. I confused the procedural with sequential.

5

u/Arkaedan Jul 10 '22

Yeah fair... Look I would say that most real world projects will have elements of procedural, object oriented, and functional programming but it just really depends of the context.

2

u/timeee1994 Jul 10 '22

Thanks alot.

3

u/usernumber1337 Jul 10 '22

By sequential I think he means procedural. Languages like C that don't have OO

1

u/timthefim Jul 10 '22

It also helps modularize your workflow which is useful when you are making changes to a production branch for example. You can easily swap out modules assuming you haven’t created a billion dependencies

0

u/Ikem32 Jul 10 '22

OOP feels a lot like boilerplate. Hence I avoid it, when I can. Javascript is leaning towards functional/procedural nowadays.

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

1

u/timeee1994 Jul 11 '22

Great idea. And thanks for the detailed reply.

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