DEV Community

Discussion on: Invert your JavaScript

Collapse
 
tsimms profile image
Tim Simms

What if you wanted to accommodate different toast-making processes, rather than having one constant method of doing so. Maybe I want to make kid toast, which involves cutting off the edges, but only after I've applied the butter and the jam. Or maybe when I'm making low-carb toast, I can't use any jam.

How would you incorporate those rules into the available injections?

Collapse
 
gnomff_65 profile image
Timothy Ecklund

Great questions!

  • Cutting off the crust would be another step, so we would need to update our protocol. We could have a Plating behavior that would let you trim or cut or otherwise spruce up your toast
  • Rules about which kinds of bread can use which kinds of jams are outside of the scope of our defined protocol. We would have to have a system in place for building the set of behaviors programmatically, and we could encode those rules in that system, maybe as some kind of validator.