a naive approach to feature based js apps

30
Feature-based JS apps The naïve approach

Upload: peter-abraham

Post on 22-Jan-2018

55 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: A naive approach to feature based js apps

Feature-based JS appsThe naïve approach

Page 2: A naive approach to feature based js apps

ENGINEERING IMPLEMENTATIONS

Page 3: A naive approach to feature based js apps
Page 4: A naive approach to feature based js apps
Page 5: A naive approach to feature based js apps
Page 6: A naive approach to feature based js apps
Page 7: A naive approach to feature based js apps
Page 8: A naive approach to feature based js apps

ROAD TO IDEA

Page 9: A naive approach to feature based js apps
Page 10: A naive approach to feature based js apps
Page 11: A naive approach to feature based js apps
Page 12: A naive approach to feature based js apps
Page 13: A naive approach to feature based js apps

ROAD TO SOLUTION

Page 14: A naive approach to feature based js apps

application = set of features

features are pluggable

Page 15: A naive approach to feature based js apps

function shootOnTarget(model) {

// do stuffs

return newmodel;

}

const myApplication = globular.initializeApp(‘hockey-shot-recorder');

myApplication.extendWithFeature('shoot-on-target', shootOnTarget);

myApplication.executeFeature('shoot-on-target', {

“player”: 23,

“team”: “FTC”,

“period”: 1

});

Page 16: A naive approach to feature based js apps

application = set of features

features are pluggable

outputs of features could be used in any number of views

Page 17: A naive approach to feature based js apps

class ShootOnTarget {

constructor() {

this.views = [];

}

execute(model) {

// do stuffs

this.views.forEach(view => {

view(newmodel);

});

}

pluginView(view) {

this.view.push(view);

}

}

Page 18: A naive approach to feature based js apps

const myApplication = globular.initializeApp('hockey-shot-record');

const shootOnTarget = new ShootOnTarget();

shootOnTarget.pluginView(model => {

// do stuffs

});

myApplication.extendWithFeature('shoot-on-target', shootOnTarget);

myApplication.executeFeature('shoot-on-target', {

"player": 23,

"team": "FTC",

"period": 1

});

Page 19: A naive approach to feature based js apps

application = set of features

features are pluggable

outputs of features could be used in any number of views

features use common resources (e.g. persistency)

Page 20: A naive approach to feature based js apps

class ShootOnTarget {

constructor({persistency, api}) {

this.persistency = persistency;

this.api = api;

this.views = [];

}

// …

// ‘execute()’ method refers to persistency and api props

// while doing its stuff

}

Page 21: A naive approach to feature based js apps

const myApplication = globular.initializeApp('hockey-shot-record');

const shootOnTarget = new ShootOnTarget({persistency, api}));

shootOnTarget.pluginView(model => {

// do stuffs

});

myApplication.extendWithFeature('shoot-on-target', shootOnTarget);

myApplication.executeFeature('shoot-on-target', {

"player": 97,

"team": "FTC",

"period": 1

});

Page 22: A naive approach to feature based js apps

const myApplication = globular.initializeApp('hockey-shot-record');

const shootOnTarget = new ShootOnTarget({persistency, api}));

shootOnTarget.pluginView(model => {

// do stuffs

});

myApplication.extendWithFeature('shoot-on-target', shootOnTarget);

myApplication.executeFeature('shoot-on-target', {

"player": 97,

"team": "FTC",

"period": 1

});

Page 23: A naive approach to feature based js apps

class ShootOnTarget {

constructor({persistency, api}) {

this.persistency = persistency;

this.api = api;

}

execute(model) {

// uses persistency/api and

// returns a promise

}

}

Page 24: A naive approach to feature based js apps

const myApplication = globular.initializeApp('hockey-shot-record');

myApplication.extendWithFeature('shoot-on-target', ShootOnTarget);

myApplication.getFeature('shoot-on-target').pluginView(model => {

// do stuffs

});

myApplication.executeFeature('shoot-on-target', {

"player": 11,

"team": "FTC",

"period": 1

});

Page 25: A naive approach to feature based js apps

WHY IS IT GOOD FOR ME?

Page 26: A naive approach to feature based js apps

testable applications via testing features

pure Javascript/ES2015 implementations

DOM-manipulation is out of app’s scope

focus on functionalities

Page 27: A naive approach to feature based js apps

WHAT IS IT, BY THE WAY?

Page 28: A naive approach to feature based js apps
Page 29: A naive approach to feature based js apps

https://www.npmjs.com/package/globular

Page 30: A naive approach to feature based js apps

[email protected]

@peppierre

peppierre