際際滷

際際滷Share a Scribd company logo
Girls Go IT  2015
Back to Python
Mihai Iachimovschi
@mishunika
mihai.iachimovschi@gmail.com
Bine ai revenit!
Learning process.
You cant tell wether youre learning something
when youre learning it  in fact, learning feels
a lot more like frustration
 Jeff Dickey
Learning process.
If you feel frustrated while trying to understand
these new concepts, try to remember that it
might not feel like it, but youre probably rapidly
expanding your knowledge.
 Jeff Dickey
Python  OOP
- Python este un limbaj orientat pe obiecte;
- Conceptele OOP 樽n Python sunt simpli鍖cate
fa de Java sau C++.
Programare orientat pe obiecte
De ce programarea orientat pe obiecte este
considerat di鍖cil?
Programare orientat pe obiecte
De ce programarea orientat pe obiecte este
considerat di鍖cil?
De fapt, nu este di鍖cil!
Programare orientat pe obiecte
De ce programarea orientat pe obiecte este
considerat di鍖cil?
De fapt, nu este di鍖cil!
Am s 樽ncerc s explic simplu.
Programare orientat pe obiecte
Programarea orientat pe obiect combin:
- datele;
- codul ce opereaz asupra lor.
Termeni OOP.
Vom opera cu termenii:
- clas;
- obiect;
- metod;
- atribut.
Class vs. Object.
Class vs. Object.
Cum denumim lucrurile?
Clasele - nume generic (Cat, Cookie, Car)
Obiectele - nume particular (Tom, Oreo, Fabia)
Metodele - verb, aciune (purr, add_cream,
start_engine)
Substantiv vs. Verb
Substantiv  Clas / Obiect
Verb  Metod (Aiune asupra obiectului)
Prima clas 樽n Python.
class Cat(object):
pass
Prima clas 樽n Python.
class Cat(object):

def purr(self):
print("Purrrrr")
Hai s gsim similitudini!
Prin asocierea lucrurilor noi cu cele bine tiute
se creaz uor i cunotine noi!
Encapsulation
Encapsulation (cont.)
Python implementeaz encapsularea 樽n mod
simpli鍖cat.
Izolarea atributelor se face transparent.
We're all responsible users here"
Inheritance (Motenire)
Inheritance (Motenire)
n urma motenirii, clasele copii iau toate
caracteristicile clasei printe.
Clasa copil poate modi鍖ca selectiv
caracteristicile motenite.
Whoops. Wrong inheritance.
Polymorphism
Bazele OOP
Encapsularea, Motenirea i Polimor鍖smul sunt
conceptele fundamentale ale Programrii
Orientate pe Obiecte.
Fin.
V mulumesc!
Live coding!

More Related Content

Girls Go IT -- Day 6 Training 3 -- Back to Python