Ep 107: Idempotify!

Ep 107: Idempotify!

Update: 2024-01-18
Share

Description

Each week, we discuss a different topic about Clojure and functional programming.


If you have a question or topic you'd like us to discuss, tweet @clojuredesign, send an email to feedback@clojuredesign.club, or join the #clojuredesign-podcast channel on the Clojurians Slack.


This week, the topic is: "handling endless errors". We discover when giving up is the way to get ahead.


Our discussion includes:



  • Finishing up our Sportify tracer-bullet implementation.

  • What context can you put in a file name?

  • Tricks on working with time information.

  • Trying to "fix" a situation vs adding more context.

  • What is a "positive representation" of a problem?

  • What are "fundamental" versus "derived" facts?

  • What information tends to be more stable?

  • What information should you try to co-locate?

  • How do you handle resources that are not currently available?

    • How many times should you retry?

    • How long should you wait between retries?

    • How do you figure that out?



  • What is idempotency? How can it help?

  • At what point should you stop trying to handle errors?

  • Can you have too much automation?

  • How can you troubleshoot intermittent problems?


Selected quotes




  • We don't need a time zone offset because we know it's in UTC!




  • In the spirit of building up the language to meet our domain, we can write a pure function!




  • We want a deterministic way to go from this kind of common information into all the other bits of derived information.




  • I was really hoping that we would finally be done with the errors and we could just get a highlight clip, but yet again, the world has conspired against us to make our life difficult as a programmer!




  • Hold on! Hold on! The first thing we should do is run our process again because maybe the error will just go away!




  • The problem does not go away in this instance. The problem just goes back to being hidden!




  • The frustrating thing about programming is that code will do exactly what you told it to do.




  • Clojure is already positive about nothing, that's what we call nil, so why not be positive about bad stuff too?




  • Now I'm personifying the function as myself!




  • It's better to reference information by its main identifier as opposed to some derived identifier.




  • The context is all over the place: some context in memory, some context in the file system, and some intermediate context in the imperative function.




  • That's the last problem we encounter, right? You never know what the world's going to throw at you!




  • Why don't we just run it again? Let's just run it again! Maybe it'll be ready now... Maybe now... Maybe it will be ready now...




  • And then we hit another error which is: the MAM rejects us for making too many requests!




  • How long do you wait? Should you back off? That adds a lot of complexity to the code at that level.




  • Because adding idempotency increases the complexity of that part of the solution, we only want to add it where it's necessary.




  • The error condition is happening right now, so let's write the code to fix it right now.




  • That's the way automation is at some point in time: a human needs to do it.




  • You can find yourself in a situation where you're trying to do too many automatic things. Is it really worth doing? You cannot solve every possible permutation once you're interacting with the real world.




  • It's okay to put up the guardrails, and if I'm outside them, robot me throws up my hands and says, "Human please!"




  • But what happens when you run it again and the clip is ready? Now your retry logic doesn't get tested.




Links


Comments 
loading
In Channel
Ep 118: Pure Parts

Ep 118: Pure Parts

2024-06-2728:28

Ep 116: The Main Focus

Ep 116: The Main Focus

2024-05-1622:44

Ep 115: The Main Event

Ep 115: The Main Event

2024-05-0928:42

Ep 113: Highlightify!

Ep 113: Highlightify!

2024-02-2927:13

Ep 112: Purify!

Ep 112: Purify!

2024-02-2233:20

Ep 111: Loopify!

Ep 111: Loopify!

2024-02-1528:54

Ep 110: Contextify!

Ep 110: Contextify!

2024-02-0823:22

Ep 109: Extractify!

Ep 109: Extractify!

2024-02-0126:35

Ep 108: Testify!

Ep 108: Testify!

2024-01-2522:42

Ep 107: Idempotify!

Ep 107: Idempotify!

2024-01-1831:53

Ep 106: Robustify!

Ep 106: Robustify!

2024-01-1130:37

Ep 105: Codify!

Ep 105: Codify!

2024-01-0425:42

Ep 104: Assembleify!

Ep 104: Assembleify!

2023-12-2135:03

Ep 103: Explorify!

Ep 103: Explorify!

2023-12-1432:15

Ep 102: REPLify!

Ep 102: REPLify!

2023-12-0728:11

Ep 101: Sportify!

Ep 101: Sportify!

2023-11-3017:03

loading
00:00
00:00
1.0x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Ep 107: Idempotify!

Ep 107: Idempotify!

Christoph Neumann and Nate Jones