Object Oriented Python Programming

Ubuntuの刀

:^D
OP
Member
Joined
Apr 12, 2009
Messages
379
Trophies
1
Age
28
XP
540
Country
United States
So I just watched a 7 minute video on Object Oriented Programming. People keep telling me it's very complicated, when I completely understood what the person was talking about.

Maybe I'm not understanding what's hard about it. Why is Object Oriented Programming for Python hard?
 

Sop

groovy dude lmao
Banned
Joined
Nov 14, 2010
Messages
1,244
Trophies
0
Location
qld
XP
553
Country
So I just watched a 7 minute video on Object Oriented Programming. People keep telling me it's very complicated, when I completely understood what the person was talking about.

Maybe I'm not understanding what's hard about it. Why is Object Oriented Programming for Python hard?

???

Python is an Object Oriented language, nothing hard about using OOP principles in Python...
 

PityOnU

Well-Known Member
Member
Joined
Jul 5, 2012
Messages
1,182
Trophies
1
XP
1,614
Country
United States
OOP is as easy as PIE

Polymorphism
Inheritance
Encapsulation

...abstraction is in there somewhere as well.

OOP concepts aren't that hard - it's just the implementation that becomes tricky. You will become very accustomed to tracing your code through multiple classes, parent to child or vice versa.
 

Snailface

My frothing demand for 3ds homebrew is increasing
Member
Joined
Sep 20, 2010
Messages
4,324
Trophies
2
Age
40
Location
Engine Room with Cyan, watching him learn.
XP
2,255
Its not so much difficulty, its just ugly. It don't like the needless use of 'self' as a parameter everywhere when nothing is sufficient like most other languages. The use of __init__() as the constructor is ugly as well, why not just self-named constructors like everything else?

I'm not looking for an argument here -- this implementation of OO is just not my taste. Python remains, overall, a stellar language imo.
 

calmwaters

Cat's best friend
Member
Joined
May 27, 2013
Messages
1,718
Trophies
0
Location
happy land
XP
461
Country
United States
Its not so much difficulty, its just ugly. It don't like the needless use of 'self' as a parameter everywhere when nothing is sufficient like most other languages. The use of __init__() as the constructor is ugly as well, why not just self-named constructors like everything else?

I'm not looking for an argument here -- this implementation of OO is just not my taste. Python remains, overall, a stellar language imo.

I heard that this is like Visual Basic, only the code segments are a bit different (obviously). And that code does look ugly.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
To add to the general sentiment if a physicist wandered up to me and said they understood sub atomic physics then I would be inclined to dismiss them, if a person that can knock out a bit of code comes up to me and says they know objected oriented programming my response would be more along the lines of "right on".

"but there is procedural and object oriented. Right?"
Kind of. Also just to be clear it is not a binary choice -- you can mix and match object oriented and procedural quite happily and it may even pay to do so.
The rabbit hole is near infinite and usually quite pointless to go down* but there are hundreds of "? oriented" concepts, "? driven" philosophies and "? based" paradigms you can follow when programming. How much of that is stylistic and how much actually represents a new way of thinking about something is a discussion for another day (after aspect oriented programming and return oriented programming you are going to have to qualify it if you are trying to sell me on it).
For my money though it does boil down to procedural and object oriented, there are things you would be exceptionally hard pressed to do in anything resembling an elegant or extensible way in procedural type programming where they are near trivial if you go object oriented (the go to example is usually something design a first person shooter in each and if procedural presents no issue then you are a better programmer than most). As others have hinted at though it can be hard to chase down bugs that are many levels up/elsewhere or the result of you not quite understanding how things work (people trying to get a variable value from within an already called function would be an example) and can impact code extensibility (though no more than an ill thought out database schema or poorly considered use of an array).

*if you have ever seen someone fuss over the layout and end up missing out on the content then same thing.
 

Ubuntuの刀

:^D
OP
Member
Joined
Apr 12, 2009
Messages
379
Trophies
1
Age
28
XP
540
Country
United States
Ok so I know this thread is old, but I pretty much forgot how to program in Python...

Now that I am reading this thread, I have a little more confidence. I guess all I need to do is review what I think I know and actually implement them.

Time to use reddit.com/r/dailyprogrammer and do the easy challenges.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Not as such. Sure such things are irrecoverably linked but by itself OOP is not "just classes and all that". I have further troubles as things like LISP work in such a way that you can reinvent OOP in a language that technically lacks it, or lacked it originally.

I am also not the greatest student of computer language theory, it is how I have learned to program but that means little here.

As you say though OOP is basically standard right now with plain C being about the only language in common use that lacks it. The legacy of C means much though.
I am not sure how it is taught either, if it is like I sometimes see HTML being taught where CSS is divorced from it then we might be in for problems. I try to keep up with intros to programming type things but there are only so many times I can be introduced to typing and the concept of variables, often as explained to someone the author seems to view as a moron for not knowing programming. As mentioned above though it is not that radical a concept and you might have learned it even if you did not know you were learning it.

Beyond that various languages have subtly different ways of doing things which might cloud or render something broad I say to be wrong. If I can generalise though it represents a fundamentally different viewpoint from procedural/function programming, which is what things before tended to do. It does this by allowing access to and manipulation of data at a much finer grain level than is easy with procedural, often in a far more extensive (and extensible) way too. This has ramifications all over the shop, some good, some bad, some bad if the programmer is bad, some technically bad but able to be ignored if you have a machine with some grunt and all quite far reaching.

I think I will leave it at
Call it "just classes and all that" and you will not be too far out of line, however if you do have to drop down to C or something you will miss it so much.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: butt