0
S.O.L.I.D. Python
Alea Soluciones
Bifer Team
@eferro
@pasku1
@apa42
@nestorsalceda
Usual OO Systems
Rigid
Fragile
Immobile
Viscous
Why S.O.L.I.D. principles?
To create easy to maintain OO systems
Improve reusability
Easy testing
For creating

Clean Code
It's all about money
S.O.L.I.D
SRP - Single responsibility principle
DIP - Dependency inversion principle
OCP - Open/closed principle
LSP - Lis...
Principles
Not Rules
Car wash service
car wash job
when the car enters in the car wash
✓ it registers a job
customer notification
when service ...
…
Some refactors / versions later
Depend upon Abstractions. Do not depend upon concretion
Compilation / Startup time
dependency
from <package> import module
Runtime dependency

self.collaborator.message()
Global State Problem
Implicit dependency problem
Concrete API
No dependency injection
Implicit dependency problem

Concrete API
Duck Typing Approved!!!
Liskov Substitution
principle violation
Python don't force type inheritance
For API implementation
(So, for reuse code, prefer Composition)
Derived types must be completely substitutable for their
base types
It isn't so important
A narrow interface is a better interface
SOLID Motivational Posters, by Derick Bailey
http://lostechies.com/derickbailey/2009/02/11/solid-development-principles-in...
car_wash code example
https://github.com/aleasoluciones/car_wash
SOLID definition (at wikipedia)
http://en.wikipedia.org/w...
Thanks !!!
@eferro
@pasku1
@apa42
@nestorsalceda
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Python SOLID
Upcoming SlideShare
Loading in...5
×

Python SOLID

2,878

Published on

Published in: Technology, Business
1 Comment
8 Likes
Statistics
Notes
No Downloads
Views
Total Views
2,878
On Slideshare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
49
Comments
1
Likes
8
Embeds 0
No embeds

No notes for slide

Transcript of "Python SOLID"

  1. 1. S.O.L.I.D. Python
  2. 2. Alea Soluciones Bifer Team
  3. 3. @eferro @pasku1 @apa42 @nestorsalceda
  4. 4. Usual OO Systems Rigid Fragile Immobile Viscous
  5. 5. Why S.O.L.I.D. principles? To create easy to maintain OO systems Improve reusability Easy testing
  6. 6. For creating Clean Code
  7. 7. It's all about money
  8. 8. S.O.L.I.D SRP - Single responsibility principle DIP - Dependency inversion principle OCP - Open/closed principle LSP - Liskov substitution principle ISP - Interface segregation principle
  9. 9. Principles Not Rules
  10. 10. Car wash service car wash job when the car enters in the car wash ✓ it registers a job customer notification when service completed ✓ it notifies the customer reporting when client report requested ✓ it shows all wash services for that customer 3 examples ran in 0.0178 seconds
  11. 11. … Some refactors / versions later
  12. 12. Depend upon Abstractions. Do not depend upon concretion
  13. 13. Compilation / Startup time dependency from <package> import module
  14. 14. Runtime dependency self.collaborator.message()
  15. 15. Global State Problem Implicit dependency problem Concrete API
  16. 16. No dependency injection Implicit dependency problem Concrete API
  17. 17. Duck Typing Approved!!!
  18. 18. Liskov Substitution principle violation
  19. 19. Python don't force type inheritance For API implementation (So, for reuse code, prefer Composition)
  20. 20. Derived types must be completely substitutable for their base types
  21. 21. It isn't so important
  22. 22. A narrow interface is a better interface
  23. 23. SOLID Motivational Posters, by Derick Bailey http://lostechies.com/derickbailey/2009/02/11/solid-development-principles-in-motivational-pictures/
  24. 24. car_wash code example https://github.com/aleasoluciones/car_wash SOLID definition (at wikipedia) http://en.wikipedia.org/wiki/SOLID_(object-oriented_design) Getting a SOLID start (Uncle Bob) http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod Video SOLID Object Oriented Design (Sandi Metz) http://www.confreaks.com/videos/240-goruco2009-solid-object-oriented-design
  25. 25. Thanks !!! @eferro @pasku1 @apa42 @nestorsalceda
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×