THE JAVASCRIPT DELUSION
AND WHY JAVA WILL CONTINUE TO RULE THE BUSINESS WORLD
JUGBD MEETUP 6.0
HOW IT ALL BEGAN
HISTORY
In 1995, the company recruited Brendan Eich with the goal of
embedding the Scheme programming language into its Netscape
Navigator.
Before he could get started, Netscape Communications collaborated
with Sun Microsystems to include in Netscape Navigator Sun's more
static programming language Java, in order to compete with Microsoft
for user adoption of Web technologies and platforms.
… the company needed a prototype. Eich wrote one in 10 days, in May
1995.
https://en.wikipedia.org/wiki/JavaScript
Picture Credit: By Darcy Padilla - http://web.archive.org/web/20140209081556/http://blog.mozilla.org/press/bios/brendan-eich/ http://web.archive.org/web/20131108073412/https://blog.mozilla.org/press/files/2012/04/Thumbnail-Full_Eich_04.jpg, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=31783773
A LITTLE MORE HISTORY
2009
2010
NPM Logo: By Boris Vacher - derivative work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=35142030
Angular Logo: By AngularJS - https://github.com/angular/angular.js/tree/master/images/logo, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=31016280
2013
THE COOLEST
PLATFORM
THE HYPE CYCLE
By Jeremykemp at English Wikipedia, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=10547051
HOW DOES IT REALLY
COMPARE?
THE CATEGORIES
HOW DOES IT REALLY COMPARE?
• Execution model and being Functional
• Type system and compilation
• Build system & testing
• Refactoring
• Frameworks
• Standards
THE TALE OF BEING “FUNCTIONAL”
EXECUTION MODEL
• Inherently asynchronous — everywhere!
• Functional — not by choice!
• Callback hell
CALLBACKHELL.COM
fs.readdir(source, function (err, files) {
if (err) {
console.log('Error finding files: ' + err)
} else {
files.forEach(function (filename, fileIndex) {
console.log(filename)
gm(source + filename).size(function (err, values) {
if (err) {
console.log('Error identifying file size: ' + err)
} else {
console.log(filename + ' : ' + values)
aspect = (values.width / values.height)
widths.forEach(function (width, widthIndex) {
height = Math.round(width / aspect)
console.log('resizing ' + filename + 'to ' + height + 'x' + height)
this.resize(width, height).write(dest + 'w' + width + '_' + filename, function(err) {
if (err) console.log('Error writing file: ' + err)
})
}.bind(this))
}
})
})
}
})
THE TALE OF BEING “FUNCTIONAL”
EXECUTION MODEL
• Inherently asynchronous — everywhere!
• Functional — not by choice!
• Callback hell
• Callback → Promise → Generators → async-await
• async-await is still a hell, just a bit better one
• Stack trace is useless in most cases in production! (Oh yeah yeah, they are solving it… 😴)
OH YEAH, WE HAVE TYPES DUDE!
TYPE SYSTEM
• Types are not needed
• It’s much faster to program without types
• OK OK, we have Flow! Gradual typing!
• TypeScript too, but wait a second, it’s not JavaScript!
• Our type system is more advanced than Java!
IT’S A MYTH!
NO NEED TO COMPILE!
• You don’t need to compile in JavaScript!
• Faster feedback for programmers!
• You need to transpile in any non-trivial project
• Orders of magnitude slower than Java compilation
• What happened to the “fast feedback” carrot?
WE HAVE TOO MANY!
BUILD SYSTEM
• Grunt? Gulp? Broccoli? Brunch? Back to Make and shell scripts?
• You know gulp, right?
HERE IS A GULP CONFIG
const gulp = require( 'gulp'),
del = require('del'),
nib = require('nib'),
jeet = require('jeet'),
rupture = require('rupture'),
nano = require('cssnano'),
processURL = require('postcss-url'),
through = require('through2'),
pump = require('pump'),
memCache = require('gulp-memory-cache'),
cache = require('gulp-cached'),
rev = require('gulp-rev'),
gulpIf = require('gulp-if'),
gutil = require('gulp-util'),
stylus = require('gulp-stylus'),
useref = require('gulp-useref'),
uglify = require('gulp-uglify'),
plumber = require('gulp-plumber'),
postcss = require('gulp-postcss'),
revReplace = require('gulp-rev-replace'),
webpack = require('webpack'),
WebpackDevServer = require('webpack-dev-server'),
webpackConfig = require('./webpack.config');
WE HAVE IT!
BUILD SYSTEM - 2
• Grunt? Gulp? Broccoli? Brunch? Back to Make and shell scripts?
• You know gulp, right?
• Bundlers? RequireJS → Browserify → Webpack
• Modules? AMD → CommonJS → ES6
• Compare to Java:
• Build: ant or maven, based on clear criteria
• Module: JAR, from beginning to now
ENDLESS CHOICES!
TESTING
• Mocha, Chai, Karma, Chutzpah, JSUnit, Lab, Code
• Jasmine, Jest
• Just too many choices!
• Compare to Java:
• Spring Test - nothing close to it in JavaScript
• JUnit or TestNG
AND JAVASCRIPT? FORGET IT!
REFACTORING
• Incredibly hard, due to the dynamic nature
• WebStorm is the only IDE that even attempts to do it
• Code tends to be write once
• Limits the size of the project and team
• Microservices inevitable at a point ➟ with all its overhead
THE MORE THE MERRIER!
FRAMEWORKS
• Express, koa, hapi, sails, seneca
• No clear winners
• Compare to Java:
• Nothing that even comes close to JEE or Spring
WE DON’T DO THEM HERE!
STANDARD INTERFACES
• Complete lack of anything like:
• JDBC — for SQL
• JMS — for message queues
• JTA — for transaction management
• JPA — for ORM. Actually, nothing close to any serious ORM!
• Servlet Specs — change between servlet/app servers
• Same issue in other non Java platforms too
WHEN IT COMES TO LARGE BUSINESS ENVIRONMENTS
SEROUSLY LACKING
• No distributed TX management
• Hard to change DB and messaging/queue
• No winning backend framework
• Constant change
• Lack of documentation
IN BIG BUSINESS
WHEN IT MAKES SENSE
• Heavily interactive front-end
• Back-end support for such a front-end
• Glue between REST services
• Streaming
”
“
— Mojahedul Hoque Abul Hasanat (Masum)
DO NOT CHOOSE JAVASCRIPT FOR
THE WRONG REASONS
HIRING FRONT-END ENGINEERS!
career@backpackbang.com
THANK YOU!
Mojahedul Hoque Abul Hasanat
just.unix@gmail.com
@just_unix

The JavaScript Delusion

  • 1.
    THE JAVASCRIPT DELUSION ANDWHY JAVA WILL CONTINUE TO RULE THE BUSINESS WORLD JUGBD MEETUP 6.0
  • 2.
    HOW IT ALLBEGAN HISTORY In 1995, the company recruited Brendan Eich with the goal of embedding the Scheme programming language into its Netscape Navigator. Before he could get started, Netscape Communications collaborated with Sun Microsystems to include in Netscape Navigator Sun's more static programming language Java, in order to compete with Microsoft for user adoption of Web technologies and platforms. … the company needed a prototype. Eich wrote one in 10 days, in May 1995. https://en.wikipedia.org/wiki/JavaScript Picture Credit: By Darcy Padilla - http://web.archive.org/web/20140209081556/http://blog.mozilla.org/press/bios/brendan-eich/ http://web.archive.org/web/20131108073412/https://blog.mozilla.org/press/files/2012/04/Thumbnail-Full_Eich_04.jpg, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=31783773
  • 3.
    A LITTLE MOREHISTORY 2009 2010 NPM Logo: By Boris Vacher - derivative work, CC BY-SA 4.0, https://commons.wikimedia.org/w/index.php?curid=35142030 Angular Logo: By AngularJS - https://github.com/angular/angular.js/tree/master/images/logo, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=31016280 2013
  • 4.
  • 5.
    THE HYPE CYCLE ByJeremykemp at English Wikipedia, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=10547051
  • 6.
    HOW DOES ITREALLY COMPARE?
  • 7.
    THE CATEGORIES HOW DOESIT REALLY COMPARE? • Execution model and being Functional • Type system and compilation • Build system & testing • Refactoring • Frameworks • Standards
  • 8.
    THE TALE OFBEING “FUNCTIONAL” EXECUTION MODEL • Inherently asynchronous — everywhere! • Functional — not by choice! • Callback hell
  • 9.
    CALLBACKHELL.COM fs.readdir(source, function (err,files) { if (err) { console.log('Error finding files: ' + err) } else { files.forEach(function (filename, fileIndex) { console.log(filename) gm(source + filename).size(function (err, values) { if (err) { console.log('Error identifying file size: ' + err) } else { console.log(filename + ' : ' + values) aspect = (values.width / values.height) widths.forEach(function (width, widthIndex) { height = Math.round(width / aspect) console.log('resizing ' + filename + 'to ' + height + 'x' + height) this.resize(width, height).write(dest + 'w' + width + '_' + filename, function(err) { if (err) console.log('Error writing file: ' + err) }) }.bind(this)) } }) }) } })
  • 10.
    THE TALE OFBEING “FUNCTIONAL” EXECUTION MODEL • Inherently asynchronous — everywhere! • Functional — not by choice! • Callback hell • Callback → Promise → Generators → async-await • async-await is still a hell, just a bit better one • Stack trace is useless in most cases in production! (Oh yeah yeah, they are solving it… 😴)
  • 11.
    OH YEAH, WEHAVE TYPES DUDE! TYPE SYSTEM • Types are not needed • It’s much faster to program without types • OK OK, we have Flow! Gradual typing! • TypeScript too, but wait a second, it’s not JavaScript! • Our type system is more advanced than Java!
  • 12.
    IT’S A MYTH! NONEED TO COMPILE! • You don’t need to compile in JavaScript! • Faster feedback for programmers! • You need to transpile in any non-trivial project • Orders of magnitude slower than Java compilation • What happened to the “fast feedback” carrot?
  • 13.
    WE HAVE TOOMANY! BUILD SYSTEM • Grunt? Gulp? Broccoli? Brunch? Back to Make and shell scripts? • You know gulp, right?
  • 14.
    HERE IS AGULP CONFIG const gulp = require( 'gulp'), del = require('del'), nib = require('nib'), jeet = require('jeet'), rupture = require('rupture'), nano = require('cssnano'), processURL = require('postcss-url'), through = require('through2'), pump = require('pump'), memCache = require('gulp-memory-cache'), cache = require('gulp-cached'), rev = require('gulp-rev'), gulpIf = require('gulp-if'), gutil = require('gulp-util'), stylus = require('gulp-stylus'), useref = require('gulp-useref'), uglify = require('gulp-uglify'), plumber = require('gulp-plumber'), postcss = require('gulp-postcss'), revReplace = require('gulp-rev-replace'), webpack = require('webpack'), WebpackDevServer = require('webpack-dev-server'), webpackConfig = require('./webpack.config');
  • 15.
    WE HAVE IT! BUILDSYSTEM - 2 • Grunt? Gulp? Broccoli? Brunch? Back to Make and shell scripts? • You know gulp, right? • Bundlers? RequireJS → Browserify → Webpack • Modules? AMD → CommonJS → ES6 • Compare to Java: • Build: ant or maven, based on clear criteria • Module: JAR, from beginning to now
  • 16.
    ENDLESS CHOICES! TESTING • Mocha,Chai, Karma, Chutzpah, JSUnit, Lab, Code • Jasmine, Jest • Just too many choices! • Compare to Java: • Spring Test - nothing close to it in JavaScript • JUnit or TestNG
  • 17.
    AND JAVASCRIPT? FORGETIT! REFACTORING • Incredibly hard, due to the dynamic nature • WebStorm is the only IDE that even attempts to do it • Code tends to be write once • Limits the size of the project and team • Microservices inevitable at a point ➟ with all its overhead
  • 18.
    THE MORE THEMERRIER! FRAMEWORKS • Express, koa, hapi, sails, seneca • No clear winners • Compare to Java: • Nothing that even comes close to JEE or Spring
  • 19.
    WE DON’T DOTHEM HERE! STANDARD INTERFACES • Complete lack of anything like: • JDBC — for SQL • JMS — for message queues • JTA — for transaction management • JPA — for ORM. Actually, nothing close to any serious ORM! • Servlet Specs — change between servlet/app servers • Same issue in other non Java platforms too
  • 20.
    WHEN IT COMESTO LARGE BUSINESS ENVIRONMENTS SEROUSLY LACKING • No distributed TX management • Hard to change DB and messaging/queue • No winning backend framework • Constant change • Lack of documentation
  • 21.
    IN BIG BUSINESS WHENIT MAKES SENSE • Heavily interactive front-end • Back-end support for such a front-end • Glue between REST services • Streaming
  • 22.
    ” “ — Mojahedul HoqueAbul Hasanat (Masum) DO NOT CHOOSE JAVASCRIPT FOR THE WRONG REASONS
  • 23.
  • 24.
    THANK YOU! Mojahedul HoqueAbul Hasanat just.unix@gmail.com @just_unix