26
Girls Go IT — 2015 Back to Python Mihai Iachimovschi @mishunika [email protected]

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

Embed Size (px)

Citation preview

Page 1: Girls Go IT -- Day 6 Training 3 -- Back to Python

Girls Go IT — 2015

Back to Python

Mihai Iachimovschi

@mishunika [email protected]

Page 2: Girls Go IT -- Day 6 Training 3 -- Back to Python

Bine ați revenit!

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

Learning process.

“You can’t tell wether you’re learning something when you’re learning it — in fact, learning feels a lot more like frustration”

— Jeff Dickey

Page 4: Girls Go IT -- Day 6 Training 3 -- Back to Python

Learning process.

“If you feel frustrated while trying to understand these new concepts, try to remember that it might not feel like it, but you’re probably rapidly expanding your knowledge.”

— Jeff Dickey

Page 5: Girls Go IT -- Day 6 Training 3 -- Back to Python

Python — OOP

- Python este un limbaj orientat pe obiecte;

- Conceptele OOP în Python sunt simplificate față de Java sau C++.

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

Programare orientată pe obiecte

De ce programarea orientată pe obiecte este considerată dificilă?

Page 7: Girls Go IT -- Day 6 Training 3 -- Back to Python

Programare orientată pe obiecte

De ce programarea orientată pe obiecte este considerată dificilă?

De fapt, nu este dificilă!

Page 8: Girls Go IT -- Day 6 Training 3 -- Back to Python

Programare orientată pe obiecte

De ce programarea orientată pe obiecte este considerată dificilă?

De fapt, nu este dificilă!

Am să încerc să explic simplu.

Page 9: Girls Go IT -- Day 6 Training 3 -- Back to Python

Programare orientată pe obiecte

Programarea orientată pe obiect combină:

- datele;

- codul ce operează asupra lor.

Page 10: Girls Go IT -- Day 6 Training 3 -- Back to Python

Termeni OOP.

Vom opera cu termenii:

- clasă;

- obiect;

- metodă;

- atribut.

Page 11: Girls Go IT -- Day 6 Training 3 -- Back to Python

Class vs. Object.

Page 12: Girls Go IT -- Day 6 Training 3 -- Back to Python

Class vs. Object.

Page 13: Girls Go IT -- Day 6 Training 3 -- Back to Python

Cum denumim lucrurile?

Clasele - nume generic (Cat, Cookie, Car)

Obiectele - nume particular (Tom, Oreo, Fabia)

Metodele - verb, acțiune (purr, add_cream, start_engine)

Page 14: Girls Go IT -- Day 6 Training 3 -- Back to Python

Substantiv vs. Verb

Substantiv — Clasă / Obiect

Verb — Metodă (Ațiune asupra obiectului)

Page 15: Girls Go IT -- Day 6 Training 3 -- Back to Python

Prima clasă în Python.

class Cat(object): pass

Page 16: Girls Go IT -- Day 6 Training 3 -- Back to Python

Prima clasă în Python.

class Cat(object): def purr(self): print("Purrrrr")

Page 17: Girls Go IT -- Day 6 Training 3 -- Back to Python

Hai să găsim similitudini!

Prin asocierea lucrurilor noi cu cele bine știute se crează ușor și cunoștințe noi!

Page 18: Girls Go IT -- Day 6 Training 3 -- Back to Python

Encapsulation

Page 19: Girls Go IT -- Day 6 Training 3 -- Back to Python

Encapsulation (cont.)

Python implementează encapsularea în mod simplificat.

Izolarea atributelor se face transparent.

“We're all responsible users here"

Page 20: Girls Go IT -- Day 6 Training 3 -- Back to Python

Inheritance (Moștenire)

Page 21: Girls Go IT -- Day 6 Training 3 -- Back to Python

Inheritance (Moștenire)

În urma moștenirii, clasele copii iau toate caracteristicile clasei părinte.

Clasa copil poate modifica selectiv caracteristicile moștenite.

Page 22: Girls Go IT -- Day 6 Training 3 -- Back to Python

Whoops. Wrong inheritance.

Page 23: Girls Go IT -- Day 6 Training 3 -- Back to Python

Polymorphism

Page 24: Girls Go IT -- Day 6 Training 3 -- Back to Python

Bazele OOP

Encapsularea, Moștenirea și Polimorfismul sunt conceptele fundamentale ale Programării

Orientate pe Obiecte.

Page 25: Girls Go IT -- Day 6 Training 3 -- Back to Python

Fin.

Vă mulțumesc!

Page 26: Girls Go IT -- Day 6 Training 3 -- Back to Python

Live coding!