Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

How to avoid being coupled with a Javascript framework.

Slide 3

Slide 3 text

Even if you loved it. Even if it was the right one.

Slide 4

Slide 4 text

Hello, who’s speaking? Marco Cedaro @cedmax

Slide 5

Slide 5 text

About me... Frontend Cowboy Nicola Vitto Jr. Hello, who’s speaking? Marco Cedaro @cedmax

Slide 6

Slide 6 text

About me... Frontend Cowboy Nicola Vitto Jr. Javascript Pervert Roberto Felter Hello, who’s speaking? Marco Cedaro @cedmax

Slide 7

Slide 7 text

About me... Frontend Cowboy Nicola Vitto Jr. Javascript Pervert Roberto Felter Marco.. who? basically anyone else Hello, who’s speaking? Marco Cedaro @cedmax

Slide 8

Slide 8 text

Actually I am: a Frontend Developer at Spreaker.com Hello, who’s speaking? Marco Cedaro @cedmax

Slide 9

Slide 9 text

Actually I am: a Frontend Developer at Spreaker.com Conference organizer with From The Front Hello, who’s speaking? Marco Cedaro @cedmax

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

http://welovestyles.com/love-pictures/

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

LOVE FACT #1 Love is a given, hatred is acquired. Doug Horton

Slide 15

Slide 15 text

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.

Slide 16

Slide 16 text

A little history http://mattstone.blogs.com/photos/christian_art_genesis/adam-eve-and-the-tree.html

Slide 17

Slide 17 text

Once upon a time code snippet “dhtml” if (document.all) http://creativecriminals.com/print/scotch-tape-beyond-strong/

Slide 18

Slide 18 text

Then

Slide 19

Slide 19 text

Then

Slide 20

Slide 20 text

Then

Slide 21

Slide 21 text

Then

Slide 22

Slide 22 text

Then

Slide 23

Slide 23 text

Now

Slide 24

Slide 24 text

Why did they get so popular? DOM access Cross browser implementation Shorthands Community support

Slide 25

Slide 25 text

Drawbacks

Slide 26

Slide 26 text

1. Community Support

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

http://www.rustybrick.com/prototype-js-vs-jquery-comparison.html -http://www.fotolog.com/alinolandia/36818888/ Where’s your community now?

Slide 29

Slide 29 text

2. Updating is a mess

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

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/

Slide 34

Slide 34 text

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/

Slide 35

Slide 35 text

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/

Slide 36

Slide 36 text

Our job is evolving

Slide 37

Slide 37 text

It's the browser, baby

Slide 38

Slide 38 text

It's the browser, baby

Slide 39

Slide 39 text

Some frameworks are just not built for maintainability

Slide 40

Slide 40 text

Some frameworks are just not built for simplicity

Slide 41

Slide 41 text

Some frameworks are just not built for love

Slide 42

Slide 42 text

3. Code Portability

Slide 43

Slide 43 text

case study Own scripts built on a known framework 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

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

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

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

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

Slide 48

Slide 48 text

It's the browser, baby

Slide 49

Slide 49 text

and the devices http://www.newfangled.com/mobile_technology_and_web_enhanced_devices

Slide 50

Slide 50 text

and the devices http://www.newfangled.com/mobile_technology_and_web_enhanced_devices

Slide 51

Slide 51 text

We need our code to be PORTABLE

Slide 52

Slide 52 text

We need our code to be PORTABLE but how?

Slide 53

Slide 53 text

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

Slide 54

Slide 54 text

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

Slide 55

Slide 55 text

LOVE FACT #2 What is known as a French Kiss in the English speaking world is called an English Kiss in France.

Slide 56

Slide 56 text

Loops

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

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

Slide 60

Slide 60 text

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

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

for (var i = 0; i < items.length; i++) { [...] }; $.each(items, function(i, item) { [...] });

Slide 63

Slide 63 text

for (var i = 0; i < items.length; i++) { [...] }; $.each(items, function(i, item) { [...] });

Slide 64

Slide 64 text

operations per second (higher is better)

Slide 65

Slide 65 text

yes, but... http://www.funnyjunk.com/funny_pictures/3454040/Guess+what/

Slide 66

Slide 66 text

you should http://www.behaviorgap.com/sketch/things-you-can-control/

Slide 67

Slide 67 text

operations per second (higher is better)

Slide 68

Slide 68 text

operations per second (higher is better)

Slide 69

Slide 69 text

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

Slide 70

Slide 70 text

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

Slide 71

Slide 71 text

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

Slide 72

Slide 72 text

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

Slide 73

Slide 73 text

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

Slide 74

Slide 74 text

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

Slide 75

Slide 75 text

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

Slide 76

Slide 76 text

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++; };

Slide 77

Slide 77 text

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++; };

Slide 78

Slide 78 text

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

Slide 79

Slide 79 text

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

Slide 80

Slide 80 text

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

Slide 81

Slide 81 text

Vanilla loop PROS Lots of flavors Performance benefits CONS mmm...

Slide 82

Slide 82 text

wait, what? too many characters?? http://screenrant.com/game-thrones-episode-7-recap-spoilers-benm-117660/

Slide 83

Slide 83 text

Zip It! http://screenrant.com/austin-powers-4-2-ross-50006/

Slide 84

Slide 84 text

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

Slide 85

Slide 85 text

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

Slide 86

Slide 86 text

Context Binding

Slide 87

Slide 87 text

var conf = { name: "jsDay", clicked: function(event) { alert(this.name); } } myElm.onclick = conf.clicked;

Slide 88

Slide 88 text

var conf = { name: "jsDay", clicked: function(event) { alert(this.name); } } myElm.onclick = conf.clicked;

Slide 89

Slide 89 text

var conf = { name: "jsDay", clicked: function(event) { alert(this.name); } } myElm.onclick = conf.clicked;

Slide 90

Slide 90 text

var conf = { name: "jsDay", clicked: function(event) { alert(this.name); } } myElm.onclick = conf.clicked;

Slide 91

Slide 91 text

var conf = { name: "jsDay", clicked: function(event) { alert(this.name); } } myElm.onclick = conf.clicked;

Slide 92

Slide 92 text

conf.clicked.bind(conf) conf.clicked.createDelegate(conf); $.proxy(conf.clicked, conf); conf.clicked.bind(conf)

Slide 93

Slide 93 text

conf.clicked.bind(conf) conf.clicked.createDelegate(conf); $.proxy(conf.clicked, conf); conf.clicked.bind(conf)

Slide 94

Slide 94 text

conf.clicked.bind(conf) conf.clicked.createDelegate(conf); $.proxy(conf.clicked, conf); conf.clicked.bind(conf)

Slide 95

Slide 95 text

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

Slide 96

Slide 96 text

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

Slide 97

Slide 97 text

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

Slide 98

Slide 98 text

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

Slide 99

Slide 99 text

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

Slide 100

Slide 100 text

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

Slide 101

Slide 101 text

argh, my eyes are bleeding.. http://www.accessexcellence.org/AE/mspot/tbs/episode3a/ep3a06.php

Slide 102

Slide 102 text

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

Slide 103

Slide 103 text

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

Slide 104

Slide 104 text

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

Slide 105

Slide 105 text

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

Slide 106

Slide 106 text

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

Slide 107

Slide 107 text

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

Slide 108

Slide 108 text

MyNS.bind = function(func, context) { return function() { func.apply(context, arguments); }; } myElm.onclick = $.proxy(conf.clicked, conf); myElm.onclick = MyNS.bind(conf.clicked, conf);

Slide 109

Slide 109 text

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

Slide 110

Slide 110 text

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

Slide 111

Slide 111 text

MyNS.bind = function(func, context) { } myElm.onclick = MyNS.bind(conf.clicked, conf); $.proxy(func, context);

Slide 112

Slide 112 text

Design Patterns http://failblog.org/vote

Slide 113

Slide 113 text

Wrapper Pattern

Slide 114

Slide 114 text

MyNS.bind = function(func, context) { } myElm.onclick = MyNS.bind(conf.clicked, conf); $.proxy(func, context);

Slide 115

Slide 115 text

MyNS.bind = function(func, context) { } myElm.onclick = MyNS.bind(conf.clicked, conf); $.proxy(func, context);

Slide 116

Slide 116 text

MyNS.bind = function(func, context) { } myElm.onclick = MyNS.bind(conf.clicked, conf); $.proxy(func, context);

Slide 117

Slide 117 text

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

Slide 118

Slide 118 text

http://clericalwhispers.blogspot.it/2010/09/popes-anti-condom-message-is-sabotage.html sorry I should have said “NSFW” and, moreover...

Slide 119

Slide 119 text

http://clericalwhispers.blogspot.it/2010/09/popes-anti-condom-message-is-sabotage.html sorry I should have said “NSFW” and, moreover...

Slide 120

Slide 120 text

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"};

Slide 121

Slide 121 text

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"};

Slide 122

Slide 122 text

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"};

Slide 123

Slide 123 text

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"};

Slide 124

Slide 124 text

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"};

Slide 125

Slide 125 text

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"};

Slide 126

Slide 126 text

_.extend(default, config); Ext.apply(default, config); $.extend(default, config); Object.extend(default, config);

Slide 127

Slide 127 text

_.extend(default, config); Ext.apply(default, config); $.extend(default, config); Object.extend(default, config);

Slide 128

Slide 128 text

_.extend(default, config); Ext.apply(default, config); $.extend(default, config); Object.extend(default, config);

Slide 129

Slide 129 text

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);

Slide 130

Slide 130 text

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);

Slide 131

Slide 131 text

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);

Slide 132

Slide 132 text

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);

Slide 133

Slide 133 text

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);

Slide 134

Slide 134 text

Wasn’t it bad to delegate? http://clericalwhispers.blogspot.it/2010/09/popes-anti-condom-message-is-sabotage.html

Slide 135

Slide 135 text

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);

Slide 136

Slide 136 text

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);

Slide 137

Slide 137 text

Deeply into it

Slide 138

Slide 138 text

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");

Slide 139

Slide 139 text

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");

Slide 140

Slide 140 text

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");

Slide 141

Slide 141 text

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");

Slide 142

Slide 142 text

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");

Slide 143

Slide 143 text

MyNS.Layer = function(content, config){ config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config); } MyNS.Layer("Sorry, an error occured");

Slide 144

Slide 144 text

MyNS.Layer = function(content, config){ config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config); } MyNS.Layer("Sorry, an error occured");

Slide 145

Slide 145 text

MyNS.Layer = function(content, config){ config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config); } MyNS.Layer("Sorry, an error occured");

Slide 146

Slide 146 text

MyNS.Layer = function(content, config){ config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config); } MyNS.Layer("Sorry, an error occured");

Slide 147

Slide 147 text

MyNS.Layer = function(content, config){ config = MyNS.extend({ opacity: true, modal: true, }, config); new FancyBox(content, config); } MyNS.Layer("Sorry, an error occured");

Slide 148

Slide 148 text

Event Driven Design

Slide 149

Slide 149 text

MyNS.Layer = function(content, config){ [...] } MyNS.Layer("Sorry, an error occured");

Slide 150

Slide 150 text

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

Slide 151

Slide 151 text

MyNS.notify("error", { msg: "Sorry, an error occured" });

Slide 152

Slide 152 text

MyNS.notify("error", { msg: "Sorry, an error occured" }); MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); });

Slide 153

Slide 153 text

MyNS.notify("error", { msg: "Sorry, an error occured" }); MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); });

Slide 154

Slide 154 text

MyNS.notify("error", { msg: "Sorry, an error occured" }); MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); });

Slide 155

Slide 155 text

MyNS.notify("error", { msg: "Sorry, an error occured" }); MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); });

Slide 156

Slide 156 text

MyNS.notify("error", { msg: "Sorry, an error occured" }); MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); });

Slide 157

Slide 157 text

MyNS.notify("error", { msg: "Sorry, an error occured" }); MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); });

Slide 158

Slide 158 text

MyNS.notify("error", { msg: "Sorry, an error occured" }); MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); });

Slide 159

Slide 159 text

MyNS.notify("error", { msg: "Sorry, an error occured" }); MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); });

Slide 160

Slide 160 text

MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); }); Advantages

Slide 161

Slide 161 text

MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); }); Advantages Semantic

Slide 162

Slide 162 text

MyNS.listen("error", function(payload){ MyNS.Layer(payload.msg); }); Advantages Semantic More Flexible

Slide 163

Slide 163 text

Advantages Unpluggable

Slide 164

Slide 164 text

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

Slide 165

Slide 165 text

What about ... ?

Slide 166

Slide 166 text

a real world example

Slide 167

Slide 167 text

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

Slide 168

Slide 168 text

From The Front

Slide 169

Slide 169 text

Not only the conference

Slide 170

Slide 170 text

basically a lot of stuff

Slide 171

Slide 171 text

basically a lot of stuff @sid05 @verlok @aureliari @lucasalvini

Slide 172

Slide 172 text

cross site menu

Slide 173

Slide 173 text

Goals modify a single file to update menu do not depend on website implementation do not interfere with website implementation

Slide 174

Slide 174 text

AJAX: MicroAjax 0.4kB

Slide 175

Slide 175 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB

Slide 176

Slide 176 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB DOMEvents: Vine 0.8kB

Slide 177

Slide 177 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB DOMEvents: Vine 0.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; } }); });

Slide 178

Slide 178 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB DOMEvents: Vine 0.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; } }); });

Slide 179

Slide 179 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB DOMEvents: Vine 0.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; } }); });

Slide 180

Slide 180 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB DOMEvents: Vine 0.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; } }); });

Slide 181

Slide 181 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB DOMEvents: Vine 0.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; } }); });

Slide 182

Slide 182 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB DOMEvents: Vine 0.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; } }); });

Slide 183

Slide 183 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB DOMEvents: Vine 0.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; } }); });

Slide 184

Slide 184 text

AJAX: MicroAjax 0.4kB DOM: TinyDOM 0.4kB DOMEvents: Vine 0.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

Slide 185

Slide 185 text

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; } }); });

Slide 186

Slide 186 text

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; } }); });

Slide 187

Slide 187 text

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; } }); });

Slide 188

Slide 188 text

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; } }); });

Slide 189

Slide 189 text

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

Slide 190

Slide 190 text

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

Slide 191

Slide 191 text

LOVE FACT #3 2 out of 5 people marry their first love.

Slide 192

Slide 192 text

You may want a silver bullet http://www.splattlog.com/2009/02/28/the-wolf-man-ecco-la-trasformazione-di-benicio-del-toro/

Slide 193

Slide 193 text

Do you really need it?

Slide 194

Slide 194 text

Work to decouple your FOUNDATION CODE

Slide 195

Slide 195 text

Work to decouple your FOUNDATION CODE AND TEST IT!

Slide 196

Slide 196 text

Let your UI rely on a framework http://loveallit.tumblr.com/post/1044567068/jegushi-please-dont-leave-me

Slide 197

Slide 197 text

Advantages of this approach

Slide 198

Slide 198 text

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

Slide 199

Slide 199 text

Build own architecture http://www.alegriphotos.com/Cards_castle-lphoto-ce5fe99d397c7bf789b6b43d64bf5683.html

Slide 200

Slide 200 text

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

Slide 201

Slide 201 text

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

Slide 202

Slide 202 text

the whole point is

Slide 203

Slide 203 text

BE A JAVASCRIPT PERVERT

Slide 204

Slide 204 text

BE A JAVASCRIPT PERVERT

Slide 205

Slide 205 text

play with javascript BE A JAVASCRIPT PERVERT

Slide 206

Slide 206 text

play with javascript discover your own project needs BE A JAVASCRIPT PERVERT

Slide 207

Slide 207 text

play with javascript discover your own project needs BE A JAVASCRIPT PERVERT

Slide 208

Slide 208 text

play with javascript discover your own project needs BE A JAVASCRIPT PERVERT let github be your playground

Slide 209

Slide 209 text

play with javascript discover your own project needs BE A JAVASCRIPT PERVERT let github be your playground javascript is fun

Slide 210

Slide 210 text

play with javascript discover your own project needs BE A JAVASCRIPT PERVERT let github be your playground javascript is fun javascript is lovable

Slide 211

Slide 211 text

play with javascript discover your own project needs BE A JAVASCRIPT PERVERT let github be your playground javascript is fun javascript is lovable but you also need to...

Slide 212

Slide 212 text

know when to stop

Slide 213

Slide 213 text

[email protected] http://cedmax.com @cedmax http://bit.ly/jsbanana your framework —