Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Seeking System Zen with Universal TypeScript

Seeking System Zen with Universal TypeScript

Rachael McQuater

November 30, 2018
Tweet

More Decks by Rachael McQuater

Other Decks in Programming

Transcript

  1. THE LIFE OF A FULL STACK DEV What kinds of

    problems do we have? ▸ Getting FE and BE to communicate ▸ Many external systems ▸ Keeping a big, polyglot stack running reliably
  2. BUT WHAT KINDS OF PROBLEMS WOULD WE LIKE TO HAVE?

    ▸ Domain problems ▸ UX problems ▸ hard problems.
  3. THE TROUBLE IS, WE'RE human. We are super terrible at

    enumerating all conditions. Consider: ▸ Edge cases ▸ Error states ▸ Future refactoring
  4. SO, WE'VE GOT A COMMUNICATION GAP HERE Computers are good

    at... ▸ Fast calculations ▸ Big datasets Humans are good at... ▸ Pattern recognition
  5. SO WHEN ARE WE GONNA GET TO THE TYPESCRIPT? Right

    now! Let's talk about what TS is.
  6. Instead of: ▸ first do A to x ▸ then

    do B to x ▸ evaluate x We say: ▸ y = f(g(x))
  7. if... ▸ g(x) maps from verbalOrders to drinks, ▸ f(x)

    maps from drinks to baristaInstructions then... We can safely compose f(g(x)) & statically prove that our OrderTaker works.
  8. PICKING A FRAMEWORK The ideal framework for a type-first UI

    would: ▸ Declaratively generate UI ▸ Describe visual components as pure functions of inputs
  9. So, we have UI that takes tightly scoped types as

    inputs. What if we used our domain types as inputs to that UI?
  10. Thanks to: ▸ Drew Colthorp for sharing the tech stack

    & all the TS knowledge ▸ Atomic Object for being an awesome place full of awesome FP nerds ▸ The TypeScript Team for building a rad-as-heck language Rachael McQuater [email protected] See also: https://github.com/atomicobject/ts-react-graphql-starter-kit https://github.com/atomicobject/ts-workshop