16
emporal Composability Undo / Redo in angular with promises and the command pattern Image by Gossins: Flow of Time

Temporal composability

  • Upload
    kwoolfm

  • View
    135

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Temporal composability

Temporal Composability

Undo / Redo in angular with promises and the command pattern

Image by Gossins: Flow of Time

Page 2: Temporal composability

Undo / Redo

Native apps (including browser) support undo

Web apps and Mobile apps do not Power users produce more errors than

consumers Power users on a computer with native app What happens when a power user uses a

web app?

Page 3: Temporal composability

Power User

Page 4: Temporal composability

I want to be able to build a collection I want to be able to undo a price change

without having to remember which price I destroyed.

Use Case

Page 5: Temporal composability

Sets all items to 222% margin

Page 6: Temporal composability

function

x f(x)

Page 7: Temporal composability

invertable

x f(x)

f-1(f(x))

Page 8: Temporal composability

State Machine

Dual Transitions

Page 9: Temporal composability

Command Pattern

Page 10: Temporal composability

Double Stack

Page 11: Temporal composability

Double Stack

asdf

Page 12: Temporal composability

Creating a collection ID is returned asynchronously as a promise ID not specified until after creation but

needed for deletion

Discontinuity

Page 13: Temporal composability

*Each function has the result of its inverse as input

Promises and double closure

msg

Results Promise

Context

Arguments

Function

Results Promise

inversemsg

Page 14: Temporal composability

Promises

Page 15: Temporal composability

F -> $q(f) - Function that generates a promise (reuse allows for unlimited undo/redo)

Asynchronous actions are handled (composition)

Anything can undo/redo if providing 2 functions

User messaging for current state of undo/redo

Reusablility & Composiblity

Page 16: Temporal composability

Answers & Questions