Why we use object oriented programming concept? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Why we use object oriented programming concept?

what is the purpose of using object oriented programming concept in programming languages?

5th Apr 2017, 7:54 AM
maruf sikder
maruf sikder - avatar
5 Answers
+ 5
thanks man, but what if we use structured programming instead of oop? is there anything more comfortable?
5th Apr 2017, 8:54 AM
maruf sikder
maruf sikder - avatar
+ 4
The difference of each style is simply in the modeling of your algorithms and data structures. If, I.E., your algorithm involves lists and trees, a functional algorithm may be the most sensible or if your data is highly structured it may make more sense to compose it as objects. It mostly depends of the language you are working in. For example, you wouldn't want to build object foundation in haskell which encourages functional programming, same with C which is procedural (although it's possible using APIs)
5th Apr 2017, 9:02 AM
Bruno Vego
Bruno Vego - avatar
+ 4
thanks sir
5th Apr 2017, 9:07 AM
maruf sikder
maruf sikder - avatar
+ 3
A better question would be 'when' do we use them. If you google it you'll find many answers but I'll try to put it in short: With OOP you encapsule data, or in other words you choose what will be exposed. It's also used for better organisations. Instead of looking at each object separately, maybe you'd want to abstract them and look at their shared properties. For example, if we take a student and a teacher, they are both under the term 'Person', meaning they both have an age, a name etc. so you'd want these classes to INHERIT from the Person class, since they share the same properties. Another example would be a dog & a cat. They have an age, both have a number of legs, make a sound etc, so their abstract is an Animal. OOP also makes it a lot easier to maintain/upgrade code since everything is organised (ofcourse, if the programmer used good naming etc.) Hope that answers some of your questions, my first post here Cheers!
5th Apr 2017, 8:49 AM
Bruno Vego
Bruno Vego - avatar
+ 2
OOP is the pest practice and the best way from the expert and researchers during lifecycle of programming to organize the relationships between object
21st Apr 2017, 12:37 PM
Eng Hazymeh
Eng Hazymeh - avatar