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

Maneuverable Web Architecture

Maneuverable Web Architecture

Presented at GOTO Berlin 2013

Michael Nygard

October 17, 2013
Tweet

More Decks by Michael Nygard

Other Decks in Technology

Transcript

  1. Thesis ✤ Agile dev works at micro scale ✤ Won’t

    create macro scale agility Thursday, October 17, 13
  2. John Boyd ✤ Fighter pilot ✤ Air combat instructor ✤

    Military theorist Thursday, October 17, 13
  3. Note how orientation shapes observation, shapes decision, shapes action, and

    in turn is shaped by the feedback and other phenomena coming into our sensing or observing window. Also note how the entire loop (not just orientation) is an ongoing many-sided implicit cross-referencing process of projection, empathy, correlation, and rejection. From The Essence of Winning and Losing, John R. Boyd, January 1996. Feed Forward Observations Decision (Hypothesis) Action (Test) Cultural Traditions Genetic Heritage New Information Previous Experience Analyses & Synthesis Feed Forward Feed Forward Implicit Guidance & Control Implicit Guidance & Control Unfolding Interaction With Environment Unfolding Interaction With Environment Feedback Feedback Outside Information Unfolding Circumstances Observe Orient Decide Act Defense and the National Interest, http://www.d-n-i.net, 2006 Thursday, October 17, 13
  4. Cross-cutting Themes ✤ Plurality ✤ Break monoliths ✤ Use URIs

    with abandon ✤ c.f. “Architecture Without an End State” ✤ Augment upstream ✤ Contextualize downstream Thursday, October 17, 13
  5. Sufficiently Abstract UI Counterexample: 100+ countries. 6 services per country.

    UI knows which services to call UI has forms specific to each one. Thursday, October 17, 13
  6. Sufficiently Abstract UI 2 Better: Generic UI + Semantic HTML

    + Unobtrusive JavaScript Best: Above, plus either SSR or CSR, with CMS & toolkit for adaptable components. Thursday, October 17, 13
  7. Services & scripting URL μService μService script ✤ Dynamic deployment

    of script ✤ Script addressable by URL Thursday, October 17, 13
  8. Ref Value at TN Value at TN+1 Immutable values, monotonic

    succession Thursday, October 17, 13
  9. Value Semantics Ref Semantics Values do not change Change is

    atomic No observable intermediate states Equality is identity Equality based on referent Thursday, October 17, 13
  10. Value Semantics Ref Semantics Values do not change Change is

    atomic No observable intermediate states Equality is identity Equality based on referent Thursday, October 17, 13
  11. Value Semantics Ref Semantics Values do not change Change is

    atomic No observable intermediate states Equality is identity Equality based on referent Thursday, October 17, 13
  12. Example: Perpetual string ✤ Perpetual string: store strings forever. ✤

    URL is SHA-256 hash of string. ✤ Use for scripts, legal text. ✤ Edit the script, get a new URL Thursday, October 17, 13
  13. Example: Shopping Cart as Value Add: function from Cart, Item,

    Qty to Cart Remove: function from Cart, Item to Cart Cart is a number Thursday, October 17, 13
  14. Example: Shopping Cart as Value Cart0 User Cart «ref» Add

    Cart0 User Cart «ref» Cart1 Thursday, October 17, 13
  15. Generalized minimalism Feature: Send email to customer ahead of credit

    card expiration. Complexity: Number of reminders and advance notice vary by tenant. Required: Record email sent, bounced. Thursday, October 17, 13
  16. Complected solution Daily job wakes up, scans cards, creates warnings,

    sends email, checks bounces. User ID Sent on Warning ID Bounced? Token Expiration Card ID User ID User Email Thursday, October 17, 13
  17. Minimal, generalized solution At: at datetime, call this URL. Template:

    accept body + params to format text Lead time: generate series of datetimes Mailer: send email to addr, track bounces Thursday, October 17, 13
  18. Minimal, generalized solution Registration At 3. Several calls to "At".

    Provide URLs for script Script Engine 2. create new script, get URL Lead time 1. create reminder dates Reminder script Much later: invoke reminder script creates Perpetual string A. Get template Template Mailer B. Format message C. Send message Thursday, October 17, 13
  19. Issue identifiers ✤ Every service issues identifiers ✤ No restrictions

    on use Catalog Create Add Query catalog ID Thursday, October 17, 13
  20. Policy Proxy Client Query catalog ID client ID Catalog Policy

    Proxy F: client → catalog Thursday, October 17, 13
  21. Faceted identities User Ledger Cart Dept. Address Book Wish List

    Concierge Company Thursday, October 17, 13
  22. Faceted identities ✤ IDs all issued by services ✤ Relationships

    externalized Catalog Company Item SKU Microsite Prize Pool Thursday, October 17, 13
  23. Explicit context Implicit Explicit Bare identifiers URLs State names State

    machines Assumed channel Reply-to queue Thursday, October 17, 13
  24. Self-defense ✤ Required for use without permission ✤ Protect from

    overload ✤ Allow cut off of maluser ✤ Important for operational safety and authorization Client Query Catalog Policy Proxy F: client → catalog client ID catalog ID gateway trusted untrusted Thursday, October 17, 13
  25. Self-defense 2 ✤ Also applies to outcalls Payment Processor gateway

    The Collector trusted untrusted Thursday, October 17, 13
  26. Half-duplex testing Wrong 1. Set up mock 2. Set up

    call 3. Make call 4. Assertions about result 5. Verify mock was called Thursday, October 17, 13
  27. Half-duplex testing Wrong 1. Set up mock 2. Set up

    call 3. Make call 4. Assertions about result 5. Verify mock was called Right - call side 1. Set up mock 2. Set up call 3. Make call 4. Verify mock was called correctly. Thursday, October 17, 13
  28. Half-duplex testing Right - call side 1. Set up mock

    2. Set up call 3. Make call 4. Verify mock was called correctly. Right - response side 1. Skip mock & call 2. Inject fake results 3. Verify results handled correctly. Thursday, October 17, 13
  29. Other techniques I’m not 100% sure about ✤ Separate query

    from action ✤ Never deploy together ✤ Tell, don’t ask ✤ Unbundle parameters Thursday, October 17, 13