Kennis Functional programming

Functional programming

It's been a week since we had a fairly intense Scala training day. Although we haven't done much Scala since, it has changed the way we look at things. For example in our current project that is JavaScript based we tend to approach things more functional:

var errorsByField = _.groupBy(response, function(item){
return item.property.substring(9);
});

and

_.map(this.state.events, function(event) {
return {model: event, state: {selected: false}}
}

These examples currently uses the lodash library, for this is client side code. This is because our reflex still is that we don't trust browsers and their JavaScript support levels... but you may just want to use the higher order functions from ECMA 1.5+

We are going to do more Scala in the coming time (http://www.asas2014.nl/ uses Scala and prismic.io). The thing that worries me most is the development round trip time. Maybe that is more because of the lightning fast roundtrip with for example mocha in the current JavaScript project than the slowness of the Scala compiler / test execution, but still, it worries me.