![Page 1: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/1.jpg)
GraphelThe Meaning of an Immutable World
![Page 2: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/2.jpg)
Growth
Prelude
![Page 3: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/3.jpg)
Conversation
Act I
![Page 4: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/4.jpg)
Event Sourcing
• Widely recognized as A Good Thing
• Lambda Architecture, Kafka, Datomic
• Especially for purely functional data
• But how do we work with it in practice?
![Page 5: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/5.jpg)
Inspiration
Is there anything we're already used to that:
• Coordinates interaction between entities
• Consists of a sequence of events
• Can't be altered once it's recorded
![Page 6: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/6.jpg)
![Page 7: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/7.jpg)
![Page 8: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/8.jpg)
Speech Acts
• A conversation is a sequence of speech acts
• A speech act is inherently immutable
• We already use it to create our social world
• Well suited to modeling information exchange
![Page 9: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/9.jpg)
Example: Landing PageHello! We sell widgets. Do you want to order now or read more?
I would like to read some more please.
We have widgets from A to Z. John and Mary also think it's good.
What did Mary say about it?
She said "They're great. Cheap, fast and good!" Should we perhaps call you for some personal advice on widgets?
Yeah sure.
Great? What's your name and phone number?
![Page 10: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/10.jpg)
Example: Admin UIThese are the 50 most recently added widgets: .... You can add one, see the next 50 or pick one you want to change.
I would like to change that one
We currently have ... on file. Do you want to change price, name or stock, or forget about it for now.
I want to give it a different price.
What price do you want to give it?
€29,95
12:47:59 at 13 Nov 2014
12:48:34 at 13 Nov 2014
12:48:34 at 13 Nov 2014
12:48:46 at 13 Nov 2014
12:48:46 at 13 Nov 2014
12:48:58 at 13 Nov 2014
![Page 11: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/11.jpg)
Example: Admin UIThese are the 50 most recently added widgets: .... You can add one, see the next 50 or pick one you want to change.
I would like to change that one
We currently have ... on file. Do you want to change price, name or stock, or forget about it for now.
I want to give it a different price.
What price do you want to give it?
€29,95
12:47:59 at 13 Nov 2014
12:48:34 at 13 Nov 2014
12:48:34 at 13 Nov 2014
12:48:46 at 13 Nov 2014
12:48:46 at 13 Nov 2014
12:48:58 at 13 Nov 2014Datomic
Transactions
![Page 12: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/12.jpg)
Speech Act Generator• Speech acts are communication devices that:
• transfer a model of the world
• narrow behavior to meaningful responses
• Every user interface is a speech act
• Every input lets users perform speech acts
System are just speech act generators
![Page 13: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/13.jpg)
Performing Acts• Acts are inherently performative
• We need give those acts the best stage
• Create dedicated interfaces for types of acts
• Optimising for another kind of performance
• Designing for muscle-memory responses
• Auto-cueing teleprompter for video recordings
![Page 14: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/14.jpg)
Human PerspectiveAs a speech act generator
you are in the middle of a conversation
and will decide what to say next
based on everything you already know
and that has been said until now.
Sounds familiar?
![Page 15: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/15.jpg)
DrawbacksEven when all inputs are immutably the generator still depends on the entire VM, meaning they:
• always have to live server side
• aren't referentially transparent
• must store raw output data for history
(At least until EClj performantly support first class namespaces.)
![Page 16: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/16.jpg)
Scripted
Act II
![Page 17: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/17.jpg)
The Problem
We want to
• embed complex, conditional, layered interactions
• into a purely functional data structure
• with minimal amounts of purely referential code
allowing others to locally anticipate actions.
![Page 18: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/18.jpg)
State of the Art
• Scripts & Forms
• Describe a sequence of events
• Branching/skipping based on responses
• Emails
• Free form pseudo-code description of anything
![Page 19: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/19.jpg)
The Essence
We want to handle a sequence of events and
based on the received event and previous actions
choose from a number of pre-determined actions
![Page 20: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/20.jpg)
State Machines
• Easily understood and represented visually
• Works on the level of granularity of speech acts
• Datomic can store it as a persistent data structure
• Allows responses to refer to a specific state/act
• States are good place for limited, versioned, logic
![Page 21: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/21.jpg)
The Un/Redo Model Given a sequence with full event history
• Undo moves current pointer back in the sequence
• Redo moves the pointer forward
• Actions 'sideline' acts beyond current pointer
• Optionally rolling back their side effects
• Or just create a new version of the current act
![Page 22: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/22.jpg)
Layered Hierarchies
Flat state machines quickly become unwieldy.
You can handle that by nesting state machines,
where each state can be it's own state machine,
allowing for a high degree of composability.
(If you squint you can even see objects there ;)
![Page 23: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/23.jpg)
![Page 24: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/24.jpg)
Reality
Act III
![Page 25: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/25.jpg)
Neurology
We humans have a single focus which can:
• switch between contexts
• nest contexts inside other contexts
• maintain state (fuzzy history) per context
• narrow action, and perception, through context
![Page 26: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/26.jpg)
The Web
![Page 27: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/27.jpg)
States and Transitions• Each path in a website is a state
• Path fragments refer to hierarchical levels
/inbox/12/my-thread/73/third-response#reply-to-all
• Clicking a link (GET) is argument-less transition
• Submitting a form (POST) an argumented transition
• With redirects leading to a new state
![Page 28: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/28.jpg)
HATEOAS built in
• The difficulty of HATEOAS lies in discoverability
• We can have tons of speech act types Yes/No, Multiple Choice, Forms, Video, Audio, Drawings, Payments, Social Shares, GPS, Weight
• But each act type has just a few well-defined exits
• Making discoverability not just feasible, but built in
![Page 29: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/29.jpg)
Multi Service Support
• States are defined as write-once, read-many acts
• Any service can offer those same guarantees
• Enabling iFrame-based third party act types
• Even with seamless authentication using OAuth
![Page 30: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/30.jpg)
History as a Sequence
• The browser history is the event history
• Clicking back is undo; forward redo.
• Same for scrolling past sections/paragraphs
• A vertically arranged sequence of acts
![Page 31: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/31.jpg)
Mobile• Focused speech act UIs work well full screen
• History support through a rewind gesture or
• Swiping across a visual "sequence of acts"
• Automatically accommodates all aspect ratios
• Nested contexts as hide-on-scroll navigation bars
• Multi service with intents or protocol ping-pong
![Page 32: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/32.jpg)
Notifications Lock Screens, Watches, Glass
• Key information can be summarized
• Simple response actions performed inline
• Single click resumes full operational state
• Voice recognition with restricted vocabulary
![Page 33: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/33.jpg)
![Page 34: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/34.jpg)
Cross Device• Traditionally syncing across devices is hard
• Live Datalog queries on Datomic make it possible
• Offline viewing can be built in through e.g. Datascript
• Offline speculative operation possible through analysis:
• Conflict-free work through continuity of user memory
• Informed speculative work on branch prediction
• Natural conflict resolution schemes either way
![Page 35: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/35.jpg)
Business
• Your interactions all have certain (shared) goals Persuading people, Collecting profiles, Losing weight
• Your success depends on your ability to help your customers achieve their goals
• You have access to a complete view on all of your customer interactions
So what do you do?
![Page 36: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/36.jpg)
Going Meta• Query the collection of all your interactions
• Identify areas of improvementLost customers, Plateauing users, Losing engagement
• Design (experimental) corrective action
• Select affected customers and apply the action
• Automate the process if it ends up working
![Page 37: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/37.jpg)
and changing an existing interaction?
![Page 38: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/38.jpg)
Experimentation
Act IV
![Page 39: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/39.jpg)
A Sense of History
Repeatability is key for a successful experiment.
Luckily, as long as we can display stored acts,
especially if they contain the creation process,
we can re-experience the entire user journey
and create transcripts/re-presentations from them.
![Page 40: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/40.jpg)
Stay In Your FlowWe want to change interactions with users in them,
which used to be a prohibitively hard problem.
But it comes completely for free if we
• store state machine definitions in Datomic
• assign users to specific versions of them
• store the code used for branching
![Page 41: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/41.jpg)
One Step At a TimeWe run experiments to learn from them
so we want only a single variable to change.
Single-act interfaces are great experimental units.
The sequence approach perfectly isolates them,
making it the perfect platform for A/B testing
(or any other type of sociological research.)
![Page 42: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/42.jpg)
Machine Learning
Classical A/B testing is about teaching people things.
What if you care more about results than wisdom?
Let the machine do the learning!
Multi-armed bandit can optimise for you,
automatically choosing versions giving best results
![Page 43: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/43.jpg)
Deploying Experiments
Isn't every deployment an experiment?
Just deploy new versions of (inter)act(ion)s
and migrate to them at your leisure
or even have a multi-armed-bandit
automagically phase out bad deploys
![Page 44: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/44.jpg)
Learning Intelligence
And do you still remember this?
….
![Page 45: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/45.jpg)
Learning Intelligence
"When using such a generator
you are in the middle of a conversation
and will decide what to say next
based on everything you already know
and that has happened until now."
![Page 46: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/46.jpg)
The act generator is the perfect foundation
for bootstrapping machine intelligence
that works the same way humans do:
through interacting and experimenting;
but in a controlled, limited, fashion...
Learning Intelligence
![Page 47: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/47.jpg)
Federation
Postlude
![Page 48: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/48.jpg)
NSA-proofing
• So far we assumed everything runs on a server
• That means the NSA is, or can be, watching
• People will never speak freely if that’s the case
• Nor will companies share all their data with you
![Page 49: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/49.jpg)
To Each Their Own• Each participant can control their own data
• And reference data used from other participants State machine definitions. Branching logic. User acts.
• Everyone gets a namespaced Datomic-style DB
• Work with live/pub-sub Datalog cross-DB querying
• Based on a.o. Nikitonsky’s Datomic as a Protocol
![Page 50: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/50.jpg)
On A Need-to-Know Basis
• Encrypt and sign all your data with a personal key
• Share by encrypting with others' public signatures
• Share data, by context, on a need-to-know basis
• Have privacy correspond to cryptographical reality.
![Page 51: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/51.jpg)
Signed, Identity• Identities are defined by serialization
• People can (temporarily) assume an identity
• Sign everything you created under that identity
• Retroactively revokable when compromised
• Publish publicly for a timestamped proof
• Enabling e.g. secure ad-hoc referendum voting
![Page 52: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/52.jpg)
A New Paradigm
• Using materialized views on persistent databases
• You can create a view of all public information
• Including aggregations of private data
• And similar views of accessible data per recipient
• And encrypt those materialised views accordingly
![Page 53: Graphel: A Purely Functional Approach to Digital Interaction](https://reader034.vdocuments.us/reader034/viewer/2022052507/5582fe82d8b42a21168b5311/html5/thumbnails/53.jpg)
A New Paradigm
Laying the foundation for a computing paradigm
in which you can communicate securely and
subscribe to, download and query
every piece of data you have access to
and not a single thing more.