CodeYourFuture / immersive-go-course

An immersive, introductory course to backend software engineering using go.
https://systems.codeyourfuture.io/
Creative Commons Zero v1.0 Universal
89 stars 81 forks source link

Add some reference material on golang Context #187

Open illicitonion opened 1 month ago

illicitonion commented 1 month ago

Both of our Cohort 2 trainees have raised existential questions around Context. We may want to find some useful references or write up some material about this.

We may even want to make a "implement WithTimeout using WithValue" exercise to show that there's no magic here, it's really just a fancy key-value store.

(I've also gone on a tangent around persistent data structures when talking through this, unclear whether that's actually useful/worthwhile :))

illicitonion commented 1 month ago

The journey I've typically used to explain this is:

@bazmurphy had also encountered React's Context hooks which implement a similar pattern.

lauranooooo commented 1 month ago

that is a good thought, IMO. I am sure we must be using timeout somewhere. we certainly have material on the need for timeouts in the primer, don't we? i think we could probably weave this into at least one of the exercises. maybe with some explicit demos of client cancellation as well, and a description of why that's useful.