ffwd.pro - it's not you, it's me (or how to avoid being coupled with a javascript...

211
“It’s not you, It’s me”

Upload: marco-cedaro

Post on 29-Oct-2014

3 views

Category:

Technology


2 download

DESCRIPTION

General purpose Javascript frameworks are the ones that made the language popular in the past, but right now it is a risk to think about our application development and architecture just in relation to our favorite framework.This talk highlights risks and suggest some techniques (from design patterns to snippet of code) to avoid being coupled to a specific framework

TRANSCRIPT

Page 1: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

“It’s not you, It’s me”

Page 2: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

How to avoid being coupled with a Javascript

framework.

Page 3: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Even if you loved it.

Even if it was the right one.

Page 4: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Hello, who’s speaking?

Marco Cedaro @cedmax

Page 5: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

About me...

Frontend Cowboy Nicola Vitto Jr.

Hello, who’s speaking?

Marco Cedaro @cedmax

Page 6: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

About me...

Frontend Cowboy Nicola Vitto Jr.

Javascript PervertRoberto Felter

Hello, who’s speaking?

Marco Cedaro @cedmax

Page 7: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

About me...

Frontend Cowboy Nicola Vitto Jr.

Javascript PervertRoberto Felter

Marco.. who?basically anyone else

Hello, who’s speaking?

Marco Cedaro @cedmax

Page 8: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Actually I am:

a Frontend Developer at Spreaker.com

Hello, who’s speaking?

Marco Cedaro @cedmax

Page 9: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Actually I am:

a Frontend Developer at Spreaker.com

Conference organizer with From The Front

Hello, who’s speaking?

Marco Cedaro @cedmax

Page 10: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Actually I am:

a Frontend Developer at Spreaker.com

Conference organizer with From The Front

and a javascript pervert

Hello, who’s speaking?

Marco Cedaro @cedmax

Page 12: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

http://welovestyles.com/love-pictures/http://everyoneneedsanalgonquin.com/2012/03/25/fruit-season/

Page 13: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

General Purpose Frameworkshttp://geekadelphia.com/2008/05/01/sick-ink-brah-alex-hillmans-geeky-love-hate-tattoos/

Page 14: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

LOVE FACT #1

Love is a given, hatred is acquired.Doug Horton

Page 15: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Definition

frame·work n.

A structure for supporting or enclosing something else, especially a skeletal support used as the basis for something being constructed.

gen·er·al-pur·pose adj.

Designed for or suitable to more than one use; broadly useful.

Page 17: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Once upon a time

code snippet

“dhtml”

if (document.all)

http://creativecriminals.com/print/scotch-tape-beyond-strong/

Page 18: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Then

Page 19: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Then

Page 20: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Then

Page 21: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Then

Page 22: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Then

Page 23: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Now

Page 24: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Why did they get so popular?

DOM access

Cross browser implementation

Shorthands

Community support

Page 25: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Drawbacks

Page 26: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

1. Community Support

Page 27: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Let’s Fight

http://www.rustybrick.com/prototype-js-vs-jquery-comparison.html -http://www.fotolog.com/alinolandia/36818888/

Page 28: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

http://www.rustybrick.com/prototype-js-vs-jquery-comparison.html -http://www.fotolog.com/alinolandia/36818888/

Where’s your community now?

Page 29: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

2. Updating is a mess

Page 30: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Long life cycle websites

General purpose framework may seem the right solution to handle complexity

http://sproutsocial.com/insights/2011/11/how-to-iphone-ipad-friendly/ - http://pressganger.blogspot.it/2012/03/blog-progress-update.html - http://news.brothersoft.com/internet-explorer-10-focuses-html5-improves-performance-16036.html

Page 31: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Long life cycle websites

General purpose framework may seem the right solution to handle complexity

New browser, new framework version

http://sproutsocial.com/insights/2011/11/how-to-iphone-ipad-friendly/ - http://pressganger.blogspot.it/2012/03/blog-progress-update.html - http://news.brothersoft.com/internet-explorer-10-focuses-html5-improves-performance-16036.html

Page 32: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Long life cycle websites

General purpose framework may seem the right solution to handle complexity

New browser, new framework version

How many patches did you make in your

framework over years?

http://sproutsocial.com/insights/2011/11/how-to-iphone-ipad-friendly/ - http://pressganger.blogspot.it/2012/03/blog-progress-update.html - http://news.brothersoft.com/internet-explorer-10-focuses-html5-improves-performance-16036.html

Page 33: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Short life cycle websites

Counterintuitively situation is even worse

http://www.cnbc.com/id/46994692/The_Worst_Jobs_for_2012 - http://indiatransportportal.com/india-transport-studies/

Page 34: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Short life cycle websites

Counterintuitively situation is even worse

Less analysis and foresight

http://www.cnbc.com/id/46994692/The_Worst_Jobs_for_2012 - http://indiatransportportal.com/india-transport-studies/

Page 35: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Short life cycle websites

Counterintuitively situation is even worse

Less analysis and foresight

Did you make any patch in your

framework over years?

http://www.cnbc.com/id/46994692/The_Worst_Jobs_for_2012 - http://indiatransportportal.com/india-transport-studies/

Page 36: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Our job is evolving

Page 37: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

It's the browser, baby

Page 38: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

It's the browser, baby

Page 39: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Some frameworks are just not built formaintainability

Page 40: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Some frameworks are just not built for

simplicity

Page 41: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Some frameworks are just not built for

love

Page 42: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

3. Code Portability

Page 44: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

case study

Own scripts built on a known framework

Brand new website with responsive design

http://www.naba.it/newsletter_09_10/naba_n184.html - http://sevenspark.com/product/agility-responsive-minimal-html5-template/ - http://middleclasshell.com/republicans-ignore-catholics-when-it-comes-to-unemployment-benefits

Page 45: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

case study

Own scripts built on a known framework

Brand new website with responsive design

same old bloat code over 3g?

http://www.naba.it/newsletter_09_10/naba_n184.html - http://sevenspark.com/product/agility-responsive-minimal-html5-template/ - http://middleclasshell.com/republicans-ignore-catholics-when-it-comes-to-unemployment-benefits

Page 46: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

$LAB .script("jquery.js").wait() .script("scripts.js");

$LAB .script("xui.js").wait() .script("scripts.js");

Desktop

Mobile

Page 47: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

$LAB .script("jquery.js").wait() .script("scripts.js");

$LAB .script("xui.js").wait() .script("scripts.js");

Desktop

Mobile

Page 48: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

It's the browser, baby

Page 49: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

and the deviceshttp://www.newfangled.com/mobile_technology_and_web_enhanced_devices

Page 50: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

and the deviceshttp://www.newfangled.com/mobile_technology_and_web_enhanced_devices

Page 51: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

We need our code to bePORTABLE

Page 52: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

We need our code to bePORTABLE

but how?

Page 53: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

DISCLAIMER

http://www.destructoid.com/disappointment-a-postmortem-of-l-a-noire-224486.phtml

Page 54: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Go Vanillahttp://s394.photobucket.com/albums/pp28/cojohn55/?action=view&current=tasty-thursday-187-lets-get-naked.gif&mediafilter=images

Page 55: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

LOVE FACT #2

What is known as a French Kiss in the English speaking world is called an

English Kiss in France.

Page 56: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Loops

Page 57: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

_.each(items, function(item, i) { [...]});

Ext.each(items, function(item, i) { [...]});

$.each(items, function(i, item) { [...]});

items.each(function(item, i) { [...]});

Page 58: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

_.each(items, function(item, i) { [...]});

Ext.each(items, function(item, i) { [...]});

$.each(items, function(i, item) { [...]});

items.each(function(item, i) { [...]});

Page 59: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

_.each(items, function(item, i) { [...]});

Ext.each(items, function(item, i) { [...]});

$.each(items, function(i, item) { [...]});

items.each(function(item, i) { [...]});

Page 60: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

_.each(items, function(item, i) { [...]});

Ext.each(items, function(item, i) { [...]});

$.each(items, function(i, item) { [...]});

items.each(function(item, i) { [...]});

Page 61: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

$.each(items, function(i, item) { [...]});

Page 62: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = 0; i < items.length; i++) { [...]};

$.each(items, function(i, item) { [...]});

Page 63: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = 0; i < items.length; i++) { [...]};

$.each(items, function(i, item) { [...]});

Page 64: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

operations per second (higher is better)

Page 67: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

operations per second (higher is better)

Page 68: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

operations per second (higher is better)

Page 69: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = 0; i < items.length; i++) { [...]};

Page 70: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = -1; ++i < items.length;) { [...]};

for (var i = 0; i < items.length; i++) { [...]};

Page 71: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = -1; ++i < items.length;) { [...]};

for (var i = 0; i < items.length; i++) { [...]};

Page 72: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = -1; ++i < items.length;) { [...]};

for (var i = 0; i < items.length; i++) { [...]};

Page 73: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = -1; ++i < items.length;) { [...]};

for (var i = 0; i < items.length; i++) { [...]};

for (var i = -1, item;item = items[++i];) { [...]};

Page 74: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = -1; ++i < items.length;) { [...]};

for (var i = 0; i < items.length; i++) { [...]};

for (var i = -1, item;item = items[++i];) { [...]};

Page 75: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = -1; ++i < items.length;) { [...]};

for (var i = 0; i < items.length; i++) { [...]};

for (var i = -1, item;item = items[++i];) { [...]};

Page 76: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = -1; ++i < items.length;) { [...]};

for (var i = 0; i < items.length; i++) { [...]};

for (var i = -1, item;item = items[++i];) { [...]};

var i = 0;while (i < items.length) { [...] i++;};

Page 77: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = -1; ++i < items.length;) { [...]};

for (var i = 0; i < items.length; i++) { [...]};

for (var i = -1, item;item = items[++i];) { [...]};

var i = 0;while (i < items.length) { [...] i++;};

Page 78: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

for (var i = -1; ++i < items.length;) { [...]};

for (var i = 0; i < items.length; i++) { [...]};

for (var i = -1, item;item = items[++i];) { [...]};

var i = 0;while (i < items.length) { [...] i++;};

//and counting -> http://jsperf.com/loops/33

Page 79: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Vanilla loop

PROS

Lots of flavors

Performance benefits

CONS

mmm...

Page 80: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

wait, what?too many characters??

http://screenrant.com/game-thrones-episode-7-recap-spoilers-benm-117660/

Page 82: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

...and minify

http://www.destentor.nl/algemeen/show/3347136/Minime-sleept-site-voor-rechter-om-sexvideo.ece

Page 83: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Yeah, baby, yeah

http://www.destentor.nl/algemeen/show/3347136/Minime-sleept-site-voor-rechter-om-sexvideo.ece

Page 84: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Context Binding

Page 85: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var conf = { name: "jsDay",

clicked: function(event) { alert(this.name); }}

myElm.onclick = conf.clicked;

Page 86: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var conf = { name: "jsDay",

clicked: function(event) { alert(this.name); }}

myElm.onclick = conf.clicked;

Page 87: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var conf = { name: "jsDay",

clicked: function(event) { alert(this.name); }}

myElm.onclick = conf.clicked;

Page 88: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var conf = { name: "jsDay",

clicked: function(event) { alert(this.name); }}

myElm.onclick = conf.clicked;

Page 89: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var conf = { name: "jsDay",

clicked: function(event) { alert(this.name); }}

myElm.onclick = conf.clicked;

Page 90: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

conf.clicked.bind(conf)

conf.clicked.createDelegate(conf);

$.proxy(conf.clicked, conf);

conf.clicked.bind(conf)

Page 91: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

conf.clicked.bind(conf)

conf.clicked.createDelegate(conf);

$.proxy(conf.clicked, conf);

conf.clicked.bind(conf)

Page 92: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

conf.clicked.bind(conf)

conf.clicked.createDelegate(conf);

$.proxy(conf.clicked, conf);

conf.clicked.bind(conf)

Page 93: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

myElm.onclick = (function(context){ return function(){ conf.clicked.apply(context, arguments); }})(conf);

Page 94: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

myElm.onclick = (function(context){ return function(){ conf.clicked.apply(context, arguments); }})(conf);

Page 95: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

myElm.onclick = (function(context){ return function(){ conf.clicked.apply(context, arguments); }})(conf);

Page 96: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

myElm.onclick = (function(context){ return function(){ conf.clicked.apply(context, arguments); }})(conf);

Page 97: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

myElm.onclick = (function(context){ return function(){ conf.clicked.apply(context, arguments); }})(conf);

Page 98: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

myElm.onclick = (function(context){ return function(){ conf.clicked.apply(context, arguments); }})(conf);

Page 99: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

argh, my eyes are bleeding..

http://www.accessexcellence.org/AE/mspot/tbs/episode3a/ep3a06.php

Page 100: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    return function() {        func.apply(context, arguments);    };}

Page 101: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    return function() {        func.apply(context, arguments);    };}

Page 102: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    return function() {        func.apply(context, arguments);    };}

Page 103: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    return function() {        func.apply(context, arguments);    };}

Page 104: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    return function() {        func.apply(context, arguments);    };}

Page 105: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    return function() {        func.apply(context, arguments);    };}

myElm.onclick = MyNS.bind(conf.clicked, conf);

Page 106: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    return function() {        func.apply(context, arguments);    };}

myElm.onclick = $.proxy(conf.clicked, conf);

myElm.onclick = MyNS.bind(conf.clicked, conf);

Page 107: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AAAARGGGHHH

http://digitivity.org/1044/rss-kill-your-productivity-make-you-insane-waste-time

Page 108: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    

}

myElm.onclick = MyNS.bind(conf.clicked, conf);

return function() {    return func.apply(context, arguments);};

Page 109: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    

}

myElm.onclick = MyNS.bind(conf.clicked, conf);

$.proxy(func, context);

Page 110: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Design Patternshttp://failblog.org/vote

Page 111: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Wrapper Pattern

Page 112: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    

}

myElm.onclick = MyNS.bind(conf.clicked, conf);

$.proxy(func, context);

Page 113: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    

}

myElm.onclick = MyNS.bind(conf.clicked, conf);

$.proxy(func, context);

Page 114: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.bind = function(func, context) {    

}

myElm.onclick = MyNS.bind(conf.clicked, conf);

$.proxy(func, context);

Page 115: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

http://www.pinkblog.it/post/8396/comprare-i-preservativi-vi-imbarazza

Wrapper Pattern

Page 116: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

http://clericalwhispers.blogspot.it/2010/09/popes-anti-condom-message-is-sabotage.html

sorry I should have said“NSFW” and, moreover...

Page 117: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

http://clericalwhispers.blogspot.it/2010/09/popes-anti-condom-message-is-sabotage.html

sorry I should have said“NSFW” and, moreover...

Page 118: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; [...]}

var myEff = new AwesomeEffect("myId", { duration: 100, delay: 1000});

//{delay: 1000, duration:100, transition: "easeOut"};

Page 119: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; [...]}

var myEff = new AwesomeEffect("myId", { duration: 100, delay: 1000});

//{delay: 1000, duration:100, transition: "easeOut"};

Page 120: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; [...]}

var myEff = new AwesomeEffect("myId", { duration: 100, delay: 1000});

//{delay: 1000, duration:100, transition: "easeOut"};

Page 121: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; [...]}

var myEff = new AwesomeEffect("myId", { duration: 100, delay: 1000});

//{delay: 1000, duration:100, transition: "easeOut"};

Page 122: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; [...]}

var myEff = new AwesomeEffect("myId", { duration: 100, delay: 1000});

//{delay: 1000, duration:100, transition: "easeOut"};

Page 123: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; [...]}

var myEff = new AwesomeEffect("myId", { duration: 100, delay: 1000});

//{delay: 1000, duration:100, transition: "easeOut"};

Page 124: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

_.extend(default, config);

Ext.apply(default, config);

$.extend(default, config);

Object.extend(default, config);

Page 125: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

_.extend(default, config);

Ext.apply(default, config);

$.extend(default, config);

Object.extend(default, config);

Page 126: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

_.extend(default, config);

Ext.apply(default, config);

$.extend(default, config);

Object.extend(default, config);

Page 127: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.extend = function(destination, source) { return}

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; var options = MyNS.extend(default, config); [...]}

$.extend(default, config);

Page 128: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.extend = function(destination, source) { return}

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; var options = MyNS.extend(default, config); [...]}

$.extend(default, config);

Page 129: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.extend = function(destination, source) { return}

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; var options = MyNS.extend(default, config); [...]}

Ext.apply(default, config);

Page 130: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.extend = function(destination, source) { return}

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; var options = MyNS.extend(default, config); [...]}

_.extend(default, config);

Page 131: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.extend = function(destination, source) { return}

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; var options = MyNS.extend(default, config); [...]}

Object.extend(default, config);

Page 132: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Wasn’t it bad to delegate?

http://clericalwhispers.blogspot.it/2010/09/popes-anti-condom-message-is-sabotage.html

Page 133: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.extend = function(destination, source) { return}

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; var options = MyNS.extend(default, config); [...]}

var myEff = new AwesomeEffect("myId", { duration: 100, delay: 1000});

$.extend(default, config);

Page 134: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.extend = function(destination, source) { return}

var AwesomeEffect = function(id, config){ var default = { delay: 0, duration: 500, transition: "easeOut", }; var options = MyNS.extend(default, config); [...]}

var myEff = new AwesomeEffect("myId", { duration: 100, delay: 1000});

$.extend(default, config);

Page 135: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

deeply into it

Page 136: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ overlayOpacity:0.6, imageLoading: "/img/warn.gif", }, config); new LightBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 137: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ overlayOpacity:0.6, imageLoading: "/img/warn.gif", }, config); new LightBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 138: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ overlayOpacity:0.6, imageLoading: "/img/warn.gif", }, config); new LightBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 139: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ overlayOpacity:0.6, imageLoading: "/img/warn.gif", }, config); new LightBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 140: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ overlayOpacity:0.6, imageLoading: "/img/warn.gif", }, config); new LightBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 141: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 142: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 143: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 144: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 145: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config);}

MyNS.Layer("Sorry, an error occured");

Page 146: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Event Driven Design

Page 147: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer = function(content, config){

[...]

}

MyNS.Layer("Sorry, an error occured");

Page 148: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.Layer("Sorry, an error occured");

Page 149: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.notify("error", {

msg: "Sorry, an error occured"

});

Page 150: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.notify("error", {

msg: "Sorry, an error occured"

});

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Page 151: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.notify("error", {

msg: "Sorry, an error occured"

});

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Page 152: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.notify("error", {

msg: "Sorry, an error occured"

});

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Page 153: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.notify("error", {

msg: "Sorry, an error occured"

});

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Page 154: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.notify("error", {

msg: "Sorry, an error occured"

});

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Page 155: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.notify("error", {

msg: "Sorry, an error occured"

});

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Page 156: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.notify("error", {

msg: "Sorry, an error occured"

});

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Page 157: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.notify("error", {

msg: "Sorry, an error occured"

});

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Page 158: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Advantages

Page 159: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Advantages

Semantic

Page 160: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

MyNS.listen("error", function(payload){

MyNS.Layer(payload.msg);

});

Advantages

Semantic

More Flexible

Page 161: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Advantages

Unpluggable

Page 162: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

almost decoupled

http://thewellversed.com/2010/12/09/love-warranties-they-dont-make-them-like-they-used-to/broken-heart/

Page 163: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

What about ... ?

Page 164: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

a real world example

Page 165: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

DISCLAIMER #2

http://www.noncipossocredere.com/2012/04/26/lo-spam-arriva-soprattutto-dallindia/

Page 166: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

From The Front

Page 167: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Not only the conference

Page 168: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

basically a lot of stuff

Page 169: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

basically a lot of stuff

@sid05

@verlok @aureliari

@lucasalvini

Page 170: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

cross site menu

Page 171: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Goals

modify a single file to update menu

do not depend on website implementation

do not interfere with website implementation

Page 172: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

Page 173: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

Page 174: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

DOMEvents: Vine0.8kB

Page 175: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

DOMEvents: Vine0.8kB

OUR CODE:microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 176: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

DOMEvents: Vine0.8kB

OUR CODE:microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 177: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

DOMEvents: Vine0.8kB

OUR CODE:microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 178: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

DOMEvents: Vine0.8kB

OUR CODE:microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 179: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

DOMEvents: Vine0.8kB

OUR CODE:microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 180: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

DOMEvents: Vine0.8kB

OUR CODE:microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 181: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

DOMEvents: Vine0.8kB

OUR CODE:microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 182: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

AJAX:MicroAjax0.4kB

DOM: TinyDOM0.4kB

DOMEvents: Vine0.8kB

OUR CODE:microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

SIZE: 1.8kB

Page 183: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 184: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

microAjax("static/nav.html", function (res) { $.prependBody(res); vine.bind("ftf_xsite_sel", "change", function(e){ var s = $.id("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 185: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

FTF.ajax("static/nav.html", { success: function (res) { FTF.dom.prependBody(res); FTF.evt.bind("ftf_xsite", "change", function(e){ var s = FTF("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 186: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

FTF.ajax("static/nav.html", { success: function (res) { FTF.dom.prependBody(res); FTF.evt.bind("ftf_xsite", "change", function(e){ var s = FTF("ftf_xsite"); var href = s.options[s.selectedIndex].value; if (href) { document.location.href = href; } });});

Page 187: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Actually decoupled

http://thewellversed.com/2010/12/09/love-warranties-they-dont-make-them-like-they-used-to/broken-heart/

Page 188: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Ain’t that badhttp://locomente.blogspot.it/2012/02/single-unemployed.html

Page 189: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

LOVE FACT #3

2 out of 5 people marry their first love.

Page 190: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

You may want a silver bullet

http://www.splattlog.com/2009/02/28/the-wolf-man-ecco-la-trasformazione-di-benicio-del-toro/

Page 191: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Do you really need it?

Page 192: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Work to decouple your FOUNDATION CODE

Page 193: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Work to decouple your FOUNDATION CODE

AND TEST IT!

Page 194: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Let your UI rely on a framework

http://loveallit.tumblr.com/post/1044567068/jegushi-please-dont-leave-me

Page 195: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Advantages of this approach

Page 196: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Portability & Maintainability

http://news.tecnozoom.it/tv-lcd/piu-persone-usano-tv-ed-internet-contemporaneamente-post-16157.html - http://marine.rina.org/CATEGORIE_SERVIZI/Gestione_rischio/servizi/maintenance.aspx

Page 198: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Improve javascript skills

http://edtechdigest.wordpress.com/2010/09/06/6-reasons-why-students-need-21st-century-skills/

Page 199: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

Mobile$LAB .script("xui.js").wait() .script("layer.mobile.js") .script("scripts.js")

$LAB .script("jquery.js").wait() .script("lightbox.jquery.js") .script("layer.desktop.js") .script("scripts.js");

Desktop

Page 200: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

the whole point is

Page 201: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

BE A JAVASCRIPT PERVERT

Page 202: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

BE A JAVASCRIPT PERVERT

Page 203: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

play with javascript

BE A JAVASCRIPT PERVERT

Page 204: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

play with javascript

discover your own project needs

BE A JAVASCRIPT PERVERT

Page 205: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

play with javascript

discover your own project needs

BE A JAVASCRIPT PERVERT

Page 206: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

play with javascript

discover your own project needs

BE A JAVASCRIPT PERVERT

let github be your playground

Page 207: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

play with javascript

discover your own project needs

BE A JAVASCRIPT PERVERT

let github be your playground

javascript is fun

Page 208: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

play with javascript

discover your own project needs

BE A JAVASCRIPT PERVERT

let github be your playground

javascript is fun

javascript is lovable

Page 209: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

play with javascript

discover your own project needs

BE A JAVASCRIPT PERVERT

let github be your playground

javascript is fun

javascript is lovablebut you also need to...

Page 210: FFWD.PRO - It's not you, It's me (or how to avoid being coupled with a Javascript framework)

know when to stop