SlideShare a Scribd company logo
1 of 38
Pro bun-fighting Testing, quality and group hugs
What the who? ,[object Object],[object Object],[object Object],[object Object]
Jake Archibald
Michael Mathews* *not actually Michael, but an entertaining real  photo could not be located
[object Object]
[object Object],Steve Elson
 
[object Object],Ed Scotcher
[object Object],I love Glow for 1/6 th  of my day! Ed Scotcher
A small and distributed problem ,[object Object],[object Object],[object Object]
Problem 1: Communicating what we want to make
Why care?
The unwrap() method ,[object Object],[object Object]
The unwrap() method ,[object Object],[object Object]
In JSDoc… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
In JSDoc… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The bun-fight
Free documentation
Problem 2: Checking what we’ve made actually works
Qunit
unwrap() test example ,[object Object]
unwrap() test example ,[object Object],[object Object],[object Object]
unwrap() test example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
unwrap() test example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sanity checking & code reviews
Conflict resolution
Problem 3: Checking what we’ve made is fast
Why Woosh?
Creating tests
Run time ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Over time ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Live demo
 
 
 
The headlines ,[object Object],[object Object],[object Object]
And the rest
Roll credits ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
Paul Irish
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
Eddie Kao
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
Luke Summerfield
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UI
Rebecca Murphey
 
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Alessandro Nadalin
 

What's hot (20)

Functionality Focused Code Organization
Functionality Focused Code OrganizationFunctionality Focused Code Organization
Functionality Focused Code Organization
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
 
Coffeescript: No really, it's just Javascript
Coffeescript: No really, it's just JavascriptCoffeescript: No really, it's just Javascript
Coffeescript: No really, it's just Javascript
 
A New Baseline for Front-End Devs
A New Baseline for Front-End DevsA New Baseline for Front-End Devs
A New Baseline for Front-End Devs
 
Using Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeUsing Objects to Organize your jQuery Code
Using Objects to Organize your jQuery Code
 
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
Jqueryforbeginnersjqueryconference2009 090914063709 Phpapp02
 
Introduction to Meteor at ChaDev Lunch
Introduction to Meteor at ChaDev LunchIntroduction to Meteor at ChaDev Lunch
Introduction to Meteor at ChaDev Lunch
 
Introduction To Moose
Introduction To MooseIntroduction To Moose
Introduction To Moose
 
Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)
 
CoffeeScript
CoffeeScriptCoffeeScript
CoffeeScript
 
Struts database access
Struts database accessStruts database access
Struts database access
 
Moose Best Practices
Moose Best PracticesMoose Best Practices
Moose Best Practices
 
History of jQuery
History of jQueryHistory of jQuery
History of jQuery
 
Javascript Frameworks for Joomla
Javascript Frameworks for JoomlaJavascript Frameworks for Joomla
Javascript Frameworks for Joomla
 
Architecure components by Paulina Szklarska
Architecure components by Paulina SzklarskaArchitecure components by Paulina Szklarska
Architecure components by Paulina Szklarska
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is Human
 
06 jQuery #burningkeyboards
06 jQuery  #burningkeyboards06 jQuery  #burningkeyboards
06 jQuery #burningkeyboards
 
Moose workshop
Moose workshopMoose workshop
Moose workshop
 
Delivering a Responsive UI
Delivering a Responsive UIDelivering a Responsive UI
Delivering a Responsive UI
 
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
 

Similar to Pro bun-fighting - Working with JavaScript projects

Memory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerMemory Leaks In Internet Explorer
Memory Leaks In Internet Explorer
Christopher Blum
 
Preexisting code, please useMain.javapublic class Main { p.pdf
Preexisting code, please useMain.javapublic class Main {    p.pdfPreexisting code, please useMain.javapublic class Main {    p.pdf
Preexisting code, please useMain.javapublic class Main { p.pdf
rd1742
 
Memory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerMemory Leaks In Internet Explorer
Memory Leaks In Internet Explorer
Christopher Blum
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
Ignacio Martín
 
JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraum
patricklee
 

Similar to Pro bun-fighting - Working with JavaScript projects (20)

Solving the Riddle of Search: Using Sphinx with Rails
Solving the Riddle of Search: Using Sphinx with RailsSolving the Riddle of Search: Using Sphinx with Rails
Solving the Riddle of Search: Using Sphinx with Rails
 
Reasons To Love Ruby
Reasons To Love RubyReasons To Love Ruby
Reasons To Love Ruby
 
Everything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-insEverything is Permitted: Extending Built-ins
Everything is Permitted: Extending Built-ins
 
Method::Signatures
Method::SignaturesMethod::Signatures
Method::Signatures
 
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaThe things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and Akka
 
Memory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerMemory Leaks In Internet Explorer
Memory Leaks In Internet Explorer
 
Preexisting code, please useMain.javapublic class Main { p.pdf
Preexisting code, please useMain.javapublic class Main {    p.pdfPreexisting code, please useMain.javapublic class Main {    p.pdf
Preexisting code, please useMain.javapublic class Main { p.pdf
 
Perl Teach-In (part 2)
Perl Teach-In (part 2)Perl Teach-In (part 2)
Perl Teach-In (part 2)
 
Real life-coffeescript
Real life-coffeescriptReal life-coffeescript
Real life-coffeescript
 
Sphinx on Rails
Sphinx on RailsSphinx on Rails
Sphinx on Rails
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
Advanced Silverlight
Advanced SilverlightAdvanced Silverlight
Advanced Silverlight
 
Memory Leaks In Internet Explorer
Memory Leaks In Internet ExplorerMemory Leaks In Internet Explorer
Memory Leaks In Internet Explorer
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
Fewd week6 slides
Fewd week6 slidesFewd week6 slides
Fewd week6 slides
 
JavaScript Essentials
JavaScript EssentialsJavaScript Essentials
JavaScript Essentials
 
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worldsSymfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
 
Spring has got me under it’s SpEL
Spring has got me under it’s SpELSpring has got me under it’s SpEL
Spring has got me under it’s SpEL
 
JavaScript Sprachraum
JavaScript SprachraumJavaScript Sprachraum
JavaScript Sprachraum
 
OO in JavaScript
OO in JavaScriptOO in JavaScript
OO in JavaScript
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 

Pro bun-fighting - Working with JavaScript projects

Editor's Notes

  1. Wait for silence. Chillax.
  2. I’m Frances I’m a developer Glow, The BBCs Open Source JavaScript Library Some of you may be most familiar with me in the microformats world, or you may even have met me at pubstandards – in which case, I apologise. I’m basically your average web nerd, and I’m based in west london, which is very convenient for work… this is more than I can say for the rest of the team…
  3. We’ve got Jake Archibald. Comedy northerner who’ll be showing you his latest stand-up routine after I’m done. He just moved out of London and now lives somewhere near Brighton or France.
  4. Michael Mathews – author of JSDocToolKit – which some of you may have heard of or be using… and he mostly works from his countrified home up out of London.. And then there’s…
  5. Well, actually.. That’s it. There’s only 3 of us. Well, to be honest, it’s just not just us.
  6. We have a product owner who is with us for about 50% of his time He helps us with various bits of internal politics and defines high-level aspirations like “we want a library and can we make it do carousels”
  7. 50% of his time
  8. a scrum master who bears an uncanny resemblance to Matt Berry for a 6 th of his time.
  9. a scrum master who bears an uncanny resemblance to Matt Berry for a 6 th of his time. Mostly, we’re left to our own devices.
  10. So, we have various issues. There’s only 3 of us (build glow2, bug fix, relase on glow 1, IRC, mailing lists, learning, events) Lack of face-to-face time – need to be efficient Have to run tight ship
  11. We need to decide how to make what we’re making. In our case on Glow, most of this boils down to discussions on what should go into the API. Needs to be a way to work over email, IRC or in person
  12. Miscommunication is the enemy here – more upset and disagreements occur when a specification has been misunderstood or read with a different tone than any other thing in the process. There’s nothing worse than getting 90% into building a beautiful new method than finding out that you’ve misunderstood what the rest of the team meant. Plus, we just don’t get to see each other face to face all that often, so we need to communicate accurately and quickly over email. This is how we do it. Knowledge silos – sharing the decision making – getting a unified feel – don't want ot be able to spot one person's style
  13. Example – someone makes a suggestion for this method Difficult to see what’s important / no context / no examples Prose tends to be scan-read
  14. We can pick out a few key words – maybe what we want to name it, but it’s still a bit vague.
  15. This is better – clearly states all the necesarry values and an example Used to send this via email – now put in source files and commit to git Helps us keep a log of what changes we’ve made – someone new can pick it up
  16. We can highlight some of the interesting parts – and that’s most of it – there’s very little wastage Also creates a mini-spec for that piece of work – this is what will be refered back to to check the work was done correctly. The person proposing the API isn't necessarily the person who will write the code. Once this is all commited, the author sends a meeting request so people can have a look at it before the bun-fight
  17. The bun-fight is essentially what we call locking ourselves in a room and going through the proposed API. The JSDocs are printed, we take coffee and jolly ranchers into an office space with some pens and we go through it line-by-line. Sometimes, even at this early stage, someone can get rather attached to an idea they’ve had, or more commonly, we just just plain don’t agree, so there’s a whole lot of grumbling, maybe a few raised voices, but in theory, we emerge from the meeting, in one piece, with an aPI the whole team not only likes, but understands. Real example – ideal if bits get crossed out – less work! Sometimes an underlying feature is identified – this API shelved, new API written. Menu vs focusssable
  18. And as a nice side effect of this process, our docs are written for us – and since they're comments that live along side the code, they're also subject to our strict code review, which I’ll talk a bit more about later. We’re actually considering adding an extra layer to this where the example you can see will actually become code extracted from the unit tests, so that we know it’s a working example – copy and paste woes – and this leads me on to the next topic…
  19. This is pretty fundamental. Well, other than writing any code at all – making sure it works is obviously something you want to do before you can ship a product. We're very test driven development focused, and after we've done the docs, we write the unit tests. In the first instance, examples from the JSDocs are turned into unit tests, and then we add additional tests and edge cases, and begin to write the code that makes those test pass. We used to use our own test harness for unit tests, but for Glow 2, we've switched over to Qunit, which I'm sure some of you have seen before, but for those that haven't, this is how it works...
  20. Qunit is a javascript based test framework from the jquery team We used to use our own framework, but for glow 2 have decided to switch to something a bit more standard and then also the upkeep overhead is someone else’s problem We did donate a new theme though, because their old default one was somewhat of an eyesore.
  21. If you did the previous work in getting the documentation right and agreeing what you should be making, the first thing to test is the example. Here you’ll see that we’re setting up a bunch of tests for the unwrap method – we start by letting qunit know this by adding the module call – here you can specify some extra methods to be formed before and after each set of tests
  22. Now we add in a new set of tests – give it a vaguely meaningful name and here you can also say how many asserts to expect.
  23. Add some basic tests to check that the API is correct and that unwrap is indeed a function available to us
  24. And then we add some tests to check how the actual method behaves – does it return a nodelist as we expect, are it’s parents correct after it’s been unwrapped. There would obviously be a lot more tests that this for production, but testing the obvious first is the best thing to do.
  25. We use both the API docs and these unit tests to sanity check our work. At the end of the module we have code reviews, which as a small team we're able to do all together, but if you were in a larger team It would probably be a good place to get some people involved who may otherwise have not seen the piece of work you've been doing. Our code reviews are more extensive and possibly slightly non-traditional. We perform them at a computer, with the reviewee at the helm, then the reviewers get to read through the doucmenttation, checking it for sense – can they guess how the implementation will work, does it return what they expected and so on... then the unit tests are given a look over, with suggestions for possible edge-cases that may have been missed, and only then are the real lines of code looked at – and at this point, if the docs and tests are thorough enough, they're inevitably only suggestions for performance improvements. Which leads me somewhat seamlessly to the final problem I wanted to talk about tonight...
  26. I ran throught this stuff with Jake and he suggested conflic resolution I laughed You will fall out sometimes, but the best I can say is, as long as you talk to each other civily and understand that all suggestions are for the greater good, that and a few cookies and a coffee will sort it out.
  27. This is the final thing I wanted to talk about briefly, and that’s performance. Jake gave a fantastic presentation at Full Frontal on performance in JavaScript and I recommend that, but what matters to us on Glow, and probably matters to a lot of users, is how do we *know* we’re fast – and when it comes to a library, being fast really really matters So.. we benchmark. In Woosh.
  28. Why Woosh?| Well, it's based on Slickspeed, which will provide you with an overall runtime for your scripts, but for us, although those stats are intesreting, it doesn't actually help us in terms of figuring out where we suck. What we wanted was a lot more granulatrity and we wanted to be able to produce tests quickly so it wouldn't impact on our development time.
  29. Creating tests is pretty easy. Woosh provides you with all the major libs, but you can add your own references to scripts and use those too. After that, it’s just a case of adding tests for each method and deciding what kind of test you want – woosh offers 2 types.
  30. This is how long to run 1000 times – note the first param states how many times We had problems with this when testing events – YUI 3 was very slow and took a long time to complete – time outs and boredom So added a second kind of test..
  31. This is over time – This is best for day-to-day development, since you’re capping execution time length so you’re not waiting around indefinitely
  32. So, what do the tests actually look like when they run? I could show you some screenshots, but why not make this only a tiny bit less boring by showing you a live demo – at least there's all the fun of potential disaster. To chrome...
  33. So, what do the tests actually look like when they run? I could show you some screenshots, but why not make this only a tiny bit less boring by showing you a live demo – at least there's all the fun of potential disaster. To chrome...
  34. So, what do the tests actually look like when they run? I could show you some screenshots, but why not make this only a tiny bit less boring by showing you a live demo – at least there's all the fun of potential disaster. To chrome...
  35. So, what do the tests actually look like when they run? I could show you some screenshots, but why not make this only a tiny bit less boring by showing you a live demo – at least there's all the fun of potential disaster. To chrome...
  36. There's obviously loads of other things that go into making a good javascript project, or really any good piece of web development work, but in only half an hour I hope I've given you an overview of some of the areas I think are interesting. For example, we also have a manual test framework that we’ve written, and I believe Jake will be using that to show some of the work on keyboard events in the next presentation.
  37. And that’s me done. I’ve been Frances. I twitter as phae, and you can find everything else about me on fberriman.com. All the examples you've seen and a ton more are available on the glow github repo, and again, we are open source so we'd love for you to get involved. We’re going to hold questions after Jake and the beer break, so on the off chance you’ve got some questions or comments, scribble them down on the back of a beer-mat and we’ll go over them later. Thanks a lot!