Giter Club home page Giter Club logo

Comments (2)

illicitonion avatar illicitonion commented on June 16, 2024

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

  • We know about dependency injection, when people take dependency injection to extremes they end up with too many parameters, they often extract a context object to contain them all (prompt discussion about global state, about the down-sides of God objects, ...).
  • Context is a place to shove global-like data that we want to use a lot of places. But we generally shouldn't.
  • Introduce With-prefixed functions (and maybe contrast with other persistent data structures / builders / ...)
  • Talk through WithValue with a user ID as an example
  • Talk through WithTimeout and Done as just a library written using WithValue.

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

from immersive-go-course.

lauranooooo avatar lauranooooo commented on June 16, 2024

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.

from immersive-go-course.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.