Object Oriented Python Programming

Discussion in 'Computer Programming, Emulation, and Game Modding' started by Ubuntuの刀, Oct 18, 2013.

  1. Ubuntuの刀
    OP

    Ubuntuの刀 :^D

    Member
    378
    213
    Apr 12, 2009
    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?
     
  2. Sop

    Sop groovy dude lmao

    Banned
    1,244
    207
    Nov 14, 2010
    qld
    ???

    Python is an Object Oriented language, nothing hard about using OOP principles in Python...
     
  3. Ubuntuの刀
    OP

    Ubuntuの刀 :^D

    Member
    378
    213
    Apr 12, 2009
    United States
    Ok I know that, but there is procedural and object oriented. Right?

    I feel confused :blink:
     
  4. PityOnU

    PityOnU GBAtemp Advanced Fan

    Member
    907
    327
    Jul 5, 2012
    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.
     
  5. Snailface

    Snailface My frothing demand for 3ds homebrew is increasing

    Member
    4,324
    1,983
    Sep 20, 2010
    Engine Room with Cyan, watching him learn.
    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.
     
  6. calmwaters

    calmwaters Cat's best friend

    Member
    1,718
    375
    May 27, 2013
    United States
    happy land
    I heard that this is like Visual Basic, only the code segments are a bit different (obviously). And that code does look ugly.
     
  7. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,166
    8,906
    Nov 21, 2005
    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の刀 and calmwaters like this.
  8. Ubuntuの刀
    OP

    Ubuntuの刀 :^D

    Member
    378
    213
    Apr 12, 2009
    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.
     
  9. FireGrey

    FireGrey Undercover Admin

    Member
    3,920
    909
    Apr 13, 2010
    Is OOP just classes and all that? Cause I thought that was very standard.
     
  10. FAST6191

    FAST6191 Techromancer

    pip Reporter
    23,166
    8,906
    Nov 21, 2005
    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.