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.

Software punk

491 views

Published on

Controversial ideas in Software Development That just might work.

Published in: Software
  • Be the first to comment

Software punk

  1. 1. Software Punk Lior Bar-On, 2016 Controversial ideas in Software Development That just might work. Source: songpop.wikia.com
  2. 2. Who is this Guy? (Lior Bar-On) ‫תוכנה‬ ‫ארכיטקטורת‬ ‫בלוג‬ Developer Architect Chief Architect Blogger
  3. 3. Inheritance & OO Source: schedule.sxsw.com
  4. 4. Inheritance is a bold violation of OO Principles! 1. Encapsulation (“‫)”הכמסה‬ 2. PolyMorphism (“‫)”ריבוי-צורות‬ 3. Inheritance (“‫)”הורשה‬ Violation
  5. 5. Flawed Inheritance Code Example
  6. 6. Composition > Inheritance “... our second principle of object-oriented design: Favor object composition over class inheritance. ” Source: http://slidedeck.io/parnurzeal/why-opensource-slides Source: Addison wesley
  7. 7. A moment of Skepticism... while (condition_always_true) { // do something ... }
  8. 8. Inheritance as tool for (poor?) abstractions
  9. 9. Inheritance as tool for (poor?) abstractions
  10. 10. Inheritance as tool for (poor?) abstractions ?
  11. 11. Inheritance as tool for (poor?) abstractions
  12. 12. Inheritance as tool for (poor?) abstractions ?
  13. 13. Inheritance as tool for (poor?) abstractions ?
  14. 14. Inheritance as tool for (poor?) abstractions ?
  15. 15. Inheritance as tool for (poor?) abstractions Black Cab → A, B, C, D Yellow Cab → A, E, F Green Cab → A, B, D, E Scooter → C, E, G PHV → B, C, F
  16. 16. Inheritance breaking our reading flow ? ?
  17. 17. Recap Inheritance can cause “unexpected behavior” - but it is rare. Inheritance (“is-a” delegation) is too limited to expressed real world domain objects. Use Inheritance only with dead-simple cases. 1 2 In some programming languages, Inheritance makes the code less expressive.3
  18. 18. Bad, bad Abstractions
  19. 19. D.R.Y Happiness! DRY = Don’t Repeat Yourself Source: dreamstime
  20. 20. D.R.Y Happiness @Gett-API
  21. 21. HTTP Retry: The POST case ... IDEMPOTENT_METHODS = [“GET”, “PUT”] if method in IDEMPOTENT_METHODS { // http request retry } ...
  22. 22. HTTP Retry: The POST case #2 ... if can_retry { if _err == CONNECTION_ERROR { // http request retry } } ...
  23. 23. The Safe Methods case ... if method == “GET” { // use cache } ...
  24. 24. The Safe Methods Case #2 - POST (reading) ... if is_cacheable { // use cache } ...
  25. 25. Cache TTL settings ... // some logic with cache times... ...
  26. 26. The Fallback cache Case ... if _err == CONNECTION_ERROR { // try to load response from fallback cache } ...
  27. 27. Not very DRY, but simpler!
  28. 28. Code Duplication is mushrooming
  29. 29. The non-visible dependencies of that system...
  30. 30. Recap Not only code Rots. Abstractions Rot too. It’s okay to occasionally favor Code Duplications and avoid non-meaningful abstraction. When an Abstraction rots: Stop. do a reverse, and return the code duplication. 1 2
  31. 31. You Spend too much on Unit Tests
  32. 32. Automation “should” improve things... Source: Lucidcharts
  33. 33. There are several ways to achieve high quality.... Source: profiles.com.sg
  34. 34. Type A: Codename “Lisa” (a Unit Test) Source: a presentation by Lior Bar-On
  35. 35. Type A: Codename “Lisa” (a Unit Test) Source: a presentation by Lior Bar-On Isolated unit test
  36. 36. Type B Codename “Bart” Source: a presentation by Lior Bar-On
  37. 37. Type B Codename “Bart” Source: a presentation by Lior Bar-On Unit-Integration Test Integration Test
  38. 38. Type B Codename “Bart” Source: a presentation by Lior Bar-On Example: Aggregating 11 model methods into a single test
  39. 39. Type C - Codename “Cat In The Hat” Source: marocdeserttours.wordpress.com
  40. 40. Type C - Codename “Cat In The Hat” Great Production Monitoring /w Continuous Deployment
  41. 41. Type C - Codename “Cat In The Hat” Source: marocdeserttours.wordpress.com Ideal Target: when covering 90%+ of the cases is not possible - or just too expensive
  42. 42. Recap Unit Tests is great - but it has its costs. It fit perfectly for logical code units (if / for) Integration / Unit-Integration tests are more broad - but more cost efficient. 1 2 Sometimes, it worth monitoring things only on production. When done well - it can be cheap, otherwise - very expensive. 3
  43. 43. Don’t take things for granted

×