Atomic tools for better programming
deepjs core (this lib) provides a set of quite atomic tools for better programming.
Alone, deepjs core library does not provides anything but nice, fast and lightweight tools that allow you to develop your OWN application faster.
Above all, it will help you in design, architecture and concurrent run-time management of your OWN app.
Based on Layered and Chained Programmation approach, it provides, uses and mixes :
- Layered Aspect Oriented Programmation
- Query Based Programmation including Code Sheet
- Object Capability Model (or Management)
- Full promised and chained asynch management
- Homogeneous HTTP/Rest ressources management
- Modularisation by Protocol approach
- Concurrent context management
It works both server side and browser side. Its aim is to be totaly unobstrusive, ergonomic as possible and usable with any other js lib/framework. It wants also to be absolutly homogeneous (isomorphic) between server and browser sides.
As jquery (that is highly unobstrusive and ergonomic) works on standard DOM objects, deepjs works with any standard js objects and functions, and has a minimal footprint.
Real huge thanks, amoung others, to Kris Zyp and all his incredible work on promises, json-schema, compositions, RQL, OCM, Persvr, etc. Thanks also a lot to his bunch of articles on Thin-Server, No-SQL, mVC, etc. and all those realy smart architecural considerations that lead us trough our research...
deepjs : made with love.
var http = require'http';var deep = require'deepjs'; // the corerequire'deep-restful'; // homogeneous restful APIrequire'deep-restful/lib/collection'; // simple memory collection"myobjects" ;var titles = "hello" "deepjs" "world";var count = 0;httpcreateServerdeeprestful"myobjects"post title:titles++count%3 count:countgetStringrequrlsubstring1doneresponsewriteHead200 'Content-Type': 'application/json';responseendJSONstringifyres;failconsole.log"error : " errortoString;responsewriteHeaderrorstatus || 500 'Content-Type': 'application/json';responseendJSONstringifyerror;;listen1337 '127.0.0.1';console.log'Server running at ';
Then, open your browser, go to http://127.0.0.1:1337/, refresh few times, and try :
http://127.0.0.1:1337/an_id_of_an_item_in_collection or http://127.0.0.1:1337/?title=deepjs or http://127.0.0.1:1337/?count=lt=2
//-----------------Modelsvar land =location : "pls override this value with your own location"console.log"Water is applied on all the land";;//-----------------Aspectsvar orchard =plants : uri:"appletree"growSpeed:10watering : deepcomposeafterconsole.log"We put some mulch after watering";;var kitchenGarden =plants : uri:"carrots"growSpeed:6watering : deepcomposebeforeconsole.log"We protect seedlings before watering";;//-----------------Implementvar myOwnLand =location : "Sao Francisco do Guaporé"plants : uri:"grass"growSpeed:2;deepnodesmyOwnLandbottomlanduporchardkitchenGarden//Query based object modelisationquery"/plants/*"upsize : 0thissize += thisgrowSpeed;thissize -= heightpruned;;console.log"myOwnLand is : " myOwnLand;myOwnLandwatering;//Query based object manipulationdeepnodesmyOwnLandquery"/plants/*"run"grow"query"/plants/*?size=gt=5"run"prune"2;console.log"myOwnLand is : " myOwnLand;
See tutorials page for details. (warning : documentation partially deprecated. offical website is on the way...;))