Full Stack Fest - 2016
@anmonteiro90
Clients in control
building demand-driven
systems with Om Next
Slide 2
Slide 2 text
No content
Slide 3
Slide 3 text
REST: expectations
• define logical “resources”
• identified by URIs
• clients request them
Slide 4
Slide 4 text
REST: reality
• can only request / create trivial data
• “joined” resources
• bloat endpoint?
• multiple requests?
Slide 5
Slide 5 text
– Roy T. Fielding, PhD
“The trade-off, though, is that a uniform
interface degrades efficiency, since information
is transferred in a standardized form rather
than one which is specific to an application's
needs.”
Slide 6
Slide 6 text
Luke Wroblewski
Slide 7
Slide 7 text
No content
Slide 8
Slide 8 text
No content
Slide 9
Slide 9 text
“Demand-driven” architecture
Slide 10
Slide 10 text
1. Demand
Slide 11
Slide 11 text
2. Composition
Slide 12
Slide 12 text
3. Interpretation
Slide 13
Slide 13 text
“[…] GraphQL is a “query language”
just like URLs are the “query language”
of REST—it’s a contract that describes
how to tell the API server what you’re
looking for.”
– Sashko Stubailo, Meteor
http://goo.gl/qR9szX (Medium)
“used to hit a RESTful API server at Facebook
[…]. In transitioning to GraphQL, we deleted
tons of code. […] it ended up being
dramatically simpler from the client's point of
view.”
– Lee Byron, GraphQL Engineer
https://javascriptair.com/episodes/2016-05-18
1. clients can request the exact total
response they need
2. clients can communicate novelty
atomically
• without sacrificing relational queries on
the server
Slide 23
Slide 23 text
Om Next opinions
• Single source of truth
• Minimize flushing to DOM
• No (visible)
• asynchrony
• event model
Slide 24
Slide 24 text
Checkpoint
• Precise requests?
• Client
• Server
• Communicate novelty?
• Communicate
identity back?
• Data over the wire?
• Client-only state
• Testing
• Caching
• Pluggable client /
server storage?
Om Next + test.check
• queries / mutations are data
• generate transactions
• run against the parser
• check invariants in resulting state
Slide 50
Slide 50 text
Demo
Slide 51
Slide 51 text
Testing recap
1. Generate random transactions
2. Shrink failures
3. Use minimal failure to reproduce bugs
Slide 52
Slide 52 text
Testing recap
1. Generate random transactions
2. Shrink failures
3. Use minimal failure to reproduce bugs
Slide 53
Slide 53 text
More Om Next
• Recursive UIs
• Heterogeneous
UIs
• HTTP Caching
• Custom storage
• Streaming
• Server-side
rendering
Slide 54
Slide 54 text
Server
• Clojure preferred / less boilerplate
• Other languages -> implement parser logic
• easier for languages with Transit
• Datomic supported by default
• other DBs work as well
Slide 55
Slide 55 text
Project status
• Beta next week
• documentation
• github.com/omcljs/om/wiki
• awkay.github.io/om-tutorial/
• anmonteiro.com
Slide 56
Slide 56 text
Takeaways
• we can radically simplify UI
programming
• regardless of library / framework
• strive for simple systems
• with these 2 properties