Unconditional Code - Michael Feathers (https://www.youtube.com/watch?v=AnZ0uTOerUI)

./resources/video-unconditional-code-michael-feathers.resources/screenshot.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.1.png

Null Object Pattern ./resources/video-unconditional-code-michael-feathers.resources/screenshot.2.png something bad has happened, but we’ll act like it didn’t others: NaN, [], null, special case

./resources/video-unconditional-code-michael-feathers.resources/screenshot.3.png that error is part of our domain

same in functional ./resources/video-unconditional-code-michael-feathers.resources/screenshot.4.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.5.png error has moved to the place where the error occurred ./resources/video-unconditional-code-michael-feathers.resources/screenshot.6.png when successful, do this

./resources/video-unconditional-code-michael-feathers.resources/screenshot.7.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.8.png

-–

Example ./resources/video-unconditional-code-michael-feathers.resources/screenshot.9.png count # groups of ‘1’ (blue here)

./resources/video-unconditional-code-michael-feathers.resources/screenshot.10.png “edgy code”, it has a lot of edge cases

./resources/video-unconditional-code-michael-feathers.resources/screenshot.11.png add 0 at front, removes one edge ./resources/video-unconditional-code-michael-feathers.resources/screenshot.12.png we eliminated an edge, by extending the domain

example ./resources/video-unconditional-code-michael-feathers.resources/screenshot.13.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.14.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.15.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.16.png makes it more general, can now work with multiple files generalizing the problem a bit, so that things that can occur can be okay

./resources/video-unconditional-code-michael-feathers.resources/screenshot.17.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.18.png extend the range of input so some things are not an error

not here: ./resources/video-unconditional-code-michael-feathers.resources/screenshot.19.png

we do here: ./resources/video-unconditional-code-michael-feathers.resources/screenshot.20.png

make a bet: when you extend the domain, people will understand that

./resources/video-unconditional-code-michael-feathers.resources/screenshot.21.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.22.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.23.png

2 parts of the program

  1. checking
  2. do stuff

./resources/video-unconditional-code-michael-feathers.resources/screenshot.24.png area where there is no need of error checking

option monad in haskell, mimicked in haskell) ./resources/video-unconditional-code-michael-feathers.resources/screenshot.25.png output = - cumulative error message - or - actual output => mixed feeling

./resources/video-unconditional-code-michael-feathers.resources/screenshot.26.png exceptions should be like a time machine (like transactions)

intention can succeed or fail

example: shuffle ./resources/video-unconditional-code-michael-feathers.resources/screenshot.27.png

5 why when designing ./resources/video-unconditional-code-michael-feathers.resources/screenshot.28.png

error handling: distance between detecting problem and what you go and do about it if I can’t read a config, can I use a default config + notify?

always question errors can’t eliminate entirely but can we restructure the system so as to remove this error?

tended systems vs untended systems ./resources/video-unconditional-code-michael-feathers.resources/screenshot.29.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.30.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.31.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.32.png

supervisor trees = mimic the human

cost choice safety choice

./resources/video-unconditional-code-michael-feathers.resources/screenshot.33.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.34.png

./resources/video-unconditional-code-michael-feathers.resources/screenshot.35.png

counter-intuitive ./resources/video-unconditional-code-michael-feathers.resources/screenshot.36.png care happens when there is hazard

vs: rust - prevent things from happening erlang - react to when they happen

./resources/video-unconditional-code-michael-feathers.resources/screenshot.37.png