Query your app data like you would query a database

The interesting job in creating an app is to send or receive data to another actor :
– whether it is human or not,
– whether it is UI, JSON/Xml/Yaml or console text,
– whether it is a webApp, a program or a script

Now, what happens between the data exchange and the added value of your software ? Boring data manipulation stuff.

Furthermore, let’s imagine that you need to filter every bank account transaction on your account server with a synthetic data (for example, the impact of an economic crisis on the account itself) ?
public float estimatedBalance (int nbDays, float economicHealth)
-> Most of the time you would not compute that with a simple database, because it can depend on some calculation thanks to an algorithm.

Then, build a data cache and try to query your data inside your application instead…
I have 2 solutions to suggest (with a JVM) :
– Switch to Java 8, and to the easy lambda function syntax :
List result = accounts.filter(account -> account.estimatedBalance(90, -1) < max);
– Use my lib : http://github.com/libetl/prime. You are now able to query some java objects by using a simplified query syntax. You can even pass a String object and therefore construct a query on your own java objects. On the homepage of this project, you will get a preview of what can be done using this syntax.

It can be used as a backend if you don’t need to persist the data really. I am actually thinking if it could be useful to actually save the data in a file…

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

*