JS App Architecture
-
Upload
corey-butler -
Category
Technology
-
view
2.163 -
download
0
description
Transcript of JS App Architecture
![Page 1: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/1.jpg)
JS APP ARCHITECTURE
NoSQL, SSJS, & Sencha
![Page 2: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/2.jpg)
Corey Butler 15yrs+ Web Experience Founder @ Ecor Systems, LLC Chief Consultant @ Ecor Group (we’re on senchadevs.com) DW/BI & Web Practices
Ext JS Since v2. Started in the Adobe, Microsoft, & IBM worlds. Started in Fortune 500, Entrepreneur since 2000.
Available Via: Blog: coreybutler.com Twitter: @goldglovecb LinkedIn.com/in/ecorsystems
![Page 3: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/3.jpg)
Agenda
NoSQL Overview SSJS Overview The Sencha Stack Simple Examples
![Page 4: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/4.jpg)
The Stack
UI: Sencha
Controller: SSJS
Persistence: NoSQL
The concept isn’t much different from traditional web architecture.
![Page 5: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/5.jpg)
What is NoSQL?
No defined relationships. No schemas or fixed types. NoACID?
![Page 6: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/6.jpg)
What NoSQL Is NOT
Hard & Fast RDBMS Replacement All Purpose Data Storage
![Page 7: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/7.jpg)
NoSQL vs SQL
NOSQL Goal Specific Non-relational Map/Reduce Known Data Structure! No NULLS
function(doc) {
if ( doc.date < Date() && typeof doc.somefield !== undefined ) {
var resultObject = {
id: doc.pk,
value: doc.somefield
};
emit(resultObject);
}
}
SQL Generic RDBMS ANSI SQL Predefined Data Structure NULLS
SELECT a.pk as id, a.somefield as value
FROM TblA a INNER JOIN TblB b
ON a.pk = b.fk
WHERE a.somevalue IN
(SELECT someval FROM TblC)
AND b.date < CURRENT_TIMESTAMP
AND a.somefield <> null
![Page 8: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/8.jpg)
Popular Choices
CouchDB Doc Store MongoDB Doc Store w/ Key/Value Redis Key/Value (In Memory) Riak Dynamo-like (Commercial) Hadoop Big Data Cassandra BigTable CONSTANTLY GROWING kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis
![Page 9: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/9.jpg)
Storage Types
Key/Value: Schemaless. Where is data stored?
Disk? Memory? Distributed?
Document: Like Key/Value, but semi-structured.
Graph: Based on graph theory. Focuses more
on relationships between objects than
the objects themselves.
Column/Wide: Key pointing to multiple columns
(like rows in an RDBMS)
![Page 10: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/10.jpg)
SSJS: Server Side JavaScript SSJS was first introduced via Netscape
LiveWire in 1996, but really didn’t become practical for many until 2009.
Gaining popularity because: Faster JS Engines like Google’s V8 (Chrome), Spidermonkey
(Firefox), & Rhino (Firefox). Maturity of JavaScript/ECMAScript. Standards like CommonJS.
Useful for event-driven apps.
![Page 11: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/11.jpg)
CommonJS
Aims to standardize JS outside the browser. Best Practices/Metadata/Specs. Cross-Compatibility. Supports concepts like modules, file system
references, exports, and other common requirements for serving applications.
![Page 12: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/12.jpg)
SSJS Platforms
Narwhal Most complete CommonJS
implementation. Based on
Rhino with JSGI Middleware.
NodeJS Non-blocking & single threaded
(fast). Implements some
CommonJS. Based on V8. Large
and growing community.
Others: Jaxer, Jack, 10gen App Server
![Page 13: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/13.jpg)
NodeJSFrom nodejs.org
Node.js is a server-side JavaScript environment that uses an asynchronous event-driven model. This allows Node.js to get excellent performance based on the architectures of many Internet applications.
Nutshell: Create apps, like web servers.
![Page 14: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/14.jpg)
Example Web Server//Require the HTTP module
var http = require('http'),
colors = require('colors'),
port = 80;
//Create the server
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(port, "127.0.0.1");
//Indicate the server is running
console.log('Server running at http://127.0.0.1:'.green+port.toString().cyan+'/'.green);
![Page 15: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/15.jpg)
NodeJS Modules
Modules are plugins for Node. Lots of work already done for you. No governed quality control. Hundreds of Modules NPM is your friend.
![Page 16: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/16.jpg)
NPM: Node Package Manager http://npmjs.org Install/Publish Modules Manages dependencies. Extremely simple: npm install express
![Page 17: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/17.jpg)
Tying to Sencha
Connect Module is part of Sencha Labs Express Module is built on Connect.
![Page 18: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/18.jpg)
Examples With Sencha
Sencha NoSQL (CouchDB) REST Proxy
Sencha NodeJS MongoDB REST Proxy, Express, Mongoose
This Presentation Socket.IO
![Page 19: JS App Architecture](https://reader035.fdocuments.us/reader035/viewer/2022081809/554f9210b4c9052a518b541e/html5/thumbnails/19.jpg)
Node Hotness
Socket.IO Web SocketsComparable to HTML5 SSE (Comet)Dnode, NowJS
Highly Concurrent Apps. Easy REST Development. Server-side headless browsers. Community & Momentum