Share
Embed
Sustainable Software with Jasmine via Cory Flanigan and Justin Searls
Justin Searls
September 12, 2011
Transcript
105 slides
-
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to pain points -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to pain points -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to pain points -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to pain points -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to which leads to -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours which leads to -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours which leads to -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours which leads to -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours which leads to -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours but we value -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours shipping features to users constantly avoiding commitments to non-critical concerns minimizing time to turn ideas into reality getting the most out of each infusion of capital but we value -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours shipping features to users constantly avoiding commitments to non-critical concerns minimizing time to turn ideas into reality getting the most out of each infusion of capital but we value -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours shipping features to users constantly avoiding commitments to non-critical concerns minimizing time to turn ideas into reality getting the most out of each infusion of capital but we value -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours shipping features to users constantly avoiding commitments to non-critical concerns minimizing time to turn ideas into reality getting the most out of each infusion of capital but we value -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours shipping features to users constantly avoiding commitments to non-critical concerns minimizing time to turn ideas into reality getting the most out of each infusion of capital our values are compromised -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours shipping features to users constantly avoiding commitments to non-critical concerns minimizing time to turn ideas into reality getting the most out of each infusion of capital takes too long for finished features to get into production documentation slows progress; key people become bottlenecks communication cost slows down implementation wastes money & good-will; exacerbates quality issues our values are compromised -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours shipping features to users constantly avoiding commitments to non-critical concerns minimizing time to turn ideas into reality getting the most out of each infusion of capital takes too long for finished features to get into production documentation slows progress; key people become bottlenecks communication cost slows down implementation wastes money & good-will; exacerbates quality issues our values are compromised -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours shipping features to users constantly avoiding commitments to non-critical concerns minimizing time to turn ideas into reality getting the most out of each infusion of capital takes too long for finished features to get into production documentation slows progress; key people become bottlenecks communication cost slows down implementation wastes money & good-will; exacerbates quality issues our values are compromised -
adding new code breaks existing functionality intent & value of
the code is unclear HTML & JavaScript become codependent it takes longer to add a new feature than it used to manual regression testing, change control processes rely on documentation, original authors to retain knowledge developers and designers closely coordinate each change hiring more people, working longer hours shipping features to users constantly avoiding commitments to non-critical concerns minimizing time to turn ideas into reality getting the most out of each infusion of capital takes too long for finished features to get into production documentation slows progress; key people become bottlenecks communication cost slows down implementation wastes money & good-will; exacerbates quality issues our values are compromised -
vicious cycle more bugs communication drag higher carrying cost slower
delivery more indirection -
vicious cycle more bugs communication drag higher carrying cost slower
delivery less feedback more indirection -
vicious cycle more bugs communication drag higher carrying cost slower
delivery more overtime less feedback more indirection -
vicious cycle more bugs communication drag higher carrying cost slower
delivery more overtime less feedback greater risk more indirection -
what if? new code didn’t risk breaking existing functionality? all
code was sufficiently documented as it was developed? code was modular enough to survive UI changes, multiple client platforms? adding new features became easier over time? -
what if? new code didn’t risk breaking existing functionality? all
code was sufficiently documented as it was developed? code was modular enough to survive UI changes, multiple client platforms? adding new features became easier over time? -
what if? new code didn’t risk breaking existing functionality? all
code was sufficiently documented as it was developed? code was modular enough to survive UI changes, multiple client platforms? adding new features became easier over time? -
what if? new code didn’t risk breaking existing functionality? all
code was sufficiently documented as it was developed? code was modular enough to survive UI changes, multiple client platforms? adding new features became easier over time? -
virtuous cycle fewer bugs more autonomy easier to change more
rapid delivery more confidence -
virtuous cycle fewer bugs more autonomy easier to change more
rapid delivery greater value more confidence -
virtuous cycle fewer bugs more autonomy easier to change more
rapid delivery more balance greater value more confidence -
virtuous cycle fewer bugs more autonomy easier to change more
rapid delivery more balance greater value less risk more confidence -
1. sketch it 2. spike it I want to go
to there! -
1. sketch it 2. spike it 3. spec it I
want to go to there! -
describe('#addTask', function(){ it('appends a div', function(){ var $container = $('<div></div>');
expect($container).toContain('div'); }); }); -
describe('#addTask', function(){ it('appends a div', function(){ var $container = $('<div></div>');
addTask.call($container); expect($container).toContain('div'); }); }); -
window.addTask = function(){ this.append('<div></div>'); }; describe('#addTask', function(){ it('appends a div',
function(){ var $container = $('<div></div>'); addTask.call($container); expect($container).toContain('div'); }); }); -
describe('#addTask', function(){ it('appends a div', function(){ var $container = $('<div></div>');
addTask.call($container); expect($container).toContain('div'); }); it('includes a default text label', function(){ var $container = $('<div></div>'); addTask.call($container); expect($container).toHaveText('New Task!'); }); }); -
window.addTask = function(){ this.append('<div>New Task!</div>'); }; describe('#addTask', function(){ ... it('includes
a default text label', function(){ var $container = $('<div></div>'); addTask.call($container); expect($container).toHaveText('New Task!'); }); }); -
describe('#addTask', function(){ it('appends a div', function(){ var $container = $('<div></div>');
addTask.call($container); expect($container).toContain('div'); }); it('includes a default text label', function(){ var $container = $('<div></div>'); addTask.call($container); expect($container).toHaveText('New Task!'); }); }); -
describe('#addTask', function(){ var $container; beforeEach(function(){ $container = $('<div></div>'); addTask.call($container); });
it('appends a div', function(){ expect($container).toContain('div'); }); it('includes a default text label', function(){ expect($container).toHaveText('New Task!'); }); }); -
describe('#addTask', function(){ var $container; beforeEach(function(){ $container = $('<div></div>'); addTask.call($container); });
it('appends a div', function(){ expect($container).toContain('div'); }); it('includes a default text label', function(){ expect($container).toHaveText('New Task!'); }); }); jasmine-jquery http://is.gd/jasminejquery -
describe('#clicker', function(){ it('triggers the event handler', function(){ var handler =
jasmine.createSpy('handles clicks'); expect(handler).toHaveBeenCalledWith(event); }); }); -
describe('#clicker', function(){ it('triggers the event handler', function(){ var handler =
jasmine.createSpy('handles clicks'); var event = $.Event('click'); expect(handler).toHaveBeenCalledWith(event); }); }); -
describe('#clicker', function(){ it('triggers the event handler', function(){ var handler =
jasmine.createSpy('handles clicks'); var event = $.Event('click'); $.jasmine.inject('<div class="my-button"></div>'); clicker('.my-button',handler); $('.my-button').trigger(event); expect(handler).toHaveBeenCalledWith(event); }); }); -
var clicker = function(selector, whenClicked){ }; describe('#clicker', function(){ it('triggers the
event handler', function(){ var handler = jasmine.createSpy('handles clicks'); var event = $.Event('click'); $.jasmine.inject('<div class="my-button"></div>'); clicker('.my-button',handler); $('.my-button').trigger(event); expect(handler).toHaveBeenCalledWith(event); }); }); -
var clicker = function(selector, whenClicked){ $(selector).live('click',function(e) { whenClicked(e); }); };
describe('#clicker', function(){ it('triggers the event handler', function(){ var handler = jasmine.createSpy('handles clicks'); var event = $.Event('click'); $.jasmine.inject('<div class="my-button"></div>'); clicker('.my-button',handler); $('.my-button').trigger(event); expect(handler).toHaveBeenCalledWith(event); }); }); -
var clicker = function(selector, whenClicked){ $(selector).live('click',function(e) { whenClicked(e); }); };
describe('#clicker', function(){ ... it('prevents default browser behavior', function(){ var handler = jasmine.createSpy('handles clicks'); var event = $.Event('click'); spyOn(event,'preventDefault'); $.jasmine.inject('<div class="my-button"></div>'); clicker('.my-button',handler); $('.my-button').trigger(event); expect(event.preventDefault).toHaveBeenCalled(); }); }); -
var clicker = function(selector, whenClicked){ $(selector).live('click',function(e) { e.preventDefault(); whenClicked(e); });
}; describe('#clicker', function(){ ... it('prevents default browser behavior', function(){ var handler = jasmine.createSpy('handles clicks'); var event = $.Event('click'); spyOn(event,'preventDefault'); $.jasmine.inject('<div class="my-button"></div>'); clicker('.my-button',handler); $('.my-button').trigger(event); expect(event.preventDefault).toHaveBeenCalled(); }); }); -
describe('#clicker', function(){ it('triggers the event handler', function(){ var handler =
jasmine.createSpy('handles clicks'); var event = $.Event('click'); $.jasmine.inject('<div class="my-button"></div>'); clicker('.my-button',handler); $('.my-button').trigger(event); expect(handler).toHaveBeenCalledWith(event); }); it('prevents default browser behavior', function(){ var handler = jasmine.createSpy('handles clicks'); var event = $.Event('click'); spyOn(event,'preventDefault'); $.jasmine.inject('<div class="my-button"></div>'); clicker('.my-button',handler); $('.my-button').trigger(event); expect(event.preventDefault).toHaveBeenCalled(); }); }); -
describe('#clicker',function(){ var handler, event; beforeEach(function(){ handler = jasmine.createSpy('handles clicks'); event
= $.Event('click'); spyOn(event,'preventDefault'); $.jasmine.inject('<div class="my-button"></div>'); }); context('when you click the button',function(){ beforeEach(function(){ clicker('.my-button',handler); $('.my-button').trigger(event); }); it('triggers the event handler',function(){ expect(handler).toHaveBeenCalledWith(event); }); it('prevents default browser behavior',function(){ expect(event.preventDefault).toHaveBeenCalled(); }); }); }); -
describe('#clicker',function(){ var handler, event; beforeEach(function(){ handler = jasmine.createSpy('handles clicks'); event
= $.Event('click'); spyOn(event,'preventDefault'); $.jasmine.inject('<div class="my-button"></div>'); }); context('when you click the button',function(){ beforeEach(function(){ clicker('.my-button',handler); $('.my-button').trigger(event); }); it('triggers the event handler',function(){ expect(handler).toHaveBeenCalledWith(event); }); it('prevents default browser behavior',function(){ expect(event.preventDefault).toHaveBeenCalled(); }); it('binds `this` to the jQuery result object',function(){ expect(handler.mostRecentCall.object).toBe('.my-button'); }); }); }); -
var clicker = function(selector, whenClicked){ $(selector).live('click',function(e) { e.preventDefault(); whenClicked.call($(this),e); });
}; describe('#clicker', function(){ ... context('when you click the button',function(){ ... it('binds `this` to the jQuery result object',function(){ expect(handler.mostRecentCall.object).toBe('.my-button'); }); }); }); -
window.addTask = function(){ this.append('<div>New Task!</div>'); }; var clicker = function(selector,
whenClicked){ $(selector).live('click',function(e) { e.preventDefault(); whenClicked.call($(this),e); }); }; clicker('.add-task', addTask); -
thank you! [email protected] Boulder UX, Boulder, CO September 12, 2011
@searls seefl[email protected] @seeflanigan Thanks to Brandon Keepers (@bkeepers) for the Keynote template! find this talk at http://is.gd/jasmineux