Oop design magma rails 2011

  • 145 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
145
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Isn’t this a design sofftek developer Skill traciende lenguajes Las bases que TODOS debemos patterns talk? tener.Friday, October 14, 2011
  • 2. aqui me pararia y me largaba Object Oriented Design - BasicsFriday, October 14, 2011
  • 3. ME Como me siento? Con quienes he colaborado? En que cosas te apasionas? • Emmanuel Delgado • Ingeniero de Software para Crowd Interactive • UAA, INEGI, Softtek • PHP, Perl, Javascript, Java, Ruby • Apasionadazo • @chischaschosFriday, October 14, 2011
  • 4. What makes a system complicated? code smell, you feel it mario c nice code, shit happens eveywhere same old problemsFriday, October 14, 2011
  • 5. un cambio implica tocar muchos lugares RigidityFriday, October 14, 2011
  • 6. cambio rompe lugares inesperados FragilityFriday, October 14, 2011
  • 7. dificil hacer la cosa correcta de diseño de ambiente ViscosityFriday, October 14, 2011
  • 8. duplicidad no puedes reutilizar componentes componentes utiles, pero separar es muy complicado ImmobilityFriday, October 14, 2011
  • 9. mas de lo que ocupas anticipas a requerimientos hard to understand Unnecessary complexityFriday, October 14, 2011
  • 10. resultado de reutilizar codigo copy paste Unnecessary duplicityFriday, October 14, 2011
  • 11. la imagen es la misma tendencia dificil de entender codigo puede ser claro y legible requieres esfuerzo constante para seguir siendo leguible OpacityFriday, October 14, 2011
  • 12. Rotten system usual smells • Rigidity • Fragility ocurren poco a poco un commit a la vez • Viscosity • Immobility • Unnecessary duplicity and complexity • OpacityFriday, October 14, 2011
  • 13. small building blocks small shapes Pequeñas formas -> grandes diseños Bellos? Small components design principlesFriday, October 14, 2011
  • 14. Single Responsibility (SR)Friday, October 14, 2011
  • 15. SR- How do I achieve it?Friday, October 14, 2011
  • 16. SR - Analyze your object • Delegate • Encapsulate what changesFriday, October 14, 2011
  • 17. SR - Delegate?Friday, October 14, 2011
  • 18. SR - Delegate! in rubyFriday, October 14, 2011
  • 19. SR - Delegate! in rubyFriday, October 14, 2011
  • 20. SR - Delegate! with railsFriday, October 14, 2011
  • 21. SR - Delegate! with railsFriday, October 14, 2011
  • 22. SR - Encapsulate what changes interview question Que es encapsular, ejemplo ftp uploader como ayuda churn, idealmente los No picos +------------------------------------+---------------+ | file_path | times_changed | +------------------------------------+---------------+ | lib/churn/churn_calculator.rb | 14 | | README.rdoc | 7 | | lib/tasks/churn_tasks.rb | 6 | | Rakefile | 6 | | lib/churn/git_analyzer.rb | 4 | | VERSION | 4 | | test/test_helper.rb | 4 | | test/unit/churn_calculator_test.rb | 3 | | test/churn_test.rb | 3 | +------------------------------------+---------------+Friday, October 14, 2011
  • 23. OC - Open for extension closed for modificationFriday, October 14, 2011
  • 24. OC - Don not reopen an objectFriday, October 14, 2011
  • 25. OP - Encapsulate and extend itFriday, October 14, 2011
  • 26. OC - Composition over inheritanceFriday, October 14, 2011
  • 27. OC - Composition implementedFriday, October 14, 2011
  • 28. Dependency Inversion (DI)Friday, October 14, 2011
  • 29. DI - What is a dependency? dependencia agrega responsabilidades responsabilidad da razones para cambiar vas a tener que hacer cambios entre menos mejor, asi gastas mas tiempo creando codigo obra d arteFriday, October 14, 2011
  • 30. DI - Depend upon abstractions Si tu clase emplea servicios externos, o tiene muchas librerias requeridas, o ves demasiadas constantes, utilizalas tan tarde como puedas.Friday, October 14, 2011
  • 31. Basic suggestions • Only one responsibility per object • Encapsulate what changes • Depend upon abstractions • Delegate responsibilities • Composition over inheritance • Extend components, do not reopen themFriday, October 14, 2011
  • 32. patrones de diseño alguien identifico problemas comunes formas se repiten evita crear patrones hasta el ultimo momento Afterwards common shapes will ariseFriday, October 14, 2011
  • 33. Observer • THINK: monitoring behaviorFriday, October 14, 2011
  • 34. Observer - An observerFriday, October 14, 2011
  • 35. Observer - The observedFriday, October 14, 2011
  • 36. Strategy • THINK: Interchangeable algorithmsFriday, October 14, 2011
  • 37. Strategy como llegas aqui? cuando un metodo ya tiene varios branchingsFriday, October 14, 2011
  • 38. gy - Interchangeable algorithms como llegas aqui? cuando un metodo ya tiene varios branchings Friday, October 14, 2011
  • 39. Proxy • THINK: Wrapping object behavior, forward callsFriday, October 14, 2011
  • 40. ProxyFriday, October 14, 2011
  • 41. Template • THINK: Predefined stepsFriday, October 14, 2011
  • 42. Template- Required?Friday, October 14, 2011
  • 43. Template- ImplementedFriday, October 14, 2011
  • 44. Decorator • THINK: Present new content based on original contentFriday, October 14, 2011
  • 45. Decorator - required?Friday, October 14, 2011
  • 46. Decorator - implementedFriday, October 14, 2011
  • 47. THE ENDFriday, October 14, 2011
  • 48. Conclusion • Follow damn simple principles • Do not program upon design patterns, let them arise by themselves • Refactor to design patternsFriday, October 14, 2011
  • 49. References - 1Friday, October 14, 2011
  • 50. References - 2 • CHURN: https://github.com/danmayer/churn • http://vimeo.com/12350535 • http://vimeo.com/26330100 • http://confreaks.net/videos/257-larubyconf2009-the-building- blocks-of-modularity • https://www.destroyallsoftware.com/screencastsFriday, October 14, 2011
  • 51. References - 3Friday, October 14, 2011
  • 52. References - 4 pregunta para ustedes como mantienes el diseño dia tras dia? boy scout rule tdd refactor all the fucking timeFriday, October 14, 2011