Jump to content






Photo
- - - - -

object oriented programming

Posted by notKlaatu , 08 January 2009 · 106 views

this is my noob understanding of the concept, taken from a friend-of-a-friend's explanation of it (whose name I have forgotten so cannot credit, so I will change it enough to make it appropriately non-plagiarist but close enough to still be accurate)object oriented programming is a user-friendly way of grouping data together so that it's easier for the programmer to work with.So instead of making a list of all your data:
objList = [(fast, sleek), (slow, ugly)]obj1_speed = objList[0][0]obj1_design = objList[0][1]obj2_speed = objList[1][0]obj2_design = objList[1][1]
and then getting the data:
print obj1_speed> fast
you instead make a CLASS. This is a template of the data structure you want to use:
class coolObject():def __init__(car):car.speed = ""car.design = ""
and then you instantiate that classand you put in the data you want:
auto1 = coolObject("fast", "sleek")auto2 = coolObject("slow", "ugly")
and then you can call these newly created objects...
print auto1.speed
...and how on earth that applies to making computers do neat things is way beyond me. but that's more or less what object oriented programming is all about. next step, go back to school!




July 2014

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
27 28 293031  

Recent Entries

Recent Comments

Search My Blog

BinRev is hosted by the great people at Lunarpages!