If you like this presentation – show it...

Slide 0


Slide 1

What Is JSON-FP Programs are expressed as a JSON object in a functional programming style.

Slide 2

Ok. That sounds like something serious, but what does that really mean?

Slide 3

Introducing JSON-FP JSON-FP uses a JSON object to describe a computer program. If you send a JSON object to JSON-FP to run, you could get a very different object in return.

Slide 4

Let’s Start With Something Simple var expr = {add: 1} ; jsonfp.apply(1, expr);

Slide 5

var expr = {add: 1} ; jsonfp.apply(1, expr); That’s the same as saying 1 + 1 1 ? {add: 1} === (1 + 1) Now you know a JSON-FP expression is as simple as: {op: option} Ex: {add: 1}

Slide 6

JSON-FP allows you to replace ‘option’ with another JSON-FP expression. That makes things… interesting.

Slide 7

Changing {add: 1} to {add: {‘<‘: 10}} The program changes to: ‘If the input is smaller than 10, add 1 to it.’

Slide 8

Another Example _.map(list, function(page) { return _.pick(page, ‘title’); }); The above code uses underscore/lodash to remove all but the ‘title’ property from a list of pages.

Slide 9

If Done By JSON-FP… _.map(list, function(page) { return _.pick(page, ‘title’); }); vs {map: {pick: ‘title’}}

Slide 10

So you may notice the JSON-FP expression can be very concise and it can help developers to focus on the problem they want to solve.

Slide 11

But that’s not the whole point…

Slide 12

Properties/features of JSON-FP: Map/Reduce in the distributed environments. Functional programming Homoiconic / metaprogramming

Slide 13

Map/reduce, functional programming and homoiconic… Those are too heavy stuff for this introduction. We’ll cover them in the coming slides. But we can talk a little about map/reduce…

Slide 14

If your application has to query data repositories in a heterogeneous environment, hadoop/spark is NOT a good fit. Try JSON-FP, life will be much easier.

Slide 15

Any real world applications?

Slide 16

Well, JSON-FP is less than a month old. Interesting applications are coming… For now, you can check out newsql (https://github.com/benlue/newsql) which uses JSON-FP to query objects. Our next generation API services uses JSON-FP, too.

Slide 17

That’s it for now. For more JSON-FP examples, check out: https://github.com/benlue/jsonfp-examples The JSON-FP is open sourced at github: https://github.com/benlue/jsonfp