The world of Javascript Rapee Suveeranont Web Technology
Jan 15, 2015
The world of
JavascriptRapee Suveeranont
Web Technology
Falsepopular
belief
SyntaxFeatures
Buzz word
It’s some kind of JAVA
Not in technological terms
CSmalltalkJAVA
No,
Performance is poor
2008 – 2010 Javascript engine warIE 7 →9 = 140XFirefox 3 → 4 = 10X
No, Getting better and better,at even faster speed
Performance is poor
Run (only) in browser
Desktop, Mobile, Server,RIA, Widgets, DB, OS and
Documents
No,it also run in
JavascriptToday
We can do this,var http = require('http'); http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});res.end('Hello World¥n');
}).listen(8124, "127.0.0.1");console.log('Server running at http://127.0.0.1:8124/');
% node example.js Server running at http://127.0.0.1:8124/
Here comes a web server!
Naked Javascript
Pure programming languageECMAScript
No standard libraryNot even document.write()
No package managementunlike PHP, Ruby, Python
Many engines of choiceRhino, TraceMonkey, Nitro, Chakra, Carakan
Ecosystem
Ecosystem
ECMAScript Language
ECMAScript
JavascriptActionScript
Jscript.NET
QTScript
JScript
Javascript OSA
CajaWMLScript
Objective-J
Language
Dialect
Ecosystem
Language
Dialect
EngineTraceMonkeyNitro
ChakraV8Carakan
Rhino
Ecosystem
Language
Dialect
Engine
Platform
BrowserMobile Desktop
DocumentsDB OS
Widgets
RIA
Ecosystem
Language
Dialect
Engine
Platform
Framework
Client jQuery, Mootools, prototypeYUI, Dojo, Ext, SproutCore
Server CommonJS, Node.js,Narwhal, Jaxer, AppJet
Mobile App Titanium,Phonegap
Ecosystem
LanguageDialectEngine
Platform
Framework
OthersJSON etc.
MongoDBAJAX
CouchDB
Ecosystem
At a glance
JSON. BSON.
{'id': 99,'name': '高橋じゅん','address': [
{'country': 'JP', 'postcode': '144-0012'},{'country': 'TH', 'postcode': '10400'}
],'married': false
}
Very popular light, fast and readable
compact data format
JSON + byte array(binary)
TitaniumNative iPhone/Android
Cross-platform Framework
Appcelerator
Titanium
Titanium.UI.setBackgroundColor('#000');var tabGroup = Titanium.UI.createTabGroup({id:'tabGroup1'});var win1 = Titanium.UI.createWindow({id:'win1'});var tab1 = Titanium.UI.createTab({id:'tab1', window:win1});tabGroup.addTab(tab1);tabGroup.open();
// Display phone’s cameraTitanium.Media.showCamera({
success: function(event) { ... },overlay: overlay,showControls: false,mediaTypes: Ti.Media.MEDIA_TYPE_PHOTO,autohide: false
});
Create native UI with tabs
Open built-in camera
Node.js
var net = require('net');net.createServer(function (socket) {
socket.write("Echo server¥r¥n"); socket.on("data", function (data) {
socket.write(data); });
}).listen(8124, "127.0.0.1");
Server-side applicationFile system, HTTP, SSL, Net, DNS, datagram, process
Open socket and listen to incoming data
CommonJSSpecification of standard API for
non-web application:CLI, Server, GUI
APIs:ModulePackageSystemConsoleFilesystemHTTP ClientEncodings .. etc.
MongoDBNoSQL database with native Javascript query
> db.foo.find({$where : function() {
return this.x == this.y; }
})
> db.eval(function(name) { return "Hello, “ + name;
}, ["Joe"])
SQL: WHERE x = y
OUTPUT: “Hello, Joe”
Why now?
It’s everywhere
WebHTML5+CSS+Javascript, RIA
PlatformDesktop, Mobile, Server, blah, blah, …
DevicePC, Netbook, Garakei, Smartphone, Tablet, Embedded
They’re everywhere
Web DevelopersWeb Designers
Easy to learn, transfer skills, and move to new platform
Cloud
Developers Designers
WebAppSmartphone DesktopRIA
Thank you