object oriented programming
Posted by notKlaatu , 08 January 2009 · 118 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 = objListobj1_design = objListobj2_speed = objListobj2_design = objListand then getting the data:
print obj1_speed> fastyou 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!