Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Writing Code That Lasts - #Magento2Seminar, Utrecht

708 views

Published on

As developers we write code everyday, only to frown at it a week after that. Why do we have such a hard time with code written by others and ourselves, this raging desire to rewrite everything we see? Writing code that survives the test of time and self judgment is a matter of clarity and simplicity. Let's talk about growing, learning and improving our code with calisthenics, readability and good design.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Writing Code That Lasts - #Magento2Seminar, Utrecht

  1. 1. Writing code that lasts. Rafael Dohms
 @rdohms photo: djandyw.com #ocforphp
  2. 2. Writing code 
 you won’t hate tomorrow. Rafael Dohms
 @rdohms photo: djandyw.com #ocforphp
  3. 3. Rafael Dohms or @rdohms on twitter Bella
  4. 4. photo: Rob Allen (@akrabat)
  5. 5. REWRITE ALL THE CODE! image: hyperboleandahalf
  6. 6. Real Developers, SHIP STUFF. photo: Glyn Lowe Photoworks
  7. 7. How do we find balance? photo: Kalexanderson
  8. 8. Code has an expiration date photo: CarbonNYC
  9. 9. Code is perishable, it rots. photo by: massdistraction
  10. 10. Code Evolves photo by: kevin dooley
  11. 11. Languages evolve. photo by: raneko
  12. 12. You evolve. photo by: Kaptain Kobold
  13. 13. Complexity 
 kills Comprehension photo: osbornb
  14. 14. Bad Design photo: miskan
  15. 15. Bad specs
  16. 16. NIH | nɒt ɪnˈventɪd hɪə |
 Not Invented Here —The German art of humiliating any technology, agricultural product, or (medical) scientific work that has not been invented or produced in Germany, Switzerland, or Austria. source: Urban dictionary photo by: John 'K'
  17. 17. The Solution™ photo: Ian Sane
  18. 18. Improve code make it easier to comprehend make it flexible make it tested make it easier to replace, refactor make it not exist
  19. 19. Testing photo by: jeffkrause
  20. 20. Good Design Concepts
  21. 21. SOLID Single Responsibility
 Open and Close
 Liskov substitution
 Interface Segregation
 Dependency Inversion
  22. 22. STUPID Singleton
 Tight Coupling
 Untestability
 Premature Optimization
 Indescriptive Naming
 Duplication
  23. 23. Design Patterns photo by halloweenstock
  24. 24. Package Managers
  25. 25. Composer
  26. 26. PIE Proudly
 Invented
 Elsewhere
  27. 27. Readability photo: Morgenland
  28. 28. paragraphs photo: Trossachs Photography
  29. 29. whitespace
  30. 30. R&D Team for MIH/Naspers São PauloCape Town
  31. 31. Object Calisthenics photo by: boston_public_library
  32. 32. Calisthenics /ˌkaləsˈTHeniks/ Calisthenics are a form of dynamic exercise consisting of a variety of simple, often rhythmical, movements, generally using minimal equipment or apparatus. photo by: boston_public_library
  33. 33. Its about perception, not rules or standards photo by: david_a_l
  34. 34. #1 Only one indentation level per method. photo by: justinliew
  35. 35. #2 Do not 
 use else photo by: justinliew
  36. 36. #3 Wrap primitive types, if they contain behavior photo by: justinliew
  37. 37. $component->repaint(false);
  38. 38. $component->repaint( new Animate(false) );
  39. 39. #4 Only one 
 -> per line photo by: justinliew
  40. 40. #5 Do not abbreviate. photo by: justinliew
  41. 41. if($sx >= $sy) { if ($sx > $strSysMatImgW) { $ny = $strSysMatImgW * $sy / $sx; $nx = $strSysMatImgW; } if ($ny > $strSysMatImgH) { $nx = $strSysMatImgH * $sx / $sy; $ny = $strSysMatImgH; } }
  42. 42. #6 Keep your classes small. photo by: justinliew
  43. 43. #7 Limit your instance variables to less then 5 photo by: justinliew
  44. 44. #8 Use first class collections photo by: justinliew
  45. 45. #9 Don’t use getters and setters. photo by: justinliew
  46. 46. #10 Document your code. photo by: justinliew
  47. 47. Your turn.
  48. 48. Improve yourself!
  49. 49. Read lots of code!
  50. 50. Write simple code.
  51. 51. Try Object Calisthenics for a month.
  52. 52. Use someone else’s code.
  53. 53. Share bite size libraries.
  54. 54. Thank you. http://slides.doh.ms http://doh.ms @rdohms https://joind.in/talk/745ec
  55. 55. http://l.doh.ms/oc-material Video recording Slides Books Resources on 
 Object Calisthenics

×