SlideShare a Scribd company logo
1 of 190
Download to read offline
Javascript As A
Programming Language
IS
       Javascript As A
   Programming Language
Versioning, Test Driven Development & Continuous Integration
IS
       Javascript As A
   Programming Language
Versioning, Test Driven Development & Continuous Integration
Hello, who’s speaking?
Hello, who’s speaking?

           Marco Cedaro
             @cedmax
Hello, who’s speaking?

           Marco Cedaro
             @cedmax

           They said I am a...
            Frontend Cowboy
                         Nicola Vitto Jr.
            Javascript Pervert
                        Roberto Felter
            Perfect Stranger
                   basically anyone else
Hello, who’s speaking?

           Marco Cedaro
             @cedmax

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

           Marco Cedaro
             @cedmax

           Actually I am:
            a Frontend Developer at
            Spreaker.com
            a conference organizer
            with From The Front
Hello, who’s speaking?

           Marco Cedaro
             @cedmax

           Actually I am:
            a Frontend Developer at
            Spreaker.com
            a conference organizer
            with From The Front
            and a javascript pervert
Bologna, Italy
something in common with
     Robert Nyman
something in common with
     Robert Nyman
I believe I can fly
I believe I can fly
I believe I can fly


 Be brave. Take risks.
Nothing can substitute
     experience.
                   Paulo Coelho
once upon a time
once upon a time


we had no control
once upon a time


we had no control
 javascript was the land of the brave
once upon a time


we had no control
 javascript was the land of the brave
  we were fearless and unconscious
once upon a time


we had no control
 javascript was the land of the brave
  we were fearless and unconscious
    we were proud of being like that
just like them
kitty hawk
but life goes on
once upon a time


web engineer
   had a very bad
opinion of us
but it wasn't fair
but it wasn't fair


we didn't have IDEs & tools they did
but it wasn't fair


we didn't have IDEs & tools they did
 actually it was our own fault
but it wasn't fair


we didn't have IDEs & tools they did
 actually it was our own fault
   we were not ready
but it wasn't fair


we didn't have IDEs & tools they did
 actually it was our own fault
   we were not ready
     and javascript was neither
but, again, life goes on...
...and on...
and on..
it's not about the language itself
GREAT POWERS...
Frontend developers
have to claim their role
in development roadmap and
      business strategy
Javascript is a serious business
how serious?
less bandwidth and
  server load loading
resources and content
     when needed




      something we can achieve
less bandwidth and
                         performance boosts
  server load loading
                        that can lead to better
resources and content
                           conversion rates
     when needed




      something we can achieve
less bandwidth and
                         performance boosts        cross platform
  server load loading
                        that can lead to better   development: less
resources and content
                           conversion rates       maintenance costs
     when needed




      something we can achieve
less bandwidth and
                         performance boosts        cross platform
  server load loading
                        that can lead to better   development: less
resources and content
                           conversion rates       maintenance costs
     when needed




                           money
how serious?
this serious
what's missing?
what's missing?
what's missing?


If I had nine of my fingers
missing I wouldn't type any
           slower.
                     Mitch Hedberg
IDEs & Tools
the attitude
a strategy
The designer
 introduces a slider on
      some websites:
”it’s cool on apple store”.
The developer gets a jQuery
       plugin online




               the small web agency
The designer
 introduces a slider on         Major release of the
      some websites:            most used browser.
”it’s cool on apple store”.        A small fix has been
                              released, they have to change
The developer gets a jQuery   5 files in 5 different projects.
       plugin online




               the small web agency
The designer                                             Oh damn! There’s no
 introduces a slider on         Major release of the
                                                                   mouse wheel
      some websites:            most used browser.
                                                                    integration!
”it’s cool on apple store”.        A small fix has been
                              released, they have to change     should they ask for support
The developer gets a jQuery   5 files in 5 different projects.    or should they change the
       plugin online                                                library by themself?




               the small web agency
am I the only one or there’s
     something wrong?
The client-side
architecture has been
  built on the most
known and supported
      framework

        2006




                        the big corp
The client-side       Everything seems to be
architecture has been     fine, except that the
  built on the most      well known framework
known and supported      was being replaced by a
      framework            powerful new one

        2006                   2008 - 2010




                        the big corp
The client-side       Everything seems to be     They were forced to
architecture has been     fine, except that the       change the whole
  built on the most      well known framework       codebase at once to
known and supported      was being replaced by a    reduce maintenance
      framework            powerful new one        and development costs

        2006                   2008 - 2010                 2011




                        the big corp
here we are again
attitude, strategy...
...and foresight
WARNING!
continuous integration
continuous integration
continuous integration

    A software development
 practice where members of a
   team integrate their work
    frequently [...] to detect
  integration errors as quickly
           as possible.
                         Martin Fowler
I Build So Consistently
I Build So Consistently



identify
I Build So Consistently
                   write a build
                           script



identify
I Build So Consistently
                   write a build
                           script



identify




           share
I Build So Consistently
                   write a build
                           script



identify




                         make it
           share    continuous
How can we take
  advantages from a
continuous integration
       process?
rationalize your workflow
deploy stable versions
Separate the codebase
unit test your code
basically
basically
basically




      ie7
choose your tools
choose your tools
choose your tools


A man cannot be too careful
in the choice of his enemies
                      Oscar Wilde
JS HI NT
a code quality tool
a code quality tool


like Douglas Crockford's JSLint
a code quality tool


like Douglas Crockford's JSLint
 but
a code quality tool


like Douglas Crockford's JSLint
 but
   customizable
a tool for stupid?
S HI NT
J
R IV ER
     ST D
   TE T
JS H IN
  JS
once upon a time
jsTestDriver
jsTestDriver

works from console
jsTestDriver

works from console
 runs a server
jsTestDriver

works from console
 runs a server
   opens browsers
jsTestDriver

works from console
 runs a server
   opens browsers
    runs test suites
jsTestDriver

works from console
 runs a server
   opens browsers
    runs test suites
      retrieves results in console
build server
build server
build server
how does testing works?
have you seen Lost?
how does it work?
write a test




           how does it work?
write a test   let it fail




           how does it work?
write a test   let it fail   write the code




           how does it work?
write a test     let it fail   write the code

         run the test
         again




           how does it work?
write a test     let it fail              write the code

         run the test          refactor
         again




           how does it work?
the environment
It's the browser, baby
It's the browser, baby
Unit testing is
  supposed to test a
single atomic “unit” of
 functionality without
   dependencies on
     anything else



             The curious case of
            Javascript unit testing
Unit testing is
                          This is where you start
  supposed to test a
                            to run into serious
single atomic “unit” of
                           dependency problems
 functionality without
                          due to the interrelation
   dependencies on
                            with HTML and CSS
     anything else



             The curious case of
            Javascript unit testing
Unit testing is                                   What do you test?
                          This is where you start
  supposed to test a                                 Usually how the user
                            to run into serious
single atomic “unit” of                              interface responds to
                           dependency problems
 functionality without                                     user input.
                          due to the interrelation
   dependencies on                                   Actually, the realm of
                            with HTML and CSS
     anything else                                     functional testing



             The curious case of
            Javascript unit testing
keep it real
keep it real
keep it real


To all my homies working
       on the 9 to 5
                       Shaggy
#140bytes
I used to work with these guys
_$ = (function() {
  var registered = {};
  return {
! ! pub: function(event, memo) {
! ! ! if (registered[event] instanceof Array){
! ! ! ! var handlers = [].concat(registered[event]);
! ! ! ! for (var i=0, h; (h = handlers[i]); i++){
! ! ! ! ! h.call(this, memo);
! ! ! ! }
! ! ! }
! ! },
! ! sub: function(event, handler) {
! ! ! if (typeof registered[event] === "undefined"){
! ! ! ! registered[event] = [];
! ! ! }
! ! ! registered[event].push(handler);
! ! }
  };
})();
_$ = (function() {
  var registered = {};
  return {
! ! pub: function(event, memo) {
! ! ! if (registered[event] instanceof Array){
! ! ! ! var handlers = [].concat(registered[event]);
! ! ! ! for (var i=0, h; (h = handlers[i]); i++){
! ! ! ! ! h.call(this, memo);
! ! ! ! }
! ! ! }
! ! },
! ! sub: function(event, handler) {
! ! ! if (typeof registered[event] === "undefined"){
! ! ! ! registered[event] = [];
! ! ! }
! ! ! registered[event].push(handler);
! ! }
  };
})();
_$.sub("customEvent", function(obj) {
! //DO STUFF
});

_$.pub("customEvent");
_$.pub("customEvent", { prop : "value" });
_$.sub("customEvent", function(obj) {
! //DO STUFF
});

_$.pub("customEvent");
_$.pub("customEvent", { prop : "value" });
_$.sub("customEvent", function(obj) {
! //DO STUFF
});

_$.pub("customEvent");
_$.pub("customEvent", { prop : "value" });
_$ = (function() {
  var registered = {};
  return {
! ! pub: function(event, memo) {
! ! ! if (registered[event] instanceof Array){
! ! ! ! var handlers = [].concat(registered[event]);
! ! ! ! for (var i=0, h; (h = handlers[i]); i++){
! ! ! ! ! h.call(this, memo);
! ! ! ! }
! ! ! }
! ! },
! ! sub: function(event, handler) {
! ! ! if (typeof registered[event] === "undefined"){
! ! ! ! registered[event] = [];
! ! ! }
! ! ! registered[event].push(handler);
! ! }
  };
})();
_$ = (function (_) {
! return {
! ! pub: function(a, b, c, d) {
! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b)
! ! },
! ! sub: function(a, b) {
! ! ! (_[a] || (_[a] = [])).push(b)
! ! }
! }
})({})
_$ = (function (_) {
! return {
! ! pub: function(a, b, c, d) {
! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b)
! ! },
! ! sub: function(a, b) {
! ! ! (_[a] || (_[a] = [])).push(b)
! ! }

                                             tes
! }
})({})
                                     #140 by
_$ = (function() {
  var registered = {};
  return {
! ! pub: function(event, memo) {
! ! ! if (registered[event] instanceof Array){
! ! ! ! var handlers = [].concat(registered[event]);
! ! ! ! for (var i=0, h; (h = handlers[i]); i++){
! ! ! ! ! h.call(this, memo);
! ! ! ! }
! ! ! }
! ! },
! ! sub: function(event, handler) {
! ! ! if (typeof registered[event] === "undefined"){
! ! ! ! registered[event] = [];
! ! ! }
! ! ! registered[event].push(handler);
! ! }
  };
})();
_$ = (function (_) {
! return {
! ! pub: function(a, b, c, d) {
! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b)
! ! },
! ! sub: function(a, b) {
! ! ! (_[a] || (_[a] = [])).push(b)
! ! }

                                             tes
! }
})({})
                                     #140 by
_$ = (function() {
  var registered = {};
  return {
! ! pub: function(event, memo) {
! ! ! if (registered[event] instanceof Array){
! ! ! ! var handlers = [].concat(registered[event]);
! ! ! ! for (var i=0, h; (h = handlers[i]); i++){
! ! ! ! ! h.call(this, memo);
! ! ! ! }
! ! ! }
! ! },
! ! sub: function(event, handler) {
! ! ! if (typeof registered[event] === "undefined"){
! ! ! ! registered[event] = [];
! ! ! }
! ! ! registered[event].push(handler);
! ! }
  };
})();
_$ = (function (_) {
! return {
! ! pub: function(a, b, c, d) {
! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b)
! ! },
! ! sub: function(a, b) {
! ! ! (_[a] || (_[a] = [])).push(b)
! ! }

                                             tes
! }
})({})
                                     #140 by
_$ = (function (_) {
! return {
! ! pub: function(a, b, c, d) {
! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b)
! ! },
! ! sub: function(a, b) {
! ! ! (_[a] || (_[a] = [])).push(b)
! ! }

                                             tes
! }
})({})
                                     #140 by
[...]
  testPub: function(){! !
! ! var a = 0;!
! ! _$.sub('testNotify', function(){ a = 1; });
! ! _$.pub('testNotify');

!   ! assertEquals(1, a);
!   },
!   ! !
!   testNotifyWithMemo: function(){!!
!   ! var a = 0 ;!
!   ! _$.sub('testNotify', function(memo){
!   ! ! ! a = memo.test;
!   ! });
!   ! _$.pub('testNotify', {test: 1});

! ! assertEquals(1, a);
! },
[...]
[...]
  testPub: function(){! !
! ! var a = 0;!
! ! _$.sub('testNotify', function(){ a = 1; });
! ! _$.pub('testNotify');

!   ! assertEquals(1, a);
!   },
!   ! !
!   testNotifyWithMemo: function(){!!
!   ! var a = 0 ;!
!   ! _$.sub('testNotify', function(memo){
!   ! ! ! a = memo.test;
!   ! });
!   ! _$.pub('testNotify', {test: 1});

! ! assertEquals(1, a);
! },
[...]
[...]
  testPub: function(){! !
! ! var a = 0;!
! ! _$.sub('testNotify', function(){ a = 1; });
! ! _$.pub('testNotify');

!   ! assertEquals(1, a);
!   },
!   ! !
!   testNotifyWithMemo: function(){!!
!   ! var a = 0 ;!
!   ! _$.sub('testNotify', function(memo){
!   ! ! ! a = memo.test;
!   ! });
!   ! _$.pub('testNotify', {test: 1});

! ! assertEquals(1, a);
! },
[...]
[...]
  testPub: function(){! !
! ! var a = 0;!
! ! _$.sub('testNotify', function(){ a = 1; });
! ! _$.pub('testNotify');

!   ! assertEquals(1, a);
!   },
!   ! !
!   testNotifyWithMemo: function(){!!
!   ! var a = 0 ;!
!   ! _$.sub('testNotify', function(memo){
!   ! ! ! a = memo.test;
!   ! });
!   ! _$.pub('testNotify', {test: 1});

! ! assertEquals(1, a);
! },
[...]
[...]
  testPub: function(){! !
! ! var a = 0;!
! ! _$.sub('testNotify', function(){ a = 1; });
! ! _$.pub('testNotify');

!   ! assertEquals(1, a);
!   },
!   ! !
!   testNotifyWithMemo: function(){!!
!   ! var a = 0 ;!
!   ! _$.sub('testNotify', function(memo){
!   ! ! ! a = memo.test;
!   ! });
!   ! _$.pub('testNotify', {test: 1});

! ! assertEquals(1, a);
! },
[...]
[...]
  testPub: function(){! !
! ! var a = 0;!
! ! _$.sub('testNotify', function(){ a = 1; });
! ! _$.pub('testNotify');

!   ! assertEquals(1, a);
!   },
!   ! !
!   testNotifyWithMemo: function(){!!
!   ! var a = 0 ;
!   ! _$.sub('testNotify', function(memo){
!   ! ! ! a = memo.test;
!   ! });
!   ! _$.pub('testNotify', {test: 1});

! ! assertEquals(1, a);
! },
[...]
[...]
  testPub: function(){! !
! ! var a = 0;!
! ! _$.sub('testNotify', function(){ a = 1; });
! ! _$.pub('testNotify');

!   ! assertEquals(1, a);
!   },
!   ! !
!   testNotifyWithMemo: function(){!!
!   ! var a = 0 ;!
!   ! _$.sub('testNotify', function(memo){
!   ! ! ! a = memo.test;
!   ! });
!   ! _$.pub('testNotify', {test: 1});

! ! assertEquals(1, a);
! },
[...]
easy, uh?
you will, eventually
R IV ER
     ST D
   TE T
JS H IN
  JS
.JS R
      ON I VE
  S IN D R
      ST
   TE T
JS H IN
  JS
a mock library
SPIES
a function that records
    arguments, return
value, the value of this
and exception thrown
 (if any) for all its calls.




                         a mock library
SPIES                      STUBS
a function that records        functions (spies) with
    arguments, return            pre-programmed
value, the value of this             behavior.
and exception thrown
 (if any) for all its calls.




                         a mock library
SPIES                      STUBS                     MOCKS
a function that records        functions (spies) with    functions (spies) with
    arguments, return            pre-programmed            pre-programmed
value, the value of this             behavior.          behavior (stubs) as well
and exception thrown                                      as pre-programmed
 (if any) for all its calls.                                 expectations.




                         a mock library
[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SysyemOn'));
! },
! ! !
! testMyLibLoggedNotLogged: function(){!!
! ! var stub = sinon.stub(User, 'isLogged');!
! ! stub.returns(true);
! ! //DO STUFF && ASSERTIONS

! ! stub.returns(false);
! ! //DO STUFF && ASSERTIONS

! },
[...]
SPY
[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SystemOn'));
! },
! ! !
! testMyLibLoggedNotLogged: function(){!!
! ! var stub = sinon.stub(User, 'isLogged');!
! ! stub.returns(true);
! ! //DO STUFF && ASSERTIONS

! ! stub.returns(false);
! ! //DO STUFF && ASSERTIONS

! },
[...]
SPY
[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SystemOn'));
! },
! ! !
! testMyLibLoggedNotLogged: function(){!!
! ! var stub = sinon.stub(User, 'isLogged');!
! ! stub.returns(true);
! ! //DO STUFF && ASSERTIONS

! ! stub.returns(false);
! ! //DO STUFF && ASSERTIONS

! },
[...]
SPY
[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SystemOn'));
! },
! ! !
! testMyLibLoggedNotLogged: function(){!!
! ! var stub = sinon.stub(User, 'isLogged');!
! ! stub.returns(true);
! ! //DO STUFF && ASSERTIONS

! ! stub.returns(false);
! ! //DO STUFF && ASSERTIONS

! },
[...]
SPY
[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SystemOn'));
! },
! ! !
! testMyLibLoggedNotLogged: function(){!!
! ! var stub = sinon.stub(User, 'isLogged');!
! ! stub.returns(true);
! ! //DO STUFF && ASSERTIONS

! ! stub.returns(false);
! ! //DO STUFF && ASSERTIONS

! },
[...]
STUB
[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SystemOn'));
! },
! ! !
! testMyLibLoggedNotLogged: function(){!!
! ! var stub = sinon.stub(User, 'isLogged');!
! ! stub.returns(true);
! ! //DO STUFF && ASSERTIONS

! ! stub.returns(false);
! ! //DO STUFF && ASSERTIONS

! },
[...]
STUB
[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SystemOn'));
! },
! ! !
! testMyLibLoggedNotLogged: function(){!!
! ! var stub = sinon.stub(User, 'isLogged');!
! ! stub.returns(true);
! ! //DO STUFF && ASSERTIONS

! ! stub.returns(false);
! ! //DO STUFF && ASSERTIONS

! },
[...]
STUB
[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SystemOn'));
! },
! ! !
! testMyLibLoggedNotLogged: function(){!!
! ! var stub = sinon.stub(User, 'isLogged');!
! ! stub.returns(true);
! ! //DO STUFF && ASSERTIONS

! ! stub.returns(false);
! ! //DO STUFF && ASSERTIONS

! },
[...]
STUB
[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SystemOn'));
! },
! ! !
! testMyLibLoggedNotLogged: function(){!!
! ! var stub = sinon.stub(User, 'isLogged');!
! ! stub.returns(true);
! ! //DO STUFF && ASSERTIONS

! ! stub.returns(false);
! ! //DO STUFF && ASSERTIONS

! },
[...]
MOCK

[...]
  testMyLibRegistersToSystemOnEvent: function(){! !
! ! var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! assertTrue(spy.calledWith('SystemOn'));
! },
[...]
MOCK

[...]
  //testMyLibRegistersToSystemOnEvent: function(){! !
! ! //var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! //assertTrue(spy.calledWith('SysyemOn'));
! //},
!
! testMyLibRegistersToSystemOnEvent: function(){! !
! ! var mock = sinon.mock(_$);
! ! mock.expect('watch').calledWith('SysyemOn');
! ! //DO STUFF TO INIT YOUR LIB
! ! mock.verify();
! },
[...]
MOCK

[...]
  //testMyLibRegistersToSystemOnEvent: function(){! !
! ! //var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! //assertTrue(spy.calledWith('SysyemOn'));
! //},
!
! testMyLibRegistersToSystemOnEvent: function(){! !
! ! var mock = sinon.mock(_$);
! ! mock.expect('watch').calledWith('SysyemOn');
! ! //DO STUFF TO INIT YOUR LIB
! ! mock.verify();
! },
[...]
MOCK

[...]
  //testMyLibRegistersToSystemOnEvent: function(){! !
! ! //var spy = sinon.spy(_$, 'watch');!
! ! //DO STUFF TO INIT YOUR LIB
! ! //assertTrue(spy.calledWith('SysyemOn'));
! //},
!
! testMyLibRegistersToSystemOnEvent: function(){! !
! ! var mock = sinon.mock(_$);
! ! mock.expect('watch').calledWith('SysyemOn');
! ! //DO STUFF TO INIT YOUR LIB
! ! mock.verify();
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

   server.respondWith("GET", "/art/12/comments.json",
          [200, {"Content-Type":"application/json"},
          "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
AJAX CALL
[...]
  testOnSuccessCallback: function(){! !
    var server = sinon.useFakeServer();

    server.respondWith("GET", "/art/12/comments.json",
           [200, {"Content-Type":"application/json"},
           "[{ id:12, text:'Hello'}]"]);

! ! var spy = sinon.spy();
! ! myLib.getCommentsFor("/art/12", spy);

! ! server.respond();

! ! assert(spy.calledWith([{ id:12, text:"Hello"}]));
! },
[...]
.JS R
      ON I VE
  S IN D R
      ST
   TE T
JS H IN
  JS
E SS OR
          PR
       OM S
Y U I C .J
   S   ON I VE R
     IN D R
       ST
    TE T
JS H IN
   JS
Everyone should be happy
in the wild
in the wild
IN THE WILD


In the wild, there is
   no health care.
              Dwight Schrute (the office)
drawbacks



at the beginning
cost of change
LOOKING FORWARD
LOOKING FORWARD
LOOKING FORWARD
LOOKING FORWARD
LOOKING FORWARD
LOOKING FORWARD



    the further we look at,
  the more control we need
LOOKING FORWARD

    the further we look at,
  the more control we need
LOOKING FORWARD

    the further we look at,
  the more control we need
         let's get ready
LOOKING FORWARD

       the further we look at,
     the more control we need
             let's get ready

javascript is a programming language
LOOKING FORWARD

        the further we look at,
      the more control we need
              let's get ready

 javascript is a programming language
javascript is a serious business.
LOOKING FORWARD

        the further we look at,
      the more control we need
              let's get ready

 javascript is a programming language
javascript is a serious business.
             and, most of all...
javascript kicks asses
javascript kicks asses


           any question?
                http://spkr8.com/t/8718
                http://cedmax.com
                @cedmax

More Related Content

What's hot

JavaScript in Object-Oriented Way
JavaScript in Object-Oriented WayJavaScript in Object-Oriented Way
JavaScript in Object-Oriented WayChamnap Chhorn
 
Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014Jaroslaw Palka
 
JavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptJavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptLaurence Svekis ✔
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptForziatech
 
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)raja kvk
 
Unobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQueryUnobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQuerySimon Willison
 
Javascript and Jquery Best practices
Javascript and Jquery Best practicesJavascript and Jquery Best practices
Javascript and Jquery Best practicesSultan Khan
 
How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsRan Mizrahi
 
Introduction to Javascript programming
Introduction to Javascript programmingIntroduction to Javascript programming
Introduction to Javascript programmingFulvio Corno
 
JavaScript Best Pratices
JavaScript Best PraticesJavaScript Best Pratices
JavaScript Best PraticesChengHui Weng
 

What's hot (20)

JavaScript in Object-Oriented Way
JavaScript in Object-Oriented WayJavaScript in Object-Oriented Way
JavaScript in Object-Oriented Way
 
Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScriptJavaScript guide 2020 Learn JavaScript
JavaScript guide 2020 Learn JavaScript
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScript
 
Javascript by geetanjali
Javascript by geetanjaliJavascript by geetanjali
Javascript by geetanjali
 
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
Advanced Object Oriented JavaScript (prototype, closure, scope, design patterns)
 
Javascript tutorial
Javascript tutorialJavascript tutorial
Javascript tutorial
 
Javascript
JavascriptJavascript
Javascript
 
Unobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQueryUnobtrusive JavaScript with jQuery
Unobtrusive JavaScript with jQuery
 
Object Oriented Javascript
Object Oriented JavascriptObject Oriented Javascript
Object Oriented Javascript
 
Javascript and Jquery Best practices
Javascript and Jquery Best practicesJavascript and Jquery Best practices
Javascript and Jquery Best practices
 
Java script
Java scriptJava script
Java script
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design Patterns
 
Introduction to Javascript programming
Introduction to Javascript programmingIntroduction to Javascript programming
Introduction to Javascript programming
 
Introduction to JavaScript Programming
Introduction to JavaScript ProgrammingIntroduction to JavaScript Programming
Introduction to JavaScript Programming
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
JavaScript Best Pratices
JavaScript Best PraticesJavaScript Best Pratices
JavaScript Best Pratices
 

Viewers also liked

The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Languageguestceb98b
 
Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScriptT11 Sessions
 
Javascript Tutorial
Javascript TutorialJavascript Tutorial
Javascript TutorialKang-min Liu
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript ProgrammingSehwan Noh
 
Fabrication and Performance Analysis of Downdraft Biomass Gasifier Using Suga...
Fabrication and Performance Analysis of Downdraft Biomass Gasifier Using Suga...Fabrication and Performance Analysis of Downdraft Biomass Gasifier Using Suga...
Fabrication and Performance Analysis of Downdraft Biomass Gasifier Using Suga...IJSRD
 
The JavaScript Programming Primer
The JavaScript  Programming PrimerThe JavaScript  Programming Primer
The JavaScript Programming PrimerMike Wilcox
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming LanguageRaghavan Mohan
 
Reactive Programming with JavaScript
Reactive Programming with JavaScriptReactive Programming with JavaScript
Reactive Programming with JavaScriptCodemotion
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScriptTroy Miles
 
Biomass gasifier pune
Biomass gasifier  puneBiomass gasifier  pune
Biomass gasifier puneroad2ideas
 
Downdraft biomass gasification: experimental investigation and aspen plus sim...
Downdraft biomass gasification: experimental investigation and aspen plus sim...Downdraft biomass gasification: experimental investigation and aspen plus sim...
Downdraft biomass gasification: experimental investigation and aspen plus sim...Antonio Geraldo de Paula Oliveira
 
Biomass Gasification presentation
Biomass Gasification presentationBiomass Gasification presentation
Biomass Gasification presentationPritish Shardul
 
Biomass heat and power - gasification CHP with universal biomass gasifier
Biomass heat and power - gasification CHP with universal biomass gasifierBiomass heat and power - gasification CHP with universal biomass gasifier
Biomass heat and power - gasification CHP with universal biomass gasifierRado Irgl
 
DIWE - Programming with JavaScript
DIWE - Programming with JavaScriptDIWE - Programming with JavaScript
DIWE - Programming with JavaScriptRasan Samarasinghe
 
Introducing Web 2.0 concepts
Introducing Web 2.0 conceptsIntroducing Web 2.0 concepts
Introducing Web 2.0 conceptsJohn Lewis
 

Viewers also liked (20)

The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
 
Introduction to web programming with JavaScript
Introduction to web programming with JavaScriptIntroduction to web programming with JavaScript
Introduction to web programming with JavaScript
 
Javascript Tutorial
Javascript TutorialJavascript Tutorial
Javascript Tutorial
 
JavaScript Programming
JavaScript ProgrammingJavaScript Programming
JavaScript Programming
 
Fabrication and Performance Analysis of Downdraft Biomass Gasifier Using Suga...
Fabrication and Performance Analysis of Downdraft Biomass Gasifier Using Suga...Fabrication and Performance Analysis of Downdraft Biomass Gasifier Using Suga...
Fabrication and Performance Analysis of Downdraft Biomass Gasifier Using Suga...
 
The JavaScript Programming Primer
The JavaScript  Programming PrimerThe JavaScript  Programming Primer
The JavaScript Programming Primer
 
The JavaScript Programming Language
The JavaScript Programming LanguageThe JavaScript Programming Language
The JavaScript Programming Language
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
 
Reactive Programming with JavaScript
Reactive Programming with JavaScriptReactive Programming with JavaScript
Reactive Programming with JavaScript
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
 
Biomass gasifier pune
Biomass gasifier  puneBiomass gasifier  pune
Biomass gasifier pune
 
Downdraft biomass gasification: experimental investigation and aspen plus sim...
Downdraft biomass gasification: experimental investigation and aspen plus sim...Downdraft biomass gasification: experimental investigation and aspen plus sim...
Downdraft biomass gasification: experimental investigation and aspen plus sim...
 
Biomass Gasification presentation
Biomass Gasification presentationBiomass Gasification presentation
Biomass Gasification presentation
 
Bio Mass Gasifier
Bio Mass GasifierBio Mass Gasifier
Bio Mass Gasifier
 
Biomass Gasification
Biomass GasificationBiomass Gasification
Biomass Gasification
 
Biomass heat and power - gasification CHP with universal biomass gasifier
Biomass heat and power - gasification CHP with universal biomass gasifierBiomass heat and power - gasification CHP with universal biomass gasifier
Biomass heat and power - gasification CHP with universal biomass gasifier
 
biomass gasification
biomass gasificationbiomass gasification
biomass gasification
 
Biomass gassifier
Biomass gassifierBiomass gassifier
Biomass gassifier
 
DIWE - Programming with JavaScript
DIWE - Programming with JavaScriptDIWE - Programming with JavaScript
DIWE - Programming with JavaScript
 
Introducing Web 2.0 concepts
Introducing Web 2.0 conceptsIntroducing Web 2.0 concepts
Introducing Web 2.0 concepts
 

Similar to Paris Web - Javascript as a programming language

YOOX Launch & Learn - Javascript as a programming language
 YOOX Launch & Learn - Javascript as a programming language YOOX Launch & Learn - Javascript as a programming language
YOOX Launch & Learn - Javascript as a programming languageMarco Cedaro
 
10 practices that every developer needs to start right now
10 practices that every developer needs to start right now10 practices that every developer needs to start right now
10 practices that every developer needs to start right nowCaleb Jenkins
 
Wds leanengineering-141103233017-conversion-gate02
Wds leanengineering-141103233017-conversion-gate02Wds leanengineering-141103233017-conversion-gate02
Wds leanengineering-141103233017-conversion-gate02Shivam Prajapati
 
jsDay - Javascript as a programming language
jsDay - Javascript as a programming languagejsDay - Javascript as a programming language
jsDay - Javascript as a programming languageMarco Cedaro
 
Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...Balanced Team
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteChristian Heilmann
 
David Nuescheler: Igniting CQ 5.3: What's New and Roadmap
David Nuescheler: Igniting CQ 5.3: What's New and RoadmapDavid Nuescheler: Igniting CQ 5.3: What's New and Roadmap
David Nuescheler: Igniting CQ 5.3: What's New and RoadmapDay Software
 
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...GreeceJS
 
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in ActionBill Scott
 
Lean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partnerLean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partnerBill Scott
 
Planning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teamsPlanning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teamsChristian Heilmann
 
Better and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and EnjoymentBetter and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and EnjoymentChris Holland
 
Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...
Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...
Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...Burr Sutter
 
8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
8 Principles for Enabling Build/Measure/Learn: Lean Engineering in ActionBill Scott
 
Consistent Development Environment with Vagrant and Chef
Consistent Development Environment with Vagrant and ChefConsistent Development Environment with Vagrant and Chef
Consistent Development Environment with Vagrant and ChefGerald Villorente
 
Agile Software Development for Non-Developers
Agile Software Development for Non-DevelopersAgile Software Development for Non-Developers
Agile Software Development for Non-Developershamvocke
 
Web Test Automation Framework - IndicThreads Conference
Web Test Automation Framework  - IndicThreads ConferenceWeb Test Automation Framework  - IndicThreads Conference
Web Test Automation Framework - IndicThreads ConferenceIndicThreads
 
React Native? A developer's perspective
React Native? A developer's perspectiveReact Native? A developer's perspective
React Native? A developer's perspectiveBorisConforty
 
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocksTop Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocksZeroTurnaround
 

Similar to Paris Web - Javascript as a programming language (20)

YOOX Launch & Learn - Javascript as a programming language
 YOOX Launch & Learn - Javascript as a programming language YOOX Launch & Learn - Javascript as a programming language
YOOX Launch & Learn - Javascript as a programming language
 
10 practices that every developer needs to start right now
10 practices that every developer needs to start right now10 practices that every developer needs to start right now
10 practices that every developer needs to start right now
 
Wds leanengineering-141103233017-conversion-gate02
Wds leanengineering-141103233017-conversion-gate02Wds leanengineering-141103233017-conversion-gate02
Wds leanengineering-141103233017-conversion-gate02
 
jsDay - Javascript as a programming language
jsDay - Javascript as a programming languagejsDay - Javascript as a programming language
jsDay - Javascript as a programming language
 
Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...Lean engineering for lean/balanced teams: lessons learned (and still learning...
Lean engineering for lean/balanced teams: lessons learned (and still learning...
 
Quo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynoteQuo vadis, JavaScript? Devday.pl keynote
Quo vadis, JavaScript? Devday.pl keynote
 
David Nuescheler: Igniting CQ 5.3: What's New and Roadmap
David Nuescheler: Igniting CQ 5.3: What's New and RoadmapDavid Nuescheler: Igniting CQ 5.3: What's New and Roadmap
David Nuescheler: Igniting CQ 5.3: What's New and Roadmap
 
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...
Cross platform engineering - Lessons Learned (Michael Asimakopoulos, Valadis ...
 
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
6 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
 
Enabling Lean at Enterprise Scale: Lean Engineering in Action
Enabling Lean at Enterprise Scale: Lean Engineering in ActionEnabling Lean at Enterprise Scale: Lean Engineering in Action
Enabling Lean at Enterprise Scale: Lean Engineering in Action
 
Lean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partnerLean Engineering: How to make Engineering a full Lean UX partner
Lean Engineering: How to make Engineering a full Lean UX partner
 
Planning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teamsPlanning JavaScript and Ajax for larger teams
Planning JavaScript and Ajax for larger teams
 
Better and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and EnjoymentBetter and Faster: A Journey Toward Clean Code and Enjoyment
Better and Faster: A Journey Toward Clean Code and Enjoyment
 
Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...
Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...
Teaching Elephants to Dance (and Fly!) A Developer's Journey to Digital Trans...
 
8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
8 Principles for Enabling Build/Measure/Learn: Lean Engineering in Action
 
Consistent Development Environment with Vagrant and Chef
Consistent Development Environment with Vagrant and ChefConsistent Development Environment with Vagrant and Chef
Consistent Development Environment with Vagrant and Chef
 
Agile Software Development for Non-Developers
Agile Software Development for Non-DevelopersAgile Software Development for Non-Developers
Agile Software Development for Non-Developers
 
Web Test Automation Framework - IndicThreads Conference
Web Test Automation Framework  - IndicThreads ConferenceWeb Test Automation Framework  - IndicThreads Conference
Web Test Automation Framework - IndicThreads Conference
 
React Native? A developer's perspective
React Native? A developer's perspectiveReact Native? A developer's perspective
React Native? A developer's perspective
 
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocksTop Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
Top Reasons Why Java Rocks (report preview) - http:0t.ee/java-rocks
 

Recently uploaded

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Paris Web - Javascript as a programming language

  • 2. IS Javascript As A Programming Language Versioning, Test Driven Development & Continuous Integration
  • 3. IS Javascript As A Programming Language Versioning, Test Driven Development & Continuous Integration
  • 5. Hello, who’s speaking? Marco Cedaro @cedmax
  • 6. Hello, who’s speaking? Marco Cedaro @cedmax They said I am a... Frontend Cowboy Nicola Vitto Jr. Javascript Pervert Roberto Felter Perfect Stranger basically anyone else
  • 7. Hello, who’s speaking? Marco Cedaro @cedmax Actually I am: a Frontend Developer at Spreaker.com
  • 8. Hello, who’s speaking? Marco Cedaro @cedmax Actually I am: a Frontend Developer at Spreaker.com a conference organizer with From The Front
  • 9. Hello, who’s speaking? Marco Cedaro @cedmax Actually I am: a Frontend Developer at Spreaker.com a conference organizer with From The Front and a javascript pervert
  • 11. something in common with Robert Nyman
  • 12. something in common with Robert Nyman
  • 13. I believe I can fly
  • 14. I believe I can fly
  • 15. I believe I can fly Be brave. Take risks. Nothing can substitute experience. Paulo Coelho
  • 16. once upon a time
  • 17. once upon a time we had no control
  • 18. once upon a time we had no control javascript was the land of the brave
  • 19. once upon a time we had no control javascript was the land of the brave we were fearless and unconscious
  • 20. once upon a time we had no control javascript was the land of the brave we were fearless and unconscious we were proud of being like that
  • 24. once upon a time web engineer had a very bad opinion of us
  • 26. but it wasn't fair we didn't have IDEs & tools they did
  • 27. but it wasn't fair we didn't have IDEs & tools they did actually it was our own fault
  • 28. but it wasn't fair we didn't have IDEs & tools they did actually it was our own fault we were not ready
  • 29. but it wasn't fair we didn't have IDEs & tools they did actually it was our own fault we were not ready and javascript was neither
  • 30. but, again, life goes on...
  • 33. it's not about the language itself
  • 35. Frontend developers have to claim their role in development roadmap and business strategy
  • 36. Javascript is a serious business
  • 38. less bandwidth and server load loading resources and content when needed something we can achieve
  • 39. less bandwidth and performance boosts server load loading that can lead to better resources and content conversion rates when needed something we can achieve
  • 40. less bandwidth and performance boosts cross platform server load loading that can lead to better development: less resources and content conversion rates maintenance costs when needed something we can achieve
  • 41. less bandwidth and performance boosts cross platform server load loading that can lead to better development: less resources and content conversion rates maintenance costs when needed money
  • 46. what's missing? If I had nine of my fingers missing I wouldn't type any slower. Mitch Hedberg
  • 50. The designer introduces a slider on some websites: ”it’s cool on apple store”. The developer gets a jQuery plugin online the small web agency
  • 51. The designer introduces a slider on Major release of the some websites: most used browser. ”it’s cool on apple store”. A small fix has been released, they have to change The developer gets a jQuery 5 files in 5 different projects. plugin online the small web agency
  • 52. The designer Oh damn! There’s no introduces a slider on Major release of the mouse wheel some websites: most used browser. integration! ”it’s cool on apple store”. A small fix has been released, they have to change should they ask for support The developer gets a jQuery 5 files in 5 different projects. or should they change the plugin online library by themself? the small web agency
  • 53. am I the only one or there’s something wrong?
  • 54. The client-side architecture has been built on the most known and supported framework 2006 the big corp
  • 55. The client-side Everything seems to be architecture has been fine, except that the built on the most well known framework known and supported was being replaced by a framework powerful new one 2006 2008 - 2010 the big corp
  • 56. The client-side Everything seems to be They were forced to architecture has been fine, except that the change the whole built on the most well known framework codebase at once to known and supported was being replaced by a reduce maintenance framework powerful new one and development costs 2006 2008 - 2010 2011 the big corp
  • 57. here we are again
  • 63. continuous integration A software development practice where members of a team integrate their work frequently [...] to detect integration errors as quickly as possible. Martin Fowler
  • 64. I Build So Consistently
  • 65. I Build So Consistently identify
  • 66. I Build So Consistently write a build script identify
  • 67. I Build So Consistently write a build script identify share
  • 68. I Build So Consistently write a build script identify make it share continuous
  • 69. How can we take advantages from a continuous integration process?
  • 76. basically ie7
  • 79. choose your tools A man cannot be too careful in the choice of his enemies Oscar Wilde
  • 80.
  • 83. a code quality tool like Douglas Crockford's JSLint
  • 84. a code quality tool like Douglas Crockford's JSLint but
  • 85. a code quality tool like Douglas Crockford's JSLint but customizable
  • 86. a tool for stupid?
  • 88. R IV ER ST D TE T JS H IN JS
  • 89. once upon a time
  • 93. jsTestDriver works from console runs a server opens browsers
  • 94. jsTestDriver works from console runs a server opens browsers runs test suites
  • 95. jsTestDriver works from console runs a server opens browsers runs test suites retrieves results in console
  • 100. have you seen Lost?
  • 101. how does it work?
  • 102. write a test how does it work?
  • 103. write a test let it fail how does it work?
  • 104. write a test let it fail write the code how does it work?
  • 105. write a test let it fail write the code run the test again how does it work?
  • 106. write a test let it fail write the code run the test refactor again how does it work?
  • 110. Unit testing is supposed to test a single atomic “unit” of functionality without dependencies on anything else The curious case of Javascript unit testing
  • 111. Unit testing is This is where you start supposed to test a to run into serious single atomic “unit” of dependency problems functionality without due to the interrelation dependencies on with HTML and CSS anything else The curious case of Javascript unit testing
  • 112. Unit testing is What do you test? This is where you start supposed to test a Usually how the user to run into serious single atomic “unit” of interface responds to dependency problems functionality without user input. due to the interrelation dependencies on Actually, the realm of with HTML and CSS anything else functional testing The curious case of Javascript unit testing
  • 115. keep it real To all my homies working on the 9 to 5 Shaggy
  • 117. I used to work with these guys
  • 118. _$ = (function() { var registered = {}; return { ! ! pub: function(event, memo) { ! ! ! if (registered[event] instanceof Array){ ! ! ! ! var handlers = [].concat(registered[event]); ! ! ! ! for (var i=0, h; (h = handlers[i]); i++){ ! ! ! ! ! h.call(this, memo); ! ! ! ! } ! ! ! } ! ! }, ! ! sub: function(event, handler) { ! ! ! if (typeof registered[event] === "undefined"){ ! ! ! ! registered[event] = []; ! ! ! } ! ! ! registered[event].push(handler); ! ! } }; })();
  • 119. _$ = (function() { var registered = {}; return { ! ! pub: function(event, memo) { ! ! ! if (registered[event] instanceof Array){ ! ! ! ! var handlers = [].concat(registered[event]); ! ! ! ! for (var i=0, h; (h = handlers[i]); i++){ ! ! ! ! ! h.call(this, memo); ! ! ! ! } ! ! ! } ! ! }, ! ! sub: function(event, handler) { ! ! ! if (typeof registered[event] === "undefined"){ ! ! ! ! registered[event] = []; ! ! ! } ! ! ! registered[event].push(handler); ! ! } }; })();
  • 120. _$.sub("customEvent", function(obj) { ! //DO STUFF }); _$.pub("customEvent"); _$.pub("customEvent", { prop : "value" });
  • 121. _$.sub("customEvent", function(obj) { ! //DO STUFF }); _$.pub("customEvent"); _$.pub("customEvent", { prop : "value" });
  • 122. _$.sub("customEvent", function(obj) { ! //DO STUFF }); _$.pub("customEvent"); _$.pub("customEvent", { prop : "value" });
  • 123. _$ = (function() { var registered = {}; return { ! ! pub: function(event, memo) { ! ! ! if (registered[event] instanceof Array){ ! ! ! ! var handlers = [].concat(registered[event]); ! ! ! ! for (var i=0, h; (h = handlers[i]); i++){ ! ! ! ! ! h.call(this, memo); ! ! ! ! } ! ! ! } ! ! }, ! ! sub: function(event, handler) { ! ! ! if (typeof registered[event] === "undefined"){ ! ! ! ! registered[event] = []; ! ! ! } ! ! ! registered[event].push(handler); ! ! } }; })();
  • 124. _$ = (function (_) { ! return { ! ! pub: function(a, b, c, d) { ! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b) ! ! }, ! ! sub: function(a, b) { ! ! ! (_[a] || (_[a] = [])).push(b) ! ! } ! } })({})
  • 125. _$ = (function (_) { ! return { ! ! pub: function(a, b, c, d) { ! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b) ! ! }, ! ! sub: function(a, b) { ! ! ! (_[a] || (_[a] = [])).push(b) ! ! } tes ! } })({}) #140 by
  • 126. _$ = (function() { var registered = {}; return { ! ! pub: function(event, memo) { ! ! ! if (registered[event] instanceof Array){ ! ! ! ! var handlers = [].concat(registered[event]); ! ! ! ! for (var i=0, h; (h = handlers[i]); i++){ ! ! ! ! ! h.call(this, memo); ! ! ! ! } ! ! ! } ! ! }, ! ! sub: function(event, handler) { ! ! ! if (typeof registered[event] === "undefined"){ ! ! ! ! registered[event] = []; ! ! ! } ! ! ! registered[event].push(handler); ! ! } }; })();
  • 127. _$ = (function (_) { ! return { ! ! pub: function(a, b, c, d) { ! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b) ! ! }, ! ! sub: function(a, b) { ! ! ! (_[a] || (_[a] = [])).push(b) ! ! } tes ! } })({}) #140 by
  • 128. _$ = (function() { var registered = {}; return { ! ! pub: function(event, memo) { ! ! ! if (registered[event] instanceof Array){ ! ! ! ! var handlers = [].concat(registered[event]); ! ! ! ! for (var i=0, h; (h = handlers[i]); i++){ ! ! ! ! ! h.call(this, memo); ! ! ! ! } ! ! ! } ! ! }, ! ! sub: function(event, handler) { ! ! ! if (typeof registered[event] === "undefined"){ ! ! ! ! registered[event] = []; ! ! ! } ! ! ! registered[event].push(handler); ! ! } }; })();
  • 129. _$ = (function (_) { ! return { ! ! pub: function(a, b, c, d) { ! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b) ! ! }, ! ! sub: function(a, b) { ! ! ! (_[a] || (_[a] = [])).push(b) ! ! } tes ! } })({}) #140 by
  • 130. _$ = (function (_) { ! return { ! ! pub: function(a, b, c, d) { ! ! ! for (d=-1, c=[].concat(_[a]); c[++d];) c[d](b) ! ! }, ! ! sub: function(a, b) { ! ! ! (_[a] || (_[a] = [])).push(b) ! ! } tes ! } })({}) #140 by
  • 131. [...] testPub: function(){! ! ! ! var a = 0;! ! ! _$.sub('testNotify', function(){ a = 1; }); ! ! _$.pub('testNotify'); ! ! assertEquals(1, a); ! }, ! ! ! ! testNotifyWithMemo: function(){!! ! ! var a = 0 ;! ! ! _$.sub('testNotify', function(memo){ ! ! ! ! a = memo.test; ! ! }); ! ! _$.pub('testNotify', {test: 1}); ! ! assertEquals(1, a); ! }, [...]
  • 132. [...] testPub: function(){! ! ! ! var a = 0;! ! ! _$.sub('testNotify', function(){ a = 1; }); ! ! _$.pub('testNotify'); ! ! assertEquals(1, a); ! }, ! ! ! ! testNotifyWithMemo: function(){!! ! ! var a = 0 ;! ! ! _$.sub('testNotify', function(memo){ ! ! ! ! a = memo.test; ! ! }); ! ! _$.pub('testNotify', {test: 1}); ! ! assertEquals(1, a); ! }, [...]
  • 133. [...] testPub: function(){! ! ! ! var a = 0;! ! ! _$.sub('testNotify', function(){ a = 1; }); ! ! _$.pub('testNotify'); ! ! assertEquals(1, a); ! }, ! ! ! ! testNotifyWithMemo: function(){!! ! ! var a = 0 ;! ! ! _$.sub('testNotify', function(memo){ ! ! ! ! a = memo.test; ! ! }); ! ! _$.pub('testNotify', {test: 1}); ! ! assertEquals(1, a); ! }, [...]
  • 134. [...] testPub: function(){! ! ! ! var a = 0;! ! ! _$.sub('testNotify', function(){ a = 1; }); ! ! _$.pub('testNotify'); ! ! assertEquals(1, a); ! }, ! ! ! ! testNotifyWithMemo: function(){!! ! ! var a = 0 ;! ! ! _$.sub('testNotify', function(memo){ ! ! ! ! a = memo.test; ! ! }); ! ! _$.pub('testNotify', {test: 1}); ! ! assertEquals(1, a); ! }, [...]
  • 135. [...] testPub: function(){! ! ! ! var a = 0;! ! ! _$.sub('testNotify', function(){ a = 1; }); ! ! _$.pub('testNotify'); ! ! assertEquals(1, a); ! }, ! ! ! ! testNotifyWithMemo: function(){!! ! ! var a = 0 ;! ! ! _$.sub('testNotify', function(memo){ ! ! ! ! a = memo.test; ! ! }); ! ! _$.pub('testNotify', {test: 1}); ! ! assertEquals(1, a); ! }, [...]
  • 136. [...] testPub: function(){! ! ! ! var a = 0;! ! ! _$.sub('testNotify', function(){ a = 1; }); ! ! _$.pub('testNotify'); ! ! assertEquals(1, a); ! }, ! ! ! ! testNotifyWithMemo: function(){!! ! ! var a = 0 ; ! ! _$.sub('testNotify', function(memo){ ! ! ! ! a = memo.test; ! ! }); ! ! _$.pub('testNotify', {test: 1}); ! ! assertEquals(1, a); ! }, [...]
  • 137. [...] testPub: function(){! ! ! ! var a = 0;! ! ! _$.sub('testNotify', function(){ a = 1; }); ! ! _$.pub('testNotify'); ! ! assertEquals(1, a); ! }, ! ! ! ! testNotifyWithMemo: function(){!! ! ! var a = 0 ;! ! ! _$.sub('testNotify', function(memo){ ! ! ! ! a = memo.test; ! ! }); ! ! _$.pub('testNotify', {test: 1}); ! ! assertEquals(1, a); ! }, [...]
  • 140. R IV ER ST D TE T JS H IN JS
  • 141. .JS R ON I VE S IN D R ST TE T JS H IN JS
  • 143. SPIES a function that records arguments, return value, the value of this and exception thrown (if any) for all its calls. a mock library
  • 144. SPIES STUBS a function that records functions (spies) with arguments, return pre-programmed value, the value of this behavior. and exception thrown (if any) for all its calls. a mock library
  • 145. SPIES STUBS MOCKS a function that records functions (spies) with functions (spies) with arguments, return pre-programmed pre-programmed value, the value of this behavior. behavior (stubs) as well and exception thrown as pre-programmed (if any) for all its calls. expectations. a mock library
  • 146. [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SysyemOn')); ! }, ! ! ! ! testMyLibLoggedNotLogged: function(){!! ! ! var stub = sinon.stub(User, 'isLogged');! ! ! stub.returns(true); ! ! //DO STUFF && ASSERTIONS ! ! stub.returns(false); ! ! //DO STUFF && ASSERTIONS ! }, [...]
  • 147. SPY [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SystemOn')); ! }, ! ! ! ! testMyLibLoggedNotLogged: function(){!! ! ! var stub = sinon.stub(User, 'isLogged');! ! ! stub.returns(true); ! ! //DO STUFF && ASSERTIONS ! ! stub.returns(false); ! ! //DO STUFF && ASSERTIONS ! }, [...]
  • 148. SPY [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SystemOn')); ! }, ! ! ! ! testMyLibLoggedNotLogged: function(){!! ! ! var stub = sinon.stub(User, 'isLogged');! ! ! stub.returns(true); ! ! //DO STUFF && ASSERTIONS ! ! stub.returns(false); ! ! //DO STUFF && ASSERTIONS ! }, [...]
  • 149. SPY [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SystemOn')); ! }, ! ! ! ! testMyLibLoggedNotLogged: function(){!! ! ! var stub = sinon.stub(User, 'isLogged');! ! ! stub.returns(true); ! ! //DO STUFF && ASSERTIONS ! ! stub.returns(false); ! ! //DO STUFF && ASSERTIONS ! }, [...]
  • 150. SPY [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SystemOn')); ! }, ! ! ! ! testMyLibLoggedNotLogged: function(){!! ! ! var stub = sinon.stub(User, 'isLogged');! ! ! stub.returns(true); ! ! //DO STUFF && ASSERTIONS ! ! stub.returns(false); ! ! //DO STUFF && ASSERTIONS ! }, [...]
  • 151. STUB [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SystemOn')); ! }, ! ! ! ! testMyLibLoggedNotLogged: function(){!! ! ! var stub = sinon.stub(User, 'isLogged');! ! ! stub.returns(true); ! ! //DO STUFF && ASSERTIONS ! ! stub.returns(false); ! ! //DO STUFF && ASSERTIONS ! }, [...]
  • 152. STUB [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SystemOn')); ! }, ! ! ! ! testMyLibLoggedNotLogged: function(){!! ! ! var stub = sinon.stub(User, 'isLogged');! ! ! stub.returns(true); ! ! //DO STUFF && ASSERTIONS ! ! stub.returns(false); ! ! //DO STUFF && ASSERTIONS ! }, [...]
  • 153. STUB [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SystemOn')); ! }, ! ! ! ! testMyLibLoggedNotLogged: function(){!! ! ! var stub = sinon.stub(User, 'isLogged');! ! ! stub.returns(true); ! ! //DO STUFF && ASSERTIONS ! ! stub.returns(false); ! ! //DO STUFF && ASSERTIONS ! }, [...]
  • 154. STUB [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SystemOn')); ! }, ! ! ! ! testMyLibLoggedNotLogged: function(){!! ! ! var stub = sinon.stub(User, 'isLogged');! ! ! stub.returns(true); ! ! //DO STUFF && ASSERTIONS ! ! stub.returns(false); ! ! //DO STUFF && ASSERTIONS ! }, [...]
  • 155. MOCK [...] testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! assertTrue(spy.calledWith('SystemOn')); ! }, [...]
  • 156. MOCK [...] //testMyLibRegistersToSystemOnEvent: function(){! ! ! ! //var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! //assertTrue(spy.calledWith('SysyemOn')); ! //}, ! ! testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var mock = sinon.mock(_$); ! ! mock.expect('watch').calledWith('SysyemOn'); ! ! //DO STUFF TO INIT YOUR LIB ! ! mock.verify(); ! }, [...]
  • 157. MOCK [...] //testMyLibRegistersToSystemOnEvent: function(){! ! ! ! //var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! //assertTrue(spy.calledWith('SysyemOn')); ! //}, ! ! testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var mock = sinon.mock(_$); ! ! mock.expect('watch').calledWith('SysyemOn'); ! ! //DO STUFF TO INIT YOUR LIB ! ! mock.verify(); ! }, [...]
  • 158. MOCK [...] //testMyLibRegistersToSystemOnEvent: function(){! ! ! ! //var spy = sinon.spy(_$, 'watch');! ! ! //DO STUFF TO INIT YOUR LIB ! ! //assertTrue(spy.calledWith('SysyemOn')); ! //}, ! ! testMyLibRegistersToSystemOnEvent: function(){! ! ! ! var mock = sinon.mock(_$); ! ! mock.expect('watch').calledWith('SysyemOn'); ! ! //DO STUFF TO INIT YOUR LIB ! ! mock.verify(); ! }, [...]
  • 159. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 160. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 161. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 162. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 163. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 164. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 165. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 166. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 167. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 168. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 169. AJAX CALL [...] testOnSuccessCallback: function(){! ! var server = sinon.useFakeServer(); server.respondWith("GET", "/art/12/comments.json", [200, {"Content-Type":"application/json"}, "[{ id:12, text:'Hello'}]"]); ! ! var spy = sinon.spy(); ! ! myLib.getCommentsFor("/art/12", spy); ! ! server.respond(); ! ! assert(spy.calledWith([{ id:12, text:"Hello"}])); ! }, [...]
  • 170. .JS R ON I VE S IN D R ST TE T JS H IN JS
  • 171. E SS OR PR OM S Y U I C .J S ON I VE R IN D R ST TE T JS H IN JS
  • 175. IN THE WILD In the wild, there is no health care. Dwight Schrute (the office)
  • 183. LOOKING FORWARD the further we look at, the more control we need
  • 184. LOOKING FORWARD the further we look at, the more control we need
  • 185. LOOKING FORWARD the further we look at, the more control we need let's get ready
  • 186. LOOKING FORWARD the further we look at, the more control we need let's get ready javascript is a programming language
  • 187. LOOKING FORWARD the further we look at, the more control we need let's get ready javascript is a programming language javascript is a serious business.
  • 188. LOOKING FORWARD the further we look at, the more control we need let's get ready javascript is a programming language javascript is a serious business. and, most of all...
  • 190. javascript kicks asses any question? http://spkr8.com/t/8718 http://cedmax.com @cedmax