SlideShare ist ein Scribd-Unternehmen logo
1 von 163
Downloaden Sie, um offline zu lesen
VS 
Node.js vs Play Framework
Node.js: server-side JavaScript runtime environment; 
open source; single threaded; non-blocking I/O. 
Node.js: サーバサイドJSランタイム、OSS、シングルスレッド、非同期I/O
express.js: the most popular web 
framework for Node.js. 
express.js: Node.js で一番人気のWebフレームワーク
Play Framework: Java/Scala web framework; open 
source; multithreaded; non-blocking I/O. 
Play: Java/Scala Webフレームワーク、OSS、マルチスレッド、非同期I/O
Yevgeniy Brikman 
Former Play Tech Lead at LinkedIn. Long time Node.js user. 
元LinkedIn社Play Tech Lead。ベテランNode.jsユーザ
The framework scorecard 
Learn 
Develop 
Test 
Secure 
Build 
Deploy 
Debug 
Scale 
Maintain 
Share
For each feature we discuss... 
1 
Much worse than most frameworks 
About the same as most frameworks 
Much better than most frameworks 
5 
10 
1 = 酷い、5 = 平均的、10 = 優秀
The framework scorecard 
Learn 
Develop 
Test 
Secure 
Build 
Deploy 
Debug 
Scale 
Maintain 
Share
Node.js: 1-click installers for every OS 
OSにかかわらずインストーラは万全
var http = require('http'); 
http.createServer(function (req, res) { 
res.writeHead(200, {'Content-Type': 'text/plain'}); 
res.end('Hello Worldn'); 
}).listen(1337, '127.0.0.1'); 
console.log('Server running at http://127.0.0.1:1337/'); 
server.js 
The “Hello World” Node app: 1 file, 6 lines of code.
var express = require('express'); 
var app = express(); 
app.get('/', function(req, res){ 
res.send('Hello World'); 
}); 
var server = app.listen(1337, function() { 
console.log('Listening on port %d', server.address().port); 
}); 
server.js 
The “Hello World” Express app: 1 file, 8 lines of code.
Run using node <filename>. Starts instantly!
Hit http://localhost:1337 to test
nodeschool.io
Node Beginner Book, Mastering Node.js, 
Node: Up and Running, Node.js in Action
Node API Docs
Express.js guide
Express Web Application Development Express.js Guide
Express.js API docs
And much, much more 
Tons of resources; very gradual learning curve. 
リソースが豊富、緩やかな学習曲線
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10
Play: download from playframework.com, 
extract, add activator to your PATH 
Play:ダウンロードし、展開し、activator をPATH に追加する
Generate a new app using activator new
The “Hello World” Play app: ~35 files and folders
Run the app using activator run
(Downloading all dependencies can take a 
while the first time around) 
初回はjarのダウンロードに時間がかかる
Hit http://localhost:9000 to test
Play Framework Documentation
Activator Templates
Play for Scala Learning Play Framework 2
Ultimate Guide to Getting Started with Play. 
Not as many resources; steep learning curve. 
リソースが少なめ、急勾配の学習曲線
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7
GET clients/:id Clients.show(id: Long) 
def show(id: Long) = Action { request => 
getClient(id).map { client => 
Ok(views.html.clients.show(client)) 
} 
} 
Routing 
app.get('clients/:id', function(req, res) { 
getClient(req.params.id, function(client) { 
res.render('show', client); 
}); 
}); 
RESTful routing. Extracts query & path 
params. 
RESTful routing. Extracts query & path 
params. Type safe. Actions are 
composable. Reverse routing.
@(name: String, headline: String) 
<div class="client"> 
<h1>@name</h1> 
<div class="headline"> 
Headline: @headline 
</div> 
</div> 
Templates 
<div class="client"> 
<h1>{{name}}</h1> 
<div class="headline"> 
Headline: {{headline}} 
</div> 
</div> 
Many template options: handlebars, 
mustache, dust, jade, etc. Most support 
client-side rendering! 
Twirl templates are compiled into Scala 
functions: type safe and composable! 
Other template types via plugins.
i18n 
Translations: i18next-node, i18n-node. 
Formatting: moment.js, numeral.js. 
Translations: Play i18n API. 
Formatting: Java formatting libraries. 
<div class="client"> 
<h1>{{name}}</h1> 
<div class="headline"> 
{{t "headline.label" headline=headline}} 
</div> 
</div> 
@(name: String, headline: String) 
<div class="client"> 
<h1>@name</h1> 
<div class="headline"> 
Messages("headline.label", headline) 
</div> 
</div>
var regForm = forms.create({ 
name: fields.string({required: true}), 
age: fields.number({min: 18}) 
Forms, node-formidable, validator.js. Play form binding and validation API. 
Form binding and validation 
}); 
regForm.handle(req, { 
success: function(form) { ... }, 
error: function(form) { ... } 
}); 
val regForm = Form(mapping( 
"name" -> nonEmptyText, 
"age" -> number(min = 18) 
)(UserData.apply)(UserData.unapply)) 
regForm.bindFromRequest.fold( 
err => BadRequest("Validation error"), 
data => Ok(s"Hi $data.name!") 
)
// Automatically parse application/json body 
app.use(bodyParser.json()); 
app.post('/clients', function (req, res, next) { 
var name = req.body.name; 
var age = req.body.age; 
res.send(name + " is " + age + " years old."); 
}); 
POST /clients Clients.create 
case class Person(name: String, age: Int) 
implicit val prsnFmt = Json.format[Person] 
def create = Action(parse.json) { request => 
val person = request.body.as[Person] 
Ok(s"$person.name is $person.age years old") 
} 
bodyParser, xml2js, node-formidable. Play JSON, XML, File Upload APIs. 
JSON, XML, File Upload
Data 
Slick, Anorm, Ebean, JPA 
MySQL, MariaDB, PostgreSLQ, SQLite, Oracle, SQL Server, 
DB2, Derby, H2 
Sequelize, Bookshelf.js, node-orm2 SQL 
MySQL, MariaDB, PostgreSQL, SQLite 
NoSQL 
mongojs/mongoose, cassandra-client, 
cradle/nano, node_redis, node-neo4j 
MongoDB, Cassandra, CouchDB, Redis, Neo4j 
ReactiveMongo, DataStax, sprouch, play-plugins- 
redis, Neo4j-play, JPA 
MongoDB, Cassandra, CouchDB, Redis, Neo4j 
node-memcached, connect-cache Caching 
memcached, in-memory (not recommended) 
play2-memcached, memcontinuationed, 
Play Cache, ehcache, Guava 
memcached, in-memory 
node-db-migrate, node-migrate Schemas Play database evolutions
socket.io: server & client APIs; 
WebSockets, Flash Sockets, polling, etc. 
Play WebSockets, Comet, and 
EventSource APIs. Server-side only. 
Real-time web 
// server code 
io.on('connection', function (socket) { 
socket.emit('msg', 'Server says hi!'); 
socket.on('msg', function (msg) { … }); 
}); 
def chat = WebSocket.acceptWithActor { 
request => out => Props(new Chat(out)) 
} 
class Chat(out: ActorRef) extends Actor { 
def receive = { 
case m: String => out ! s"Got msg: $m" 
} 
} 
// client code 
socket.emit('msg', 'Client says hi!'); 
socket.on('msg', function (msg) { … });
● Express.js is a minimal framework ● Play is a full stack framework 
● You need plugins for most tasks 
● Finding good plugins takes time 
● Gluing plugins together takes time 
● There are defaults for most tasks 
● Defaults are mostly high quality 
● All defaults can be replaced 
Express.js:ミニマル、プラグインを多く使う。Play:フルスタック
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10
Unit testing: Jasmine, Mocha, QUnit, 
nodeunit, Expresso or Vows
var request = require('supertest') 
, app = require('express')(); 
app.get('/user', function(req, res){ 
res.send(200, { name: 'tobi' }); 
}); 
request(app) 
.get('/user') 
.expect('Content-Type', /json/) 
.expect(200); 
Functional testing: use supertest or call 
server.listen directly.
UI testing: phantom.js or zombie.js
Code coverage: Istanbul or Blanket.js
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10
Unit testing: junit, ScalaTest, specs2, or testng
"respond to the index Action" in new App(FakeApplication()) { 
val Some(result) = route(FakeRequest(GET, "/Bob")) 
status(result) mustEqual OK 
contentType(result) mustEqual Some("text/html") 
charset(result) mustEqual Some("utf-8") 
contentAsString(result) must include ("Hello Bob") 
} 
Functional testing: use Play’s built-in 
functional test helpers.
class ExampleSpec extends PlaySpec with OneServerPerSuite with OneBrowserPerSuite { 
"The OneBrowserPerTest trait" must { 
"provide a web driver" in { 
go to (s"http://localhost:$port/testing") 
pageTitle mustBe "Test Page" 
click on find(name("b")).value 
eventually { pageTitle mustBe "scalatest" } 
} 
} 
} 
UI testing: use Play’s built-in integration test 
helpers and built-in Selenium support.
Code coverage: jacoco4sbt or scct
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10
(not enabled by default!) Connect CSRF Middleware CSRF 
(not enabled by default!) 
Depends on template engine XSS Twirl escapes correctly 
Vulnerabilities: eval, setTimeout, Injection 
Security 
CSRFFilter 
setInterval, new Function Few vulnerabilities of this sort 
Helmet middleware Headers SecurityHeadersFilter 
passport.js, everyauth Auth SecureSocial, deadbolt, play-authenticate 
Node Security Project Advisories Play Security Vulnerabilities
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8
{ 
"name": "Hello World App", 
"version": "0.0.3", 
"dependencies": { 
"express": "4.8.0", 
"underscore": "1.6.0" 
}, 
"scripts": { 
"test": "node tests/run.js" 
} 
} 
Node.js uses NPM to manage dependencies and 
basic build commands 
Node.jsは依存性管理や簡単なコマンド定義にNPMを使う
Many options available for more complicated 
builds: grunt.js, gulp.js, or broccoli 
より複雑なビルドの場合、grunt.js, gulp.js, broccoliのようなツールを使う
Thousands of plugins for all common build tasks 
プラグインが何千もある
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10
Play uses SBT as the build system. SBT is an 
interactive build system. 
Play は SBT という対話的ビルドツールを利用
object AppBuild extends Build { 
lazy val root = Project(id = "root", base = file(".")).settings( 
name := "test-play-app", 
version := version, 
libraryDependencies += Seq( 
"org.scala-tools" % "scala-stm_2.11.1" % "0.3", 
"org.apache.derby" % "derby" % "10.4.1.3" 
) 
) 
def version = Option(System.getProperty("version")).getOrElse("0.0.3") 
} 
In SBT, build definitions are written in Scala! 
… But the learning curve is very steep. 
ビルドファイルをScalaで書く。でもビギナーには厳しい
Dependencies are managed using Ivy: 
familiar, but slow. 
Ivyで依存性を管理する。使い慣れてるけど、実行性能は遅め
Play uses sbt-web to build static content: few 
plugins; depends on Rhino (slow) or node.js (!). 
Playは静的コンテンツのビルドにsbt-webを利用する。プラグインが少ない
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7
Many node-friendly hosting options: Heroku, 
Joyent, Azure, OpenShift, Nodejitsu 
Node.jsをサポートするホスティング
Monitoring: New Relic, Nodetime, 
AppDynamics, node-monitor
if (cluster.isMaster) { 
for (var i = 0; i < numCPUs; i++) { 
cluster.fork(); // Fork workers 
} 
cluster.on('exit', function(worker, code, signal) { 
console.log('worker ' + worker.process.pid + ' died'); 
}); 
} else { 
http.createServer(function(req, res) { 
// ... 
}).listen(8000); 
} 
Use cluster to run one node instance per CPU 
cluster を使ってコア毎にインスタンスを稼働
Use forever, monit, or Domain to handle crashes. 
クラッシュ対処
{ 
"dbConfig": { 
"host": "localhost", 
"port": 5984, 
"dbName": "customers" 
} 
} 
config/default.json 
var config = require('config'); 
var host = config.get('dbConfig.host'); 
server.js 
Configuration: node-config or nconf
Use nginx, apache, or ATS to load balance, 
serve static content, terminate SSL 
Client 
Data Center 
Reverse proxy 
(e.g. nginx) DB 
Static server 
(e.g. nginx) 
Node 
instNaondcee 
instNaondcee 
instNaondcee 
instNaondcee 
instance 
Node 
instNaondcee 
instNaondcee 
instNaondcee 
instance 
Node 
instNaondcee 
instNaondcee 
instNaondcee 
instance 
ロードバランサー、静的コンテンツ、SSL Termination
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8
A few Play-friendly hosting options: Heroku, 
playframework-cloud, CloudBees 
Playをサポートするホスティング
Monitoring: New Relic, metrics-play
Use the SBT Native Packager to package the 
app as tgz, deb, RPM, etc. 
Appをネイティブパッケージとして包装できる
dbConfig = { 
host: "localhost", 
port: 5984, 
dbName: "customers" 
} 
conf/application.conf 
val host = Play.current.configuration.getString("dbConfig.host") 
app/controllers/Application.scala 
Configuration: Play comes with Typesafe Config
Use nginx, apache, or ATS to load balance, 
serve static content, terminate SSL 
Client 
Data Center 
Reverse proxy 
(e.g. nginx) 
Play app 
DB 
Static server 
(e.g. nginx) 
Play app 
Play app
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7
Node.js: use IntelliJ or node-inspector to debug 
Node.js:IntelliJでデバッグできる
Use DTrace, TraceGL, node-stackviz, and node-profiler 
to debug perf issues 
性能問題のデバッグ
var winston = require("winston"); 
winston.info("CHILL WINSTON! ... I put it in the logs."); 
Use winston, log4js, or bunyan for logging
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10
Play runs on the JVM, so you can use your 
favorite IDE to debug: IntelliJ, Eclipse, NetBeans 
Play:好きなIDEを使える
In dev, Play shows errors right in the browser 
開発モードでエラーがブラウザで表示される
Use YourKit, VisualVM, BTrace, and jmap to 
debug perf issues
Use logback, slf4j, or log4j for logging
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 10
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 10
Part 1: scaling for lots of traffic 
大量のトラフィックのためのスケーリング
TechEmpower benchmarks. 
Warning: microbenchmarks are not a substitute for real world perf testing!
JSON serialization
Single query 
(Note: JDBC is blocking!)
Multiple queries 
(Note: JDBC is blocking!)
Internet Load 
Balancer 
Frontend 
Server 
Frontend 
Server 
Frontend 
Server 
Backend 
Server 
Backend 
Server 
Backend 
Server 
Backend 
Server 
Backend 
Server 
Data 
Store 
Data 
Store 
Data 
Store 
Data 
Store 
LinkedIn experience #1: Play and Node.js are very 
fast in a service oriented architecture with NIO. 
LinkedInの感想:Node.jsもPlayもとても速い
// BAD: write files synchronously 
fs.writeFileSync('message.txt', 'Hello Node'); 
console.log("It's saved, but you just blocked ALL requests!"); 
// Good: write files asynchronously 
fs.writeFile('message.txt', 'Hello Node', function (err) { 
console.log("It's saved and the server remains responsive!"); 
}); 
LinkedIn experience #2: Play is ok with blocking I/O 
& CPU/memory bound use cases. Node.js is not. 
同期I/O、高メモリ使用率と高CPU使用率の場合、Node.jsの性能が落ちる
Part 2: scaling for large teams and projects 
大きいチーム・プロジェクトのためのスケーリング
Node.js: best for small projects, short projects, small teams. 
Node.js:小さいプロジェクト、短いプロジェクト、小さいチームにいい
Play: best for longer projects. Slower ramp up, but scales well with team & project size. 
Play:より大きいプロジェクトにスケールできる
For comparison: Spring MVC
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 
10 
10 
10
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 
10 
10 
10
Maintenance: the good parts 
メンテナンス:「良いパーツ」
Functional programming: first class functions, 
closures, underscore.js 
関数型プログラミング
JavaScript is ubiquitous... 
JSは至る所にある
...Which means you can share developers, 
practices, and even code: rendr, derby, meteor 
そのため、デベロッパー、情報、コードは入手しやすい
Node core is stable and mature. Bugs, regressions, 
and backwards incompatibility are rare. 
安定したコア。バグや後方互換性の問題は比較的少ない
Maintenance: the bad parts 
メンテナンス:「悪いパーツ」
'' == '0' // false 
0 == '' // true 
0 == '0' // true 
false == 'false' // false 
false == '0' // true 
false == undefined // false 
false == null // false 
null == undefined // true 
' trn ' == 0 // true 
Bad Parts
// Default scope is global 
var foo = "I'm a global variable!" 
// Setting undeclared variables puts them in global scope too 
bar = "I'm also a global variable!"; 
if (foo) { 
// Look ma, no block scope! 
var baz = "Believe it or not, I'll also be a global variable!" 
} 
Awful Parts
Wat
this keyword
doSomethingAsync(req1, function(err1, res1) { 
doSomethingAsync(req2, function(err2, res2) { 
doSomethingAsync(req3, function(err3, res3) { 
doSomethingAsync(req4, function(err4, res4) { 
// ... 
}); 
}); 
}); 
}); 
Callback hell: control flow, error handling, 
and composition are all difficult 
コールバック地獄
Many NPM packages are NOT stable or mature. 
Incompatibility + bugs + dynamic typing = pain. 
NPMに不安定なパッケージが多い。非互換性 + バグ + 動的型付け = 苦痛
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 
10 
10 
10 
3
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 
10 
10 
10 
3
Maintenance: the good parts
def sort(a: List[Int]): List[Int] = { 
if (a.length < 2) a 
else { 
val pivot = a(a.length / 2) 
sort(a.filter(_ < pivot)) ::: 
a.filter(_ == pivot) ::: 
sort(a.filter(_ > pivot)) 
Functional programming 
} 
}
Powerful type system
val NameTagPattern = "Hello, my name is (.+) (.+)".r 
val ListPattern = "Last: (.+). First: (.+).".r 
// Case classes automatically generate immutable fields, equals, hashCode, constructor 
case class Name(first: String, last: String) 
// Use Option to avoid returning null if there is no name found 
def extractName(str: String): Option[Name] = { 
Option(str).collectFirst { 
// Pattern matching on regular expressions 
case NameTagPattern(fname, lname) => Name(fname, lname) 
case ListPattern(lname, fname) => Name(fname, lname) 
} 
} 
Very expressive: case classes, pattern matching, lazy, option, implicits 
表現力が高い
Runs on the JVM; interop with Java.
Concurrency & streaming tools: Futures, Akka, 
STM, threads, Scala.rx, Async/Await, Iteratees
def index = Action { 
// Make 3 sequential, async calls 
for { 
foo <- WS.url(url1).get() 
bar <- WS.url(url2).get() 
baz <- WS.url(url3).get() 
} yield { 
// Build a result using foo, bar, and baz 
} 
} 
No callback hell!
Good IDE support
Maintenance: the bad parts
Slow compiler 
コンパイラ遅い
Fortunately, Play/SBT support incremental 
compilation and hot reload! 
Play/sbt はインクリメンタルコンパイラと hot reloading があるから大丈夫!
Complexity
More complexity
Play is stable, but not mature: backwards 
incompatible API changes every release. 
Play は安定だがまだ成長期。APIはよく変わる
Even worse: Scala is not binary compatible 
between releases! 
Scala はリリース間でバイナリ互換性を持たない!
Backwards incompatibility = pain. 
… Static typing makes it a little more manageable. 
バイナリ互換性が無いのは辛いけど、静的な型によって少しは緩和される
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 
10 
10 
10 
3 8
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 
10 
10 
10 
3 8
544 Contributors 351 
2,376 Watchers 576 
31,332 Stars 5,077 
6,970 Forks 1,872 
3,066 PR’s 2,201 
Github activity as of 08/10/14
StackOverflow 10,698 
53,555 Questions 
Google Group 
14,199 Members 11,577 
Google Group 
~400 Posts/Month ~1,100 
StackOverflow, mailing list activity as of 08/12/14
4 langpop.com 18 
10 TIOBE 39 
5 CodeEval 12 
7 IEEE Spectrum 17 
1 RedMonk 13 
12 Lang-Index 26 
Language Popularity as of 08/12/14 
人気ランキング
88,000 packages in NPM ~80 Play Modules
88,000 packages in NPM 83,000 artifacts in Maven
Joyent offers commercial 
support for Node.js 
Typesafe offers commercial 
support for Play 
有償サポート
Node.js in production
Play in production
1,172 LinkedIn 49 
3,605 Indeed 179 
214 CareerBuilder 16 
Open jobs as of 08/13/14 
採用募集数
82,698 LinkedIn 9,037 
2,267 Indeed 206 
447 CareerBuilder 30 
Candidates as of 08/13/14 
採用候補者数
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 
10 
10 
10 
3 8 
10 7
Learn 
Develop 
Test 
Secure 
Build 
The framework scorecard 
Deploy 
Debug 
Scale 
Maintain 
Share 
10 7 
8 10 
10 10 
6 8 
10 7 
8 7 
10 
10 
10 
10 
3 8 
10 7
Final score 
85 
84
Final score 
85 
84
山田くん、これ全員の座布団全部持って行きなさい!
Both frameworks are great. Decide based on 
strengths/weakness, not my arbitrary score! 
結論:どちらもすごい!
Use node.js if: 
1. You’re building small apps with small teams 
2. You already have a bunch of JavaScript ninjas 
3. Your app is mostly client-side JavaScript 
4. Your app is mostly real-time 
5. Your app is purely I/O bound 
向き: 小チーム小アプリ、JavaScript ニンジャ
Don’t use node.js if: 
1. You don’t write lots of automated tests 
2. Your code base or team is going to get huge 
3. You do lots of CPU or memory intensive tasks 
不向き: 自動テスト書かない人、大チーム、高CPU か 高RAM
Use Play if: 
1. You’re already using the JVM 
2. You like type safety and functional programming 
3. Your code base or team is going to get big 
4. You want a full stack framework 
5. You need flexibility: non-blocking I/O, blocking I/O, 
CPU intensive tasks, memory intensive tasks 
向き: JVM ユーザ、型安全性、関数型が好き、大チーム
Don’t use Play if: 
1. You don’t have time to master Play, Scala, and SBT 
2. You hate functional programming or static typing 
不向き: Play/Scala/sbt を勉強してる時間が無い、型安全性、関数型が嫌い
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Matthew Groves
 
The Many Ways to Test Your React App
The Many Ways to Test Your React AppThe Many Ways to Test Your React App
The Many Ways to Test Your React AppAll Things Open
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScriptYakov Fain
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentAll Things Open
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaKazuhiro Sera
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with GradleWei Chen
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Aligning Ember.js with Web Standards
Aligning Ember.js with Web StandardsAligning Ember.js with Web Standards
Aligning Ember.js with Web StandardsMatthew Beale
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJiayun Zhou
 
Test Driven Development with JavaFX
Test Driven Development with JavaFXTest Driven Development with JavaFX
Test Driven Development with JavaFXHendrik Ebbers
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemAndres Almiray
 
Javascript TDD with Jasmine, Karma, and Gulp
Javascript TDD with Jasmine, Karma, and GulpJavascript TDD with Jasmine, Karma, and Gulp
Javascript TDD with Jasmine, Karma, and GulpAll Things Open
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Ryan Weaver
 
The DOM is a Mess @ Yahoo
The DOM is a Mess @ YahooThe DOM is a Mess @ Yahoo
The DOM is a Mess @ Yahoojeresig
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Pavel Kaminsky
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 

Was ist angesagt? (20)

Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017Full stack development with node and NoSQL - All Things Open - October 2017
Full stack development with node and NoSQL - All Things Open - October 2017
 
The Many Ways to Test Your React App
The Many Ways to Test Your React AppThe Many Ways to Test Your React App
The Many Ways to Test Your React App
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
We Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End DevelopmentWe Are All Testers Now: The Testing Pyramid and Front-End Development
We Are All Testers Now: The Testing Pyramid and Front-End Development
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Scala and Play with Gradle
Scala and Play with GradleScala and Play with Gradle
Scala and Play with Gradle
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Aligning Ember.js with Web Standards
Aligning Ember.js with Web StandardsAligning Ember.js with Web Standards
Aligning Ember.js with Web Standards
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSF
 
Test Driven Development with JavaFX
Test Driven Development with JavaFXTest Driven Development with JavaFX
Test Driven Development with JavaFX
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
 
Angular beans
Angular beansAngular beans
Angular beans
 
Javascript TDD with Jasmine, Karma, and Gulp
Javascript TDD with Jasmine, Karma, and GulpJavascript TDD with Jasmine, Karma, and Gulp
Javascript TDD with Jasmine, Karma, and Gulp
 
Dust.js
Dust.jsDust.js
Dust.js
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
 
The DOM is a Mess @ Yahoo
The DOM is a Mess @ YahooThe DOM is a Mess @ Yahoo
The DOM is a Mess @ Yahoo
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 

Andere mochten auch

Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介scalaconfjp
 
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...scalaconfjp
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングscalaconfjp
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論scalaconfjp
 
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!scalaconfjp
 
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)TIS Inc.
 
[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫
[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫
[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫gree_tech
 
GitBucket: The perfect Github clone by Scala
GitBucket: The perfect Github clone by ScalaGitBucket: The perfect Github clone by Scala
GitBucket: The perfect Github clone by Scalatakezoe
 
From Ruby to Scala
From Ruby to ScalaFrom Ruby to Scala
From Ruby to Scalatod esking
 
sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策scalaconfjp
 
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoWeaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoTaro L. Saito
 
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一scalaconfjp
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSYevgeniy Brikman
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Yevgeniy Brikman
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform TrainingYevgeniy Brikman
 
Evolution of PayPal API Platform at API Meetup
Evolution of PayPal API Platform at API MeetupEvolution of PayPal API Platform at API Meetup
Evolution of PayPal API Platform at API MeetupDeepak Nadig
 
Craft Conference 2015 - Evolution of the PayPal API: Platform & Culture
Craft Conference 2015 - Evolution of the PayPal API: Platform & CultureCraft Conference 2015 - Evolution of the PayPal API: Platform & Culture
Craft Conference 2015 - Evolution of the PayPal API: Platform & CultureDeepak Nadig
 
レインボーテーブルを使ったハッシュの復号とSalt
レインボーテーブルを使ったハッシュの復号とSaltレインボーテーブルを使ったハッシュの復号とSalt
レインボーテーブルを使ったハッシュの復号とSaltRyo Maruyama
 

Andere mochten auch (20)

Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
Introduction to Spark SQL and Catalyst / Spark SQLおよびCalalystの紹介
 
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...
Scarab: SAT-based Constraint Programming System in Scala / Scala上で実現された制約プログラ...
 
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディングXitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
 
The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論The Evolution of Scala / Scala進化論
The Evolution of Scala / Scala進化論
 
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
What's a macro?: Learning by Examples / Scalaのマクロに実用例から触れてみよう!
 
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
Scalable Generator: Using Scala in SIer Business (ScalaMatsuri)
 
[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫
[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫
[ScalaMatsuri] グリー初のscalaプロダクト!チャットサービス公開までの苦労と工夫
 
GitBucket: The perfect Github clone by Scala
GitBucket: The perfect Github clone by ScalaGitBucket: The perfect Github clone by Scala
GitBucket: The perfect Github clone by Scala
 
From Ruby to Scala
From Ruby to ScalaFrom Ruby to Scala
From Ruby to Scala
 
sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策sbt, past and future / sbt, 傾向と対策
sbt, past and future / sbt, 傾向と対策
 
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, TokyoWeaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
Weaving Dataflows with Silk - ScalaMatsuri 2014, Tokyo
 
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
Building a Unified Data Pipline in Spark / Apache Sparkを用いたBig Dataパイプラインの統一
 
An intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECSAn intro to Docker, Terraform, and Amazon ECS
An intro to Docker, Terraform, and Amazon ECS
 
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...Infrastructure as code: running microservices on AWS using Docker, Terraform,...
Infrastructure as code: running microservices on AWS using Docker, Terraform,...
 
Agility Requires Safety
Agility Requires SafetyAgility Requires Safety
Agility Requires Safety
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
 
Evolution of PayPal API Platform at API Meetup
Evolution of PayPal API Platform at API MeetupEvolution of PayPal API Platform at API Meetup
Evolution of PayPal API Platform at API Meetup
 
Craft Conference 2015 - Evolution of the PayPal API: Platform & Culture
Craft Conference 2015 - Evolution of the PayPal API: Platform & CultureCraft Conference 2015 - Evolution of the PayPal API: Platform & Culture
Craft Conference 2015 - Evolution of the PayPal API: Platform & Culture
 
レインボーテーブルを使ったハッシュの復号とSalt
レインボーテーブルを使ったハッシュの復号とSaltレインボーテーブルを使ったハッシュの復号とSalt
レインボーテーブルを使ったハッシュの復号とSalt
 
State of MariaDB
State of MariaDBState of MariaDB
State of MariaDB
 

Ähnlich wie Node.js vs Play Framework (with Japanese subtitles)

soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
FP - Découverte de Play Framework Scala
FP - Découverte de Play Framework ScalaFP - Découverte de Play Framework Scala
FP - Découverte de Play Framework ScalaKévin Margueritte
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e bigAndy Peterson
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Codemotion
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptdavejohnson
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instrumentsArtem Nagornyi
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)Igor Bronovskyy
 
Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula Sorin Chiprian
 
Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Tugdual Grall
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.Mike Brevoort
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJSPeter Drinnan
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extremeyinonavraham
 

Ähnlich wie Node.js vs Play Framework (with Japanese subtitles) (20)

soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
FP - Découverte de Play Framework Scala
FP - Découverte de Play Framework ScalaFP - Découverte de Play Framework Scala
FP - Découverte de Play Framework Scala
 
Javascript unit testing, yes we can e big
Javascript unit testing, yes we can   e bigJavascript unit testing, yes we can   e big
Javascript unit testing, yes we can e big
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
Jan Stępień - GraalVM: Fast, Polyglot, Native - Codemotion Berlin 2018
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
Pragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScriptPragmatic Parallels: Java and JavaScript
Pragmatic Parallels: Java and JavaScript
 
Selenium
SeleniumSelenium
Selenium
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
NodeJS
NodeJSNodeJS
NodeJS
 
Play framework productivity formula
Play framework   productivity formula Play framework   productivity formula
Play framework productivity formula
 
Scripting Oracle Develop 2007
Scripting Oracle Develop 2007Scripting Oracle Develop 2007
Scripting Oracle Develop 2007
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
 
Selenium
SeleniumSelenium
Selenium
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
 

Mehr von Yevgeniy Brikman

Cloud adoption fails - 5 ways deployments go wrong and 5 solutions
Cloud adoption fails - 5 ways deployments go wrong and 5 solutionsCloud adoption fails - 5 ways deployments go wrong and 5 solutions
Cloud adoption fails - 5 ways deployments go wrong and 5 solutionsYevgeniy Brikman
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...Yevgeniy Brikman
 
Lessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure codeLessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure codeYevgeniy Brikman
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesYevgeniy Brikman
 
The Truth About Startups: What I wish someone had told me about entrepreneurs...
The Truth About Startups: What I wish someone had told me about entrepreneurs...The Truth About Startups: What I wish someone had told me about entrepreneurs...
The Truth About Startups: What I wish someone had told me about entrepreneurs...Yevgeniy Brikman
 
Startup Ideas and Validation
Startup Ideas and ValidationStartup Ideas and Validation
Startup Ideas and ValidationYevgeniy Brikman
 
A Guide to Hiring for your Startup
A Guide to Hiring for your StartupA Guide to Hiring for your Startup
A Guide to Hiring for your StartupYevgeniy Brikman
 
Startup DNA: the formula behind successful startups in Silicon Valley (update...
Startup DNA: the formula behind successful startups in Silicon Valley (update...Startup DNA: the formula behind successful startups in Silicon Valley (update...
Startup DNA: the formula behind successful startups in Silicon Valley (update...Yevgeniy Brikman
 

Mehr von Yevgeniy Brikman (13)

Cloud adoption fails - 5 ways deployments go wrong and 5 solutions
Cloud adoption fails - 5 ways deployments go wrong and 5 solutionsCloud adoption fails - 5 ways deployments go wrong and 5 solutions
Cloud adoption fails - 5 ways deployments go wrong and 5 solutions
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
 
Lessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure codeLessons learned from writing over 300,000 lines of infrastructure code
Lessons learned from writing over 300,000 lines of infrastructure code
 
Reusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modulesReusable, composable, battle-tested Terraform modules
Reusable, composable, battle-tested Terraform modules
 
The Truth About Startups: What I wish someone had told me about entrepreneurs...
The Truth About Startups: What I wish someone had told me about entrepreneurs...The Truth About Startups: What I wish someone had told me about entrepreneurs...
The Truth About Startups: What I wish someone had told me about entrepreneurs...
 
Startup Ideas and Validation
Startup Ideas and ValidationStartup Ideas and Validation
Startup Ideas and Validation
 
A Guide to Hiring for your Startup
A Guide to Hiring for your StartupA Guide to Hiring for your Startup
A Guide to Hiring for your Startup
 
Startup DNA: Speed Wins
Startup DNA: Speed WinsStartup DNA: Speed Wins
Startup DNA: Speed Wins
 
Rapid prototyping
Rapid prototypingRapid prototyping
Rapid prototyping
 
Kings of Code Hack Battle
Kings of Code Hack BattleKings of Code Hack Battle
Kings of Code Hack Battle
 
Hackdays and [in]cubator
Hackdays and [in]cubatorHackdays and [in]cubator
Hackdays and [in]cubator
 
Startup DNA: the formula behind successful startups in Silicon Valley (update...
Startup DNA: the formula behind successful startups in Silicon Valley (update...Startup DNA: the formula behind successful startups in Silicon Valley (update...
Startup DNA: the formula behind successful startups in Silicon Valley (update...
 
LinkedIn Overview
LinkedIn OverviewLinkedIn Overview
LinkedIn Overview
 

Kürzlich hochgeladen

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Copilot para Microsoft 365 y Power Platform Copilot
Copilot para Microsoft 365 y Power Platform CopilotCopilot para Microsoft 365 y Power Platform Copilot
Copilot para Microsoft 365 y Power Platform CopilotEdgard Alejos
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 

Kürzlich hochgeladen (20)

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Copilot para Microsoft 365 y Power Platform Copilot
Copilot para Microsoft 365 y Power Platform CopilotCopilot para Microsoft 365 y Power Platform Copilot
Copilot para Microsoft 365 y Power Platform Copilot
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 

Node.js vs Play Framework (with Japanese subtitles)

  • 1. VS Node.js vs Play Framework
  • 2. Node.js: server-side JavaScript runtime environment; open source; single threaded; non-blocking I/O. Node.js: サーバサイドJSランタイム、OSS、シングルスレッド、非同期I/O
  • 3. express.js: the most popular web framework for Node.js. express.js: Node.js で一番人気のWebフレームワーク
  • 4. Play Framework: Java/Scala web framework; open source; multithreaded; non-blocking I/O. Play: Java/Scala Webフレームワーク、OSS、マルチスレッド、非同期I/O
  • 5. Yevgeniy Brikman Former Play Tech Lead at LinkedIn. Long time Node.js user. 元LinkedIn社Play Tech Lead。ベテランNode.jsユーザ
  • 6. The framework scorecard Learn Develop Test Secure Build Deploy Debug Scale Maintain Share
  • 7. For each feature we discuss... 1 Much worse than most frameworks About the same as most frameworks Much better than most frameworks 5 10 1 = 酷い、5 = 平均的、10 = 優秀
  • 8. The framework scorecard Learn Develop Test Secure Build Deploy Debug Scale Maintain Share
  • 9. Node.js: 1-click installers for every OS OSにかかわらずインストーラは万全
  • 10. var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello Worldn'); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/'); server.js The “Hello World” Node app: 1 file, 6 lines of code.
  • 11. var express = require('express'); var app = express(); app.get('/', function(req, res){ res.send('Hello World'); }); var server = app.listen(1337, function() { console.log('Listening on port %d', server.address().port); }); server.js The “Hello World” Express app: 1 file, 8 lines of code.
  • 12. Run using node <filename>. Starts instantly!
  • 15. Node Beginner Book, Mastering Node.js, Node: Up and Running, Node.js in Action
  • 18. Express Web Application Development Express.js Guide
  • 20. And much, much more Tons of resources; very gradual learning curve. リソースが豊富、緩やかな学習曲線
  • 21. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10
  • 22. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10
  • 23. Play: download from playframework.com, extract, add activator to your PATH Play:ダウンロードし、展開し、activator をPATH に追加する
  • 24. Generate a new app using activator new
  • 25. The “Hello World” Play app: ~35 files and folders
  • 26. Run the app using activator run
  • 27. (Downloading all dependencies can take a while the first time around) 初回はjarのダウンロードに時間がかかる
  • 31. Play for Scala Learning Play Framework 2
  • 32. Ultimate Guide to Getting Started with Play. Not as many resources; steep learning curve. リソースが少なめ、急勾配の学習曲線
  • 33. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7
  • 34. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7
  • 35. GET clients/:id Clients.show(id: Long) def show(id: Long) = Action { request => getClient(id).map { client => Ok(views.html.clients.show(client)) } } Routing app.get('clients/:id', function(req, res) { getClient(req.params.id, function(client) { res.render('show', client); }); }); RESTful routing. Extracts query & path params. RESTful routing. Extracts query & path params. Type safe. Actions are composable. Reverse routing.
  • 36. @(name: String, headline: String) <div class="client"> <h1>@name</h1> <div class="headline"> Headline: @headline </div> </div> Templates <div class="client"> <h1>{{name}}</h1> <div class="headline"> Headline: {{headline}} </div> </div> Many template options: handlebars, mustache, dust, jade, etc. Most support client-side rendering! Twirl templates are compiled into Scala functions: type safe and composable! Other template types via plugins.
  • 37. i18n Translations: i18next-node, i18n-node. Formatting: moment.js, numeral.js. Translations: Play i18n API. Formatting: Java formatting libraries. <div class="client"> <h1>{{name}}</h1> <div class="headline"> {{t "headline.label" headline=headline}} </div> </div> @(name: String, headline: String) <div class="client"> <h1>@name</h1> <div class="headline"> Messages("headline.label", headline) </div> </div>
  • 38. var regForm = forms.create({ name: fields.string({required: true}), age: fields.number({min: 18}) Forms, node-formidable, validator.js. Play form binding and validation API. Form binding and validation }); regForm.handle(req, { success: function(form) { ... }, error: function(form) { ... } }); val regForm = Form(mapping( "name" -> nonEmptyText, "age" -> number(min = 18) )(UserData.apply)(UserData.unapply)) regForm.bindFromRequest.fold( err => BadRequest("Validation error"), data => Ok(s"Hi $data.name!") )
  • 39. // Automatically parse application/json body app.use(bodyParser.json()); app.post('/clients', function (req, res, next) { var name = req.body.name; var age = req.body.age; res.send(name + " is " + age + " years old."); }); POST /clients Clients.create case class Person(name: String, age: Int) implicit val prsnFmt = Json.format[Person] def create = Action(parse.json) { request => val person = request.body.as[Person] Ok(s"$person.name is $person.age years old") } bodyParser, xml2js, node-formidable. Play JSON, XML, File Upload APIs. JSON, XML, File Upload
  • 40. Data Slick, Anorm, Ebean, JPA MySQL, MariaDB, PostgreSLQ, SQLite, Oracle, SQL Server, DB2, Derby, H2 Sequelize, Bookshelf.js, node-orm2 SQL MySQL, MariaDB, PostgreSQL, SQLite NoSQL mongojs/mongoose, cassandra-client, cradle/nano, node_redis, node-neo4j MongoDB, Cassandra, CouchDB, Redis, Neo4j ReactiveMongo, DataStax, sprouch, play-plugins- redis, Neo4j-play, JPA MongoDB, Cassandra, CouchDB, Redis, Neo4j node-memcached, connect-cache Caching memcached, in-memory (not recommended) play2-memcached, memcontinuationed, Play Cache, ehcache, Guava memcached, in-memory node-db-migrate, node-migrate Schemas Play database evolutions
  • 41. socket.io: server & client APIs; WebSockets, Flash Sockets, polling, etc. Play WebSockets, Comet, and EventSource APIs. Server-side only. Real-time web // server code io.on('connection', function (socket) { socket.emit('msg', 'Server says hi!'); socket.on('msg', function (msg) { … }); }); def chat = WebSocket.acceptWithActor { request => out => Props(new Chat(out)) } class Chat(out: ActorRef) extends Actor { def receive = { case m: String => out ! s"Got msg: $m" } } // client code socket.emit('msg', 'Client says hi!'); socket.on('msg', function (msg) { … });
  • 42. ● Express.js is a minimal framework ● Play is a full stack framework ● You need plugins for most tasks ● Finding good plugins takes time ● Gluing plugins together takes time ● There are defaults for most tasks ● Defaults are mostly high quality ● All defaults can be replaced Express.js:ミニマル、プラグインを多く使う。Play:フルスタック
  • 43. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10
  • 44. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10
  • 45. Unit testing: Jasmine, Mocha, QUnit, nodeunit, Expresso or Vows
  • 46. var request = require('supertest') , app = require('express')(); app.get('/user', function(req, res){ res.send(200, { name: 'tobi' }); }); request(app) .get('/user') .expect('Content-Type', /json/) .expect(200); Functional testing: use supertest or call server.listen directly.
  • 47. UI testing: phantom.js or zombie.js
  • 48. Code coverage: Istanbul or Blanket.js
  • 49. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10
  • 50. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10
  • 51. Unit testing: junit, ScalaTest, specs2, or testng
  • 52. "respond to the index Action" in new App(FakeApplication()) { val Some(result) = route(FakeRequest(GET, "/Bob")) status(result) mustEqual OK contentType(result) mustEqual Some("text/html") charset(result) mustEqual Some("utf-8") contentAsString(result) must include ("Hello Bob") } Functional testing: use Play’s built-in functional test helpers.
  • 53. class ExampleSpec extends PlaySpec with OneServerPerSuite with OneBrowserPerSuite { "The OneBrowserPerTest trait" must { "provide a web driver" in { go to (s"http://localhost:$port/testing") pageTitle mustBe "Test Page" click on find(name("b")).value eventually { pageTitle mustBe "scalatest" } } } } UI testing: use Play’s built-in integration test helpers and built-in Selenium support.
  • 55. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10
  • 56. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10
  • 57. (not enabled by default!) Connect CSRF Middleware CSRF (not enabled by default!) Depends on template engine XSS Twirl escapes correctly Vulnerabilities: eval, setTimeout, Injection Security CSRFFilter setInterval, new Function Few vulnerabilities of this sort Helmet middleware Headers SecurityHeadersFilter passport.js, everyauth Auth SecureSocial, deadbolt, play-authenticate Node Security Project Advisories Play Security Vulnerabilities
  • 58. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8
  • 59. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8
  • 60. { "name": "Hello World App", "version": "0.0.3", "dependencies": { "express": "4.8.0", "underscore": "1.6.0" }, "scripts": { "test": "node tests/run.js" } } Node.js uses NPM to manage dependencies and basic build commands Node.jsは依存性管理や簡単なコマンド定義にNPMを使う
  • 61. Many options available for more complicated builds: grunt.js, gulp.js, or broccoli より複雑なビルドの場合、grunt.js, gulp.js, broccoliのようなツールを使う
  • 62. Thousands of plugins for all common build tasks プラグインが何千もある
  • 63. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10
  • 64. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10
  • 65. Play uses SBT as the build system. SBT is an interactive build system. Play は SBT という対話的ビルドツールを利用
  • 66. object AppBuild extends Build { lazy val root = Project(id = "root", base = file(".")).settings( name := "test-play-app", version := version, libraryDependencies += Seq( "org.scala-tools" % "scala-stm_2.11.1" % "0.3", "org.apache.derby" % "derby" % "10.4.1.3" ) ) def version = Option(System.getProperty("version")).getOrElse("0.0.3") } In SBT, build definitions are written in Scala! … But the learning curve is very steep. ビルドファイルをScalaで書く。でもビギナーには厳しい
  • 67. Dependencies are managed using Ivy: familiar, but slow. Ivyで依存性を管理する。使い慣れてるけど、実行性能は遅め
  • 68. Play uses sbt-web to build static content: few plugins; depends on Rhino (slow) or node.js (!). Playは静的コンテンツのビルドにsbt-webを利用する。プラグインが少ない
  • 69. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7
  • 70. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7
  • 71. Many node-friendly hosting options: Heroku, Joyent, Azure, OpenShift, Nodejitsu Node.jsをサポートするホスティング
  • 72. Monitoring: New Relic, Nodetime, AppDynamics, node-monitor
  • 73. if (cluster.isMaster) { for (var i = 0; i < numCPUs; i++) { cluster.fork(); // Fork workers } cluster.on('exit', function(worker, code, signal) { console.log('worker ' + worker.process.pid + ' died'); }); } else { http.createServer(function(req, res) { // ... }).listen(8000); } Use cluster to run one node instance per CPU cluster を使ってコア毎にインスタンスを稼働
  • 74. Use forever, monit, or Domain to handle crashes. クラッシュ対処
  • 75. { "dbConfig": { "host": "localhost", "port": 5984, "dbName": "customers" } } config/default.json var config = require('config'); var host = config.get('dbConfig.host'); server.js Configuration: node-config or nconf
  • 76. Use nginx, apache, or ATS to load balance, serve static content, terminate SSL Client Data Center Reverse proxy (e.g. nginx) DB Static server (e.g. nginx) Node instNaondcee instNaondcee instNaondcee instNaondcee instance Node instNaondcee instNaondcee instNaondcee instance Node instNaondcee instNaondcee instNaondcee instance ロードバランサー、静的コンテンツ、SSL Termination
  • 77. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8
  • 78. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8
  • 79. A few Play-friendly hosting options: Heroku, playframework-cloud, CloudBees Playをサポートするホスティング
  • 80. Monitoring: New Relic, metrics-play
  • 81. Use the SBT Native Packager to package the app as tgz, deb, RPM, etc. Appをネイティブパッケージとして包装できる
  • 82. dbConfig = { host: "localhost", port: 5984, dbName: "customers" } conf/application.conf val host = Play.current.configuration.getString("dbConfig.host") app/controllers/Application.scala Configuration: Play comes with Typesafe Config
  • 83. Use nginx, apache, or ATS to load balance, serve static content, terminate SSL Client Data Center Reverse proxy (e.g. nginx) Play app DB Static server (e.g. nginx) Play app Play app
  • 84. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7
  • 85. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7
  • 86. Node.js: use IntelliJ or node-inspector to debug Node.js:IntelliJでデバッグできる
  • 87. Use DTrace, TraceGL, node-stackviz, and node-profiler to debug perf issues 性能問題のデバッグ
  • 88. var winston = require("winston"); winston.info("CHILL WINSTON! ... I put it in the logs."); Use winston, log4js, or bunyan for logging
  • 89. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10
  • 90. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10
  • 91. Play runs on the JVM, so you can use your favorite IDE to debug: IntelliJ, Eclipse, NetBeans Play:好きなIDEを使える
  • 92. In dev, Play shows errors right in the browser 開発モードでエラーがブラウザで表示される
  • 93. Use YourKit, VisualVM, BTrace, and jmap to debug perf issues
  • 94. Use logback, slf4j, or log4j for logging
  • 95. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10
  • 96. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10
  • 97. Part 1: scaling for lots of traffic 大量のトラフィックのためのスケーリング
  • 98. TechEmpower benchmarks. Warning: microbenchmarks are not a substitute for real world perf testing!
  • 100. Single query (Note: JDBC is blocking!)
  • 101. Multiple queries (Note: JDBC is blocking!)
  • 102. Internet Load Balancer Frontend Server Frontend Server Frontend Server Backend Server Backend Server Backend Server Backend Server Backend Server Data Store Data Store Data Store Data Store LinkedIn experience #1: Play and Node.js are very fast in a service oriented architecture with NIO. LinkedInの感想:Node.jsもPlayもとても速い
  • 103. // BAD: write files synchronously fs.writeFileSync('message.txt', 'Hello Node'); console.log("It's saved, but you just blocked ALL requests!"); // Good: write files asynchronously fs.writeFile('message.txt', 'Hello Node', function (err) { console.log("It's saved and the server remains responsive!"); }); LinkedIn experience #2: Play is ok with blocking I/O & CPU/memory bound use cases. Node.js is not. 同期I/O、高メモリ使用率と高CPU使用率の場合、Node.jsの性能が落ちる
  • 104. Part 2: scaling for large teams and projects 大きいチーム・プロジェクトのためのスケーリング
  • 105. Node.js: best for small projects, short projects, small teams. Node.js:小さいプロジェクト、短いプロジェクト、小さいチームにいい
  • 106. Play: best for longer projects. Slower ramp up, but scales well with team & project size. Play:より大きいプロジェクトにスケールできる
  • 108. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10 10 10
  • 109. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10 10 10
  • 110. Maintenance: the good parts メンテナンス:「良いパーツ」
  • 111. Functional programming: first class functions, closures, underscore.js 関数型プログラミング
  • 112. JavaScript is ubiquitous... JSは至る所にある
  • 113. ...Which means you can share developers, practices, and even code: rendr, derby, meteor そのため、デベロッパー、情報、コードは入手しやすい
  • 114. Node core is stable and mature. Bugs, regressions, and backwards incompatibility are rare. 安定したコア。バグや後方互換性の問題は比較的少ない
  • 115. Maintenance: the bad parts メンテナンス:「悪いパーツ」
  • 116.
  • 117. '' == '0' // false 0 == '' // true 0 == '0' // true false == 'false' // false false == '0' // true false == undefined // false false == null // false null == undefined // true ' trn ' == 0 // true Bad Parts
  • 118. // Default scope is global var foo = "I'm a global variable!" // Setting undeclared variables puts them in global scope too bar = "I'm also a global variable!"; if (foo) { // Look ma, no block scope! var baz = "Believe it or not, I'll also be a global variable!" } Awful Parts
  • 119. Wat
  • 121. doSomethingAsync(req1, function(err1, res1) { doSomethingAsync(req2, function(err2, res2) { doSomethingAsync(req3, function(err3, res3) { doSomethingAsync(req4, function(err4, res4) { // ... }); }); }); }); Callback hell: control flow, error handling, and composition are all difficult コールバック地獄
  • 122. Many NPM packages are NOT stable or mature. Incompatibility + bugs + dynamic typing = pain. NPMに不安定なパッケージが多い。非互換性 + バグ + 動的型付け = 苦痛
  • 123. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10 10 10 3
  • 124. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10 10 10 3
  • 126. def sort(a: List[Int]): List[Int] = { if (a.length < 2) a else { val pivot = a(a.length / 2) sort(a.filter(_ < pivot)) ::: a.filter(_ == pivot) ::: sort(a.filter(_ > pivot)) Functional programming } }
  • 128. val NameTagPattern = "Hello, my name is (.+) (.+)".r val ListPattern = "Last: (.+). First: (.+).".r // Case classes automatically generate immutable fields, equals, hashCode, constructor case class Name(first: String, last: String) // Use Option to avoid returning null if there is no name found def extractName(str: String): Option[Name] = { Option(str).collectFirst { // Pattern matching on regular expressions case NameTagPattern(fname, lname) => Name(fname, lname) case ListPattern(lname, fname) => Name(fname, lname) } } Very expressive: case classes, pattern matching, lazy, option, implicits 表現力が高い
  • 129. Runs on the JVM; interop with Java.
  • 130. Concurrency & streaming tools: Futures, Akka, STM, threads, Scala.rx, Async/Await, Iteratees
  • 131. def index = Action { // Make 3 sequential, async calls for { foo <- WS.url(url1).get() bar <- WS.url(url2).get() baz <- WS.url(url3).get() } yield { // Build a result using foo, bar, and baz } } No callback hell!
  • 135. Fortunately, Play/SBT support incremental compilation and hot reload! Play/sbt はインクリメンタルコンパイラと hot reloading があるから大丈夫!
  • 138. Play is stable, but not mature: backwards incompatible API changes every release. Play は安定だがまだ成長期。APIはよく変わる
  • 139. Even worse: Scala is not binary compatible between releases! Scala はリリース間でバイナリ互換性を持たない!
  • 140. Backwards incompatibility = pain. … Static typing makes it a little more manageable. バイナリ互換性が無いのは辛いけど、静的な型によって少しは緩和される
  • 141. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10 10 10 3 8
  • 142. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10 10 10 3 8
  • 143. 544 Contributors 351 2,376 Watchers 576 31,332 Stars 5,077 6,970 Forks 1,872 3,066 PR’s 2,201 Github activity as of 08/10/14
  • 144. StackOverflow 10,698 53,555 Questions Google Group 14,199 Members 11,577 Google Group ~400 Posts/Month ~1,100 StackOverflow, mailing list activity as of 08/12/14
  • 145. 4 langpop.com 18 10 TIOBE 39 5 CodeEval 12 7 IEEE Spectrum 17 1 RedMonk 13 12 Lang-Index 26 Language Popularity as of 08/12/14 人気ランキング
  • 146. 88,000 packages in NPM ~80 Play Modules
  • 147. 88,000 packages in NPM 83,000 artifacts in Maven
  • 148. Joyent offers commercial support for Node.js Typesafe offers commercial support for Play 有償サポート
  • 151. 1,172 LinkedIn 49 3,605 Indeed 179 214 CareerBuilder 16 Open jobs as of 08/13/14 採用募集数
  • 152. 82,698 LinkedIn 9,037 2,267 Indeed 206 447 CareerBuilder 30 Candidates as of 08/13/14 採用候補者数
  • 153. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10 10 10 3 8 10 7
  • 154. Learn Develop Test Secure Build The framework scorecard Deploy Debug Scale Maintain Share 10 7 8 10 10 10 6 8 10 7 8 7 10 10 10 10 3 8 10 7
  • 158. Both frameworks are great. Decide based on strengths/weakness, not my arbitrary score! 結論:どちらもすごい!
  • 159. Use node.js if: 1. You’re building small apps with small teams 2. You already have a bunch of JavaScript ninjas 3. Your app is mostly client-side JavaScript 4. Your app is mostly real-time 5. Your app is purely I/O bound 向き: 小チーム小アプリ、JavaScript ニンジャ
  • 160. Don’t use node.js if: 1. You don’t write lots of automated tests 2. Your code base or team is going to get huge 3. You do lots of CPU or memory intensive tasks 不向き: 自動テスト書かない人、大チーム、高CPU か 高RAM
  • 161. Use Play if: 1. You’re already using the JVM 2. You like type safety and functional programming 3. Your code base or team is going to get big 4. You want a full stack framework 5. You need flexibility: non-blocking I/O, blocking I/O, CPU intensive tasks, memory intensive tasks 向き: JVM ユーザ、型安全性、関数型が好き、大チーム
  • 162. Don’t use Play if: 1. You don’t have time to master Play, Scala, and SBT 2. You hate functional programming or static typing 不向き: Play/Scala/sbt を勉強してる時間が無い、型安全性、関数型が嫌い