The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Introducing run() and driver functions

Introducing run() and driver functions

4:06
The last part of the code we wrote is neither logic nor effects. It is code which ties together logic (main) with effects. We can encapsulate that in a run() function. This lesson shows how we can structure these pieces together, and generalize effect handling with "drivers".
Watch this lesson now
Avatar
egghead.io

The last part of the code we wrote is neither logic nor effects. It is code which ties together logic (main) with effects. We can encapsulate that in a run() function. This lesson shows how we can structure these pieces together, and generalize effect handling with "drivers".

Avatar
Samuel Sharpe

If you comment out Log: from main(), it will still throw an error. I think run() would need to check the keys before running each effects https://jsbin.com/fahazihahe/1/edit?html,js,console,output?

Avatar
Andre

Samuel, correct! That if statement slipped from me when recording, and the program still executed. However, we quickly introduced the official Cycle.run(), which I mentioned has enough error checks. The point of this lesson is to understand what run() is responsible for.

In reply to Samuel Sharpe
Avatar
BigAB

So close to calling it Log Driver
https://www.youtube.com/watch?v=upsZZ2s3xv8
...so close

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?