Berlin native. Bit herder. Code connoisseur. Coffee lover.
software professional > 7 years
JVM based web applications
strong frontend focus
some iOS
the year was 1995
browser wars between Microsoft and Netscape
forced Java-like Syntax
forced confusing Java name
extreme time pressure
browser wars → copy wars
IE copied JavaScript within 1 year
JScript
in 1997 JavaScript became ECMA Script
adopted by all browser manufacturers
consistend behaviour in browsers
does not directly cover the DOM API
source of pain in old browsers
very different interpretation
inconsistent API
wrong implementations
...more on that later
simple DOM manipulations
reacting to user input
simple glue code
getting it to work consistent in Mozilla and IE was a pain
...but
scripts were simple
all was good
until...
introduced around 2000
by Microsoft for Outlook Web Access
XMLHttpRequest
standardized by W3C in 2006
// attaching an eventlistener
if (elem.addEventListener) {
elem.addEventListener(event, callbackFn, false);
} else {
elem.attachEvent("on" + event, callbackFn);
}
libraries to abstract cross browser quirks away popped up everywhere
They usually provided uniform event handling, AJAX facilities and some basic animation support
jQuery, Mootools, YUI, Scriptaculous, Prototype and many more
most successfull
initial release 2006
taught a lot of devs about CSS selectors
$(elem).on('click', callbackFn);
very imperative approach
no architectural support
manually attach event handlers
manually mangle DOM with AJAX results
spaghetti-callback code
$('#actionButton').on('click', function() {
var data = collectAndValidateUserInput();
$.ajax(
type: 'POST',
data: data,
success: function(response) {
$('#outputArea').html(prepareOutputFromResponse(response));
}
);
});
How do you test this?
Seperation of concerns?
Reuse?
state? DOM? JS?
widely in use
sucessfull
requires discipline
GWT, JSF et. al.
very leaky abstractions
usually crappy UI/UX
too little control
treat it as a first class citizen of your technology stack
apply some architecture and software engineering best practices
no more compatibility problems
very fast
highly sophisticated
Chromes engine V8 w/o the Browser
released 2009
foundation for many great tools
some variation of Model-View-Controller
smalltalk did this in the 70ies
different MVC interpretations
Model View Controller
Model View View-Model
Model View Presenter
dozens of frameworks
similar situation to jQuery-like libraries a few years ago
a new one popping up every few minutes
hopefully convinces you about MVC instead of manually weaving
events into applications
Superheroic JavaScript MVW Framework
innovative approaches to web dev
Open Source (MIT), developed at Google
first release 2009
currently 1.2.13
~99kB minified
Igor Minar
Miško Hevery
flexible extensions to HTML
attributes, tags, classes and comments
DOM interactions should (usually) all be directives
we are only just scratching the surface of what angular can do
want to learn more? ask me later!
AngularJS uses jQuery if it is available
falls back to jQLite otherwise
common recommendation: start w/o jQuery to avoid falling back into old habbits
Version 1.3 expected in a few weeks
drops IE8 support (and so should you)
removes deprecated features
AngularJS might be a bridge technology
Google is pushing hard in that direction
databinding → Object.observe
directives → WebComponents
modularity → ECMA Script 6
dependeny injection → simple library?
...looong way
AngularDart
Dart, ClojureScript, etc.
real improvement
heavy (performance and learning curve)
CoffeeScript, TypeScript, Sweet.js, etc.
can improve developer-happyness
usually minor improvements over JavaScript
require knowledge of JavaScript
no silver bullet
user, where appropriate
won't replace JavaScript
source maps are finally here (except in IE)
JavaScript Engines are already very fast
JavaScript is now an LLVM target
asm.js - highly optimizable subset of JS
intended as a compilation target
don't expect a new language to show up
consense is highly unlikely
better get used to it
ECMA Script 6 (Harmony)
beta feature in most browsers
first real improvements in 5 years
modules, real maps/sets, syntax cleanup
const FOO = 'foo';
let blockScoped = '\o/';
var [a, b] = [b, a];
for (i of aThing) { ... }
(aParam) => { return aParam * 2 }
JavaScript might evolve into a nice language
a lot better
standardization and auto-updates
far less need for jQuery
even IE10 is a nice browser
stop hating JS - it had a rough childhood
treat the web page as a proper UI - use some Model-View-Whatever
JS turns into a nice language - still unsatisfied? compile to it
View technology (no M, no C)
developed at facebook
very interesting concepts
I have nearly no experience in react.js
following might contain errors
don't confuse with react.js
always render the whole app
widgets render based on current state
utilizes requestAnimationFrame
isn't rendering the whole app everytime slow?
render the whole app to a virtual DOM
diff the virtual DOM with previous frame
only apply necessary changes to real DOM
updates to the model cause DOM change for free
clear architecture
virtual dom also works on the server
SPA can be delivered with initial DOM generated on server
var Timer = React.createClass({
getInitialState: function() {
return {secondsElapsed: 0};
},
tick: function() {
this.setState({secondsElapsed: this.state.secondsElapsed + 1});
},
componentDidMount: function() {
this.interval = setInterval(this.tick, 1000);
},
render: function() {
return (
React.DOM.div(null, "Seconds Elapsed: ", this.state.secondsElapsed)
);
}
});
might not be The Next Big Thing™
great concept, likely to become more mainstream in one form or another
different enough to be worth checking out
much love in Function Programming circles