+ 5
Why we use object oriented programming concept?
what is the purpose of using object oriented programming concept in programming languages?
5 Antworten
+ 5
thanks man,
but what if we use structured programming instead of oop?
is there anything more comfortable?
+ 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)
+ 4
thanks sir
+ 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!
+ 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