STATUS QUO

  1. Fetch data
  2. SUCCESS/ERROR/IDLE
  3. have UI render based on this data
  4. User interaction dispatches an event into the system
  5. Write code to handle this event, by updating the API with a PATCH and back to step 2.
  6. Implement the same patchAnnotation in 5 different ways each time a new case pops up. 

Data

  • Think spreadsheets.
  • I define a formula, and all cells get updated automatically.
  • Can we have a system that is performant by default?

Events

  • Events are no different than data.
  • they are just data that keep arriving over time.
  • Can we make our code in such a way that it can map, filter, forEach over events and declare how system responds?
const a = 1;
const b = 2;

autorun(() => {
  domElement.innerHTML = a + b;
});

... rest of app code...
  • Iterator Pattern vs Observer Pattern
  • Map, Filter etc are compatible with iterators.
  • Observer pattern = addEventListener

EVENTS

What is the difference between arrays and an events?

  • ​Data as a service lol
  • Doesn't sound very FP at all in fact sounds very inheritance
  • Code once use everywhere.
const myAnno = new Annotation(annosFromServer[0]);

myAnno.data.concepts[0].value = 1;


// 
const myAnno2 = new Annotation(annosFromServer[1], { autoSync: false });

myAnno.data.concepts[0].value = 1;

... couple minutes laterrr ...

myAnno2.sync();

deck

By Aviral Kulshreshtha