michelgrootjans / playing_with_projections

Preparation of a workshop
22 stars 51 forks source link

Remove all traces of the web-enabled workshop version #56

Open rradczewski opened 5 years ago

rradczewski commented 5 years ago

Some (if not all) implementations still have traces of the online version of the workshop. I didn't notice that before the workshop and then only during the exercise noticed that people where confused by the online-bits. Had to make it clear that we're working on the datasets in /data/*.json.

I propose we remove the web version. If we still want to force people to use incremental updates, we could change the boilerplates to not work with a sequence of events, but wrap them all in a fold.

Example for a constrained boilerplate:

// EventSource.js
class EventSource {
  constructor(file) {
    this.data = require(file);
  }

  project(projection) {
    return this.data.reduce(projection);
  }
}

// Projection.js
const Projection = (fn, initialState) => xs => xs.reduce(fn, initialState);

// eventCounter.js
const EventCounter = Projection((count) => count+1  , 0);

// Application
const dataSet0 = new EventSource('../data/0.json');
console.log(dataSet0.project(EventCounter));
tcoopman commented 5 years ago

Agree on removing the web traces. Not sure about the boilerplate (see #55)