Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Object Oriented

No description
by

Michael Nooner

on 28 October 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Object Oriented

Object Oriented Programming
What is OOP?
Programs are made up of object definitions and function definitions, and most of the computation is expressed in terms of operations on objects.
What are Classes?
Computational modes of real-world things

Collect data and operations on that data
What does that mean?
Classes & Objects
Defining then Instantiating
class Dog:
pass

peanut = Dog()

Create a Method
Attributes
Necessary data for class to work
Today's Agenda
OOP
Classes/Objects
Properties/attributes
Methods

Each object definition corresponds to some object or concept in the real world, and the functions that operate on that object correspond to the ways real-world objects interact.
Structured programming
OOP
Complex
Current Paradigm
Person
Alice
Bob
Attributes
Height
Weight
Sex
Name
Methods
Instances
(Objects)
Class
Define the class
Create an object by instantiating the class
class Dog:
def bark(self):
print('woof!')
save in animals.py
Looks just like a function ;)
Methods are functions that act on an object
peanut = Dog()
peanut.bark()
Object dot method
mandatory
skips the body
Initialize Method
class Dog:
def __init__(self, name, owner):
self.name = name
self.owner = owner
def bark(self):
print('woof!')
def tag(self):
print('I am {} owned by {}.'.format(
self.name, self.owner))
two _'s
creates
attributes
uses attributes
Methods operate on attributes
self.attribute_name = value
Generally created in __init__()
What is self?
alias for the current object
whatever is left of the dot
first parameter of every method
analogous to this in C++/Java
how you access all attributes
Full transcript