Building a Fluent API in TypeScript
Who is Ryan?
Prefer Ember to Angular and React (for big stuff)
Good at Google-ing
- Twitter: @RyannosaurusRex
- Web: ryanhayes.net
- Dat Snapchat: ItsRyanOh
- Wherever Social Medias Are Sold
Method Chaining in jQuery
Each method's return value is the updated element.
Method Chaining in Gulp
Each .pipe() is a new line of configuration.
Method Chaining is:
- Passing the the context to the next method through the return value of the previous method.
- Good for modifying a thing (changing state)
- Sequence of things that happen w/in a context
- Short, sweet, and to the point
- Basically Method Chaining
- With a hierarchy
- And Sentinel Value
- Great for
- Builder Objects
- Bad For
- Complexity inside the API
- Can design yourself into a corner
- Most regular things
Be intentional about your API
TDD shines with Fluent APIs
Watch sentinel methods that rely on children (transactions)