Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
danielfisher.com
Defensive Programming,
Daniel Fisher
Resilience Patterns &
Antifragility
danielfisher.com
I’m a technician & always concerned about bandwidth
So I ask you to send one packet instead of two
DANIEL...
danielfisher.com
software
I design, develop, deploy, teach, train, coach and speak
HTML5 & WEB, DATA ACCESS & PERFORMANCE,...
danielfisher.com
THAT IS ALL THAT I DEEPLY BELEVE IN
D I S C L A I M E R
IT FITS MY SHOES
IT MIGHT NOT FIT YOURS
THIS PRES...
danielfisher.com
CHAPTER 1
Software Development: A world of fear
danielfisher.com
https://www.flickr.com/photos/38295844@N05/4980776534/
danielfisher.com
https://www.flickr.com/photos/pagedooley/2398572388/
danielfisher.com
http://www.city-data.com/forum/anchorage/692696-anchorage-here-we-come-finally.html
danielfisher.com
BOSS
danielfisher.com
“Office Space” by Mike Judge / Twentieth Century Fox Film Corporation
danielfisher.com
CHANGE
danielfisher.com
https://www.flickr.com/photos/bluedharma/89186151
danielfisher.com
https://www.flickr.com/photos/armydre2008/3144377781
danielfisher.com
RELEASE
danielfisher.com
Time
Change
Big…
Small…
danielfisher.com
“Fight Club” by David Fincher / Twentieth Century Fox Film Corporation
danielfisher.com
FAIL
danielfisher.com
https://www.flickr.com/photos/38403488@N08/5100179116
danielfisher.com
I have not failed!
I've just found
10,000 ways that
won't work …Thomas Edison
danielfisher.com
CHAPTER 2
Paranoia basics: Defensive programming
danielfisher.com
https://www.flickr.com/photos/ajahan/8413794849
danielfisher.com
Yoda Conditions
if (variable.Equals("literal"))
{
...
}
if ("literal".Equals(variable))
{
...
}
danielfisher.com
Check Collections for Null
var files = SomeApi.GetFileList();
if (files != null)
{
for (var i = 0; i < fi...
danielfisher.com
All classes are sealed by default
public class Class1
{
...
}
internal sealed class Class1
{
...
}
danielfisher.com
DDD Value Object Input Validation
public sealed class ZipCode
: IValueObject
{
public ZipCode(int value)
...
danielfisher.com
CHAPTER 3
Advanced paranoia tactics: Robustness
danielfisher.com
CULTURE
IT’S ALL ABOUT
danielfisher.com
Finding Bugs is
good and mustn’t
be punished!
It makes code
less buggy!
danielfisher.com
Finding Bugs in
tests is even
better!
No customer will
even face them!
danielfisher.com
Try to break, burn,
shoot and drown
it together!
I call it
Breakstorming!
danielfisher.com
CHAPTER 4
Professional Paranoia: Resilience patterns
danielfisher.com
A distributed system
is one in which the failure
of a computer you didn't
even know existed can
render
yo...
danielfisher.com
danielfisher.com
Topology changes
Networks fail
Latency varies by location
Bandwidth differs by location
Things get hacked
danielfisher.com
Servers get rebooted
Code has bugs
Other users might use it different
Failover means offline
Processing t...
danielfisher.com
Life is not a
walk in the park.
neither is software!
danielfisher.com
Success is the ability
to go from one
failure to another
with no loss of
enthusiasm.
WinstonChurchill
danielfisher.com
Scale like a boss
Asynchronicity
No one waiting for an error
Bulkheads & Replays
Loose coupling for the w...
danielfisher.com
BASE OVER ACID
Atomic, Consistent, Isolated and Durable
solutions are not a silver bullet.
Basic Availabi...
danielfisher.com
Idempotency
Non-idempotency is complicated to handle
and increases coupling between participants.
statele...
danielfisher.com
Monitor & Audit
Measure to gain latency control and detect non-
timely responses before they time out.
Le...
danielfisher.com
Retry Pattern
https://www.flickr.com/photos/st3f4n/143623217
danielfisher.com
Circuit Breaker Pattern
https://www.flickr.com/photos/qubodup/8278039181
danielfisher.com
Leader Election Pattern
http://moonbasetshirts.limitedrun.com/products/557785-palpatine-vader-2016
danielfisher.com
CompensatingTransaction Pattern
https://www.flickr.com/photos/susivinh/16341538221
danielfisher.com
CHAPTER 5
Things that gain from disorder: Antifragility
danielfisher.com
Nassim Nicholas Taleb wrote two interesting books
about how economical systems behave.
He focusses on wha...
danielfisher.com
Antifragility
Resilience
Robustness
Fragile
Time
Value/Correctness/Stability/…
danielfisher.com
What Doesn't Kill You
Makes You Stronger
Every time something catastrophic
happens that you take on and s...
danielfisher.com
Asymmetric information & options
An opportunity to cope with
the lack of knowledge
ST R AT E GY
Business,...
danielfisher.com
Thank you!
danielfisher.com my company
lennybacon.com my blog url
@lennybacon my twitter handle
info@dani...
Prochain SlideShare
Chargement dans…5
×

NRWConf, DE: Defensive programming, resilience patterns & antifragility

Cloud computing, DevOps, IOT or just connecting the local active directory or {put any LOB system here}: The applications we build are getting more and more distributed. Now guess who's guilty if your application fails, because there was some error outside of your code (even outside of your control influence)? This session is about designing, developing and deploying rock solid applications.

  • Soyez le premier à commenter

NRWConf, DE: Defensive programming, resilience patterns & antifragility

  1. 1. danielfisher.com Defensive Programming, Daniel Fisher Resilience Patterns & Antifragility
  2. 2. danielfisher.com I’m a technician & always concerned about bandwidth So I ask you to send one packet instead of two DANIEL My name is Any further questions? Just Ask!
  3. 3. danielfisher.com software I design, develop, deploy, teach, train, coach and speak HTML5 & WEB, DATA ACCESS & PERFORMANCE, SCALABLE & TESTABLE DESIGN, DISTRIBUTED SYSTEMS & SERVICES, SECURITY & TRUST lennybacon.com my blog url @lennybacon my twitter handle info@danielfisher.com my smtp find my services at danielfisher.com
  4. 4. danielfisher.com THAT IS ALL THAT I DEEPLY BELEVE IN D I S C L A I M E R IT FITS MY SHOES IT MIGHT NOT FIT YOURS THIS PRESENTATION CONTAINS MY PERSONAL VIEW ON THE WORLD IT IS BASED ON MY EXPERIENCE IN SOFTWARE DEVELOPMENT PROJECTS SINCE 1996 MOST THINGS I LEARNED FROM PAIN OTHERS FROM MOMENTS OF GRACEFULNESS, BRAVENESS & SUCCESS
  5. 5. danielfisher.com CHAPTER 1 Software Development: A world of fear
  6. 6. danielfisher.com https://www.flickr.com/photos/38295844@N05/4980776534/
  7. 7. danielfisher.com https://www.flickr.com/photos/pagedooley/2398572388/
  8. 8. danielfisher.com http://www.city-data.com/forum/anchorage/692696-anchorage-here-we-come-finally.html
  9. 9. danielfisher.com BOSS
  10. 10. danielfisher.com “Office Space” by Mike Judge / Twentieth Century Fox Film Corporation
  11. 11. danielfisher.com CHANGE
  12. 12. danielfisher.com https://www.flickr.com/photos/bluedharma/89186151
  13. 13. danielfisher.com https://www.flickr.com/photos/armydre2008/3144377781
  14. 14. danielfisher.com RELEASE
  15. 15. danielfisher.com Time Change Big… Small…
  16. 16. danielfisher.com “Fight Club” by David Fincher / Twentieth Century Fox Film Corporation
  17. 17. danielfisher.com FAIL
  18. 18. danielfisher.com https://www.flickr.com/photos/38403488@N08/5100179116
  19. 19. danielfisher.com I have not failed! I've just found 10,000 ways that won't work …Thomas Edison
  20. 20. danielfisher.com CHAPTER 2 Paranoia basics: Defensive programming
  21. 21. danielfisher.com https://www.flickr.com/photos/ajahan/8413794849
  22. 22. danielfisher.com Yoda Conditions if (variable.Equals("literal")) { ... } if ("literal".Equals(variable)) { ... }
  23. 23. danielfisher.com Check Collections for Null var files = SomeApi.GetFileList(); if (files != null) { for (var i = 0; i < files.length; i++) { ... } }
  24. 24. danielfisher.com All classes are sealed by default public class Class1 { ... } internal sealed class Class1 { ... }
  25. 25. danielfisher.com DDD Value Object Input Validation public sealed class ZipCode : IValueObject { public ZipCode(int value) { // Input validation!!! Value = value; } public int Value { get; private set;} }
  26. 26. danielfisher.com CHAPTER 3 Advanced paranoia tactics: Robustness
  27. 27. danielfisher.com CULTURE IT’S ALL ABOUT
  28. 28. danielfisher.com Finding Bugs is good and mustn’t be punished! It makes code less buggy!
  29. 29. danielfisher.com Finding Bugs in tests is even better! No customer will even face them!
  30. 30. danielfisher.com Try to break, burn, shoot and drown it together! I call it Breakstorming!
  31. 31. danielfisher.com CHAPTER 4 Professional Paranoia: Resilience patterns
  32. 32. danielfisher.com A distributed system is one in which the failure of a computer you didn't even know existed can render your computer unusable http://research.microsoft.com/en-us/um/people/lamport/pubs/distributed-system.txt
  33. 33. danielfisher.com
  34. 34. danielfisher.com Topology changes Networks fail Latency varies by location Bandwidth differs by location Things get hacked
  35. 35. danielfisher.com Servers get rebooted Code has bugs Other users might use it different Failover means offline Processing time varies by amount of data Environments differ File system is not always available
  36. 36. danielfisher.com Life is not a walk in the park. neither is software!
  37. 37. danielfisher.com Success is the ability to go from one failure to another with no loss of enthusiasm. WinstonChurchill
  38. 38. danielfisher.com Scale like a boss Asynchronicity No one waiting for an error Bulkheads & Replays Loose coupling for the win But dare you forget the dead letters No cascading failures and stack trace
  39. 39. danielfisher.com BASE OVER ACID Atomic, Consistent, Isolated and Durable solutions are not a silver bullet. Basic Availability, Soft-state and Eventual consistency work better in most distributed scenarios. BUT YOU MUST THINK DIFFERENT FOR BASE Use a more relaxed consistency model to reduce coupling Queues are as transactional as databases
  40. 40. danielfisher.com Idempotency Non-idempotency is complicated to handle and increases coupling between participants. stateless stateless stateless THIS ALSO REQUIRES YOU TO THINK DIFFERENT But in the end it is nothing more than divide and conquer with an eye on the results Functional programming and immutable types for the win.
  41. 41. danielfisher.com Monitor & Audit Measure to gain latency control and detect non- timely responses before they time out. Learn more about the life of your system to predict its behavior. If you can’t debug, log is your friend Respond to detected failures. 20% - 40% logging code Auditing and Logging can even be party of your architecture
  42. 42. danielfisher.com Retry Pattern https://www.flickr.com/photos/st3f4n/143623217
  43. 43. danielfisher.com Circuit Breaker Pattern https://www.flickr.com/photos/qubodup/8278039181
  44. 44. danielfisher.com Leader Election Pattern http://moonbasetshirts.limitedrun.com/products/557785-palpatine-vader-2016
  45. 45. danielfisher.com CompensatingTransaction Pattern https://www.flickr.com/photos/susivinh/16341538221
  46. 46. danielfisher.com CHAPTER 5 Things that gain from disorder: Antifragility
  47. 47. danielfisher.com Nassim Nicholas Taleb wrote two interesting books about how economical systems behave. He focusses on what happens under stress and on unexpected occurrences of events. The black swan Antifragility
  48. 48. danielfisher.com Antifragility Resilience Robustness Fragile Time Value/Correctness/Stability/…
  49. 49. danielfisher.com What Doesn't Kill You Makes You Stronger Every time something catastrophic happens that you take on and survive… … your team and you code becomes Stronger, Better, Faster, More
  50. 50. danielfisher.com Asymmetric information & options An opportunity to cope with the lack of knowledge ST R AT E GY Business, Architecture & Code Long Term vs Short Term Sustainability vs Reward
  51. 51. danielfisher.com Thank you! danielfisher.com my company lennybacon.com my blog url @lennybacon my twitter handle info@danielfisher.com my smtp

×