+ 10

what the goal of object oriented programming ?

I've been learning python using solo learn but I reached this part of oop (object oriented programming ) and I don't really understand how to use it in a program , can anyone help.

1st Jul 2020, 4:28 PM
Abderrahim Rhitrif
Abderrahim Rhitrif - avatar
45 odpowiedzi
+ 8
Martin Taylor, as a Python fan, I want to publicly say: Python's OOP is lacking. In the beginning, I didn't understand that, but over time it sank in. 😂 In my own short words, an object is supposed to protect the data it contains, and define *from the inside* what can be done with that data, and what is forbidden, by providing methods. If I can access anything from anywhere anyway, the object is effectively not protecting its data. One question though: You wrote, Python is not strongly typed. Is that correct? Python is not statically typed, so you can basically pass everything as an argument, and the function has to sort out if that is even legit. It's dynamically typed, so a variable name is not forever bound to one type of value, but it's just a 'sticker' that can be pasted onto everything. Strongly typed, however, means, that one object can not be arbitrarily read as something completely different - which C for example allows. At least that's how I've mostly seen it defined.
3rd Jul 2020, 8:55 AM
HonFu
HonFu - avatar
+ 5
I agree with Martin Taylor. While python can be used for OO programming, it does not offer the best experience. In OOP, there should be a means to hide data from other classes. Python's does not have a `private` keyword and even if you prefix an attribute with two underscores it can still be called outside the class smh Also, in other OO languages, you don't need to explicitly pass the instance when calling the instance method. IMO Python does not deliver the best OOP developer experience
1st Jul 2020, 8:46 PM
Ore
Ore - avatar
+ 5
So in situations (small code) where there is no need for robustness, Python looks short and easy. But as soon as you want to make really sure, every method has to start with a bunch of tests, like: If arg 1 is really an int and arg 2 is definitely a string and arg 3 is by no means blablabla...
3rd Jul 2020, 2:32 PM
HonFu
HonFu - avatar
+ 4
Bagon An important part of OOP is abstraction. A class should abstract away its implementation details(anything that is not significant to its use). The reasons are thus: 1. Changing the implementation details will alter the behaviour of the class and may cause it to longer behave has a member of its type. 2. If the implementation details are made public. The developer can't know how far the client's have tampered with the objects and will be forced to release new versions with extreme caution because they will likely break things.
1st Jul 2020, 9:20 PM
Ore
Ore - avatar
+ 4
It's better read some in the book and then learn in sololearn because not everything is clear here
2nd Jul 2020, 4:31 PM
Subodh Narale
Subodh Narale - avatar
+ 4
The ability to model real world objects.
2nd Jul 2020, 9:03 PM
Sonic
Sonic - avatar
+ 4
The ability to reduce duplicate code.
2nd Jul 2020, 9:04 PM
Sonic
Sonic - avatar
+ 3
Don't feel bad my guy, OOP is one of the worst sections of the Python course, just look in the comments and you'll see all the frustrations 😉 it helps a lot to take notes and consult them if you have trouble. I personally have a fat binder full of notebook paper called the "Compendium of Python Bullshit Vol. 1" 😂😂😂
3rd Jul 2020, 1:21 AM
Randy Ziegler
Randy Ziegler - avatar
+ 3
Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism, etc in programming. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.
3rd Jul 2020, 1:30 AM
LOKESH CHAUHAN
LOKESH CHAUHAN - avatar
+ 2
before object oriented technology there were many programming languages for each. such as language for business programming language for mathematicians from the late 1960’s first OOP style programming language Simula has been developed.Since then Other different majority(mathematicians,businessman) can use OOP Style to program their software.might be Some kind of philosophy of Programming.
2nd Jul 2020, 1:19 AM
Bilguun
Bilguun - avatar
+ 2
Think about classes like same in video games. But they're not a wizard and warrior, but pure enemy and hero. Also item and etc. OOP helps you to reduce amount of code to write, and gives a lot of helpful features (especially in C++ or even Java :)(.Net)
2nd Jul 2020, 4:30 PM
Matvey Anoshin
Matvey Anoshin - avatar
+ 2
Security Reusability
3rd Jul 2020, 1:13 PM
Aditya Shrivastava
Aditya Shrivastava - avatar
+ 1
Granger Thank you so much
1st Jul 2020, 5:35 PM
Abderrahim Rhitrif
Abderrahim Rhitrif - avatar
+ 1
dealing with real world objects like users of an app.
2nd Jul 2020, 5:27 AM
M. Imdaad
M. Imdaad - avatar
+ 1
OOP helps you group your codes. You write the methods and call them specifically. Methods could be anything, just use whatever you can always refer back to and understand. When you write methods, you can make references and check back because writing methods is like grouping your code, so once it's grouped, it's easy to go back to. You can't have millions of codes without writing methods. Of course you can but you won't always be able to call it back while you're going further. I hope this helps. And don't let 'def' scare you. It's just permanent in Python
2nd Jul 2020, 7:48 PM
Praise
+ 1
By using oop you can implement inheritance, polymorphism, abstraction, encapsulation and much more. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.
3rd Jul 2020, 6:38 AM
Ishan Shah
Ishan Shah - avatar
+ 1
OOP its helpful
3rd Jul 2020, 10:21 AM
Yacine Hamzi
Yacine Hamzi - avatar
+ 1
Well, python is good programming language.. no offense.. but OOP implementation is one of the weak pillars of python.. and.. people.. should.. try out.. different programming languages.. and then come to a conclusion.. I find.. Java as the best 'OOP language..' (just.. considering.. the OOP part ...atleast for me) But.. OOP paradigm is.. very helpful in.. creating.. all realworld.. software implementations...
3rd Jul 2020, 2:46 PM
Sheikh Hafijul Ali
Sheikh Hafijul Ali - avatar
+ 1
Black Tears please don't do this. If you've tried and can show your attempt then post new question, otherwise try yourself first. Nobody will do your homework here
3rd Jul 2020, 4:28 PM
Roneel
Roneel - avatar
0
How to apply oops in real life?
3rd Jul 2020, 4:39 AM
Vishwa V