Better Code through TDD

666 Aufrufe

Veröffentlicht am

The talk I gave about be

Veröffentlicht in: Technologie
0 Kommentare
0 Gefällt mir
Statistik
Notizen
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Keine Downloads
Aufrufe
Aufrufe insgesamt
666
Auf SlideShare
0
Aus Einbettungen
0
Anzahl an Einbettungen
4
Aktionen
Geteilt
0
Downloads
6
Kommentare
0
Gefällt mir
0
Einbettungen 0
Keine Einbettungen

Keine Notizen für die Folie

Better Code through TDD

  1. 1. Better Code through TDDWolfram KriesingCTO, uxebu@wolframkriesingFreitag, 12. April 13
  2. 2. http://140byt.esWarming up: shorten please! Freitag, 12. April 13
  3. 3. Try it out!Browsernode.jsFreitag, 12. April 13
  4. 4. uxebu100%TechnologyCompany- since 2008- remote teamFreitag, 12. April 13
  5. 5. TDD using JasmineFreitag, 12. April 13
  6. 6. Why TDD?• Better tool than Debugging• Verifies Refactoring• SustainableFreitag, 12. April 13
  7. 7. Jasmine• JavaScript quasi standard• For nodejs+browser (server+client)• Built-in Spies• Custom Matchers make awesome errors!!!http://pivotal.github.com/jasmine/Freitag, 12. April 13
  8. 8. Jasmine - MatchersFreitag, 12. April 13
  9. 9. Jasmine - Matchers, watch out!Freitag, 12. April 13
  10. 10. Matchers - toContain, notFreitag, 12. April 13
  11. 11. Custom Matchers - toBeInstanceOfFreitag, 12. April 13
  12. 12. Custom Matchers - toBeInstanceOfFreitag, 12. April 13
  13. 13. Custom MatchersFreitag, 12. April 13
  14. 14. Spies• Decoupled Testing• Fast Tests (Removes waits, Removes timings)• Better Architecture• Async TestingFreitag, 12. April 13
  15. 15. SpiesFreitag, 12. April 13
  16. 16. SpiesFreitag, 12. April 13
  17. 17. SpiesFreitag, 12. April 13
  18. 18. TDD is just the start...Freitag, 12. April 13
  19. 19. Our ProcessRepoDevCIFlowdockAll DevsFreitag, 12. April 13
  20. 20. CI - Continuous Integration• All projects• Automated Test runs (multiple browsers/devices)• Build• Code coverage• On Linux!Freitag, 12. April 13
  21. 21. CI - Continuous Integrationhttp://siliconforks.com/jscoverage/Freitag, 12. April 13
  22. 22. CI - Continuous IntegrationFreitag, 12. April 13
  23. 23. Embedded Jasmine Test RunnerTestResultTest PlatformsFreitag, 12. April 13
  24. 24. Better code?Freitag, 12. April 13
  25. 25. The problemFreitag, 12. April 13
  26. 26. S3UploadHTML5 files to Amazon S3 (bucket)Freitag, 12. April 13
  27. 27. Assetsindex.htmlmovie.jsFreitag, 12. April 13
  28. 28. • it‘s a prototype ....... +1• is actually async (ignored) ......... -1• runs all uploads in parallel ........ +1• no error handling ........ -1• NEEDS WORKFreitag, 12. April 13
  29. 29. • still a prototype ....... +1• is actually async ......... +1• does NOT run uploads in parallel ........ -1• partly error handling ........ 0• NEEDS WORKFreitag, 12. April 13
  30. 30. Freitag, 12. April 13
  31. 31. HTTP PUThard codedhiddenS3Uploader!!!!!Freitag, 12. April 13
  32. 32. • S3Uploader.js• uploads from a buffer• needs to take S3 configFreitag, 12. April 13
  33. 33. TDD please....Freitag, 12. April 13
  34. 34. Freitag, 12. April 13
  35. 35. Freitag, 12. April 13
  36. 36. S3Put.jsupload fromfilenameupload frombufferS3Uploader.js HTTP PUTFreitag, 12. April 13
  37. 37. Freitag, 12. April 13
  38. 38. S3UploaderFreitag, 12. April 13
  39. 39. S3Put.jsupload fromfilenameupload frombufferS3Uploader.js HTTP PUT:-(Freitag, 12. April 13
  40. 40. Uploader.jsS3Put.jsfrom filenameupload frombufferS3Uploader.jsHTTP PUTfrom bufferFreitag, 12. April 13
  41. 41. ClassMethodsFreitag, 12. April 13
  42. 42. All tests green? Refactor!Freitag, 12. April 13
  43. 43. Freitag, 12. April 13
  44. 44. S3Put.jsupload frombufferS3Uploader.jsHTTP PUTUploader.jsfrom filenamefrom bufferFreitag, 12. April 13
  45. 45. S3Put.jsupload frombufferS3Uploader.jsHTTP PUTUploader.jsfrom filenamefrom bufferFileUploader.jsfrom filenamefrom bufferFreitag, 12. April 13
  46. 46. Looking at the big picture again ...Freitag, 12. April 13
  47. 47. • is actually async ......... +1• runs all uploads in parallel ........ -1• error handling ........ 0• NEEDS WORKFreitag, 12. April 13
  48. 48. FileUploader.uploadFromFilesNamesFreitag, 12. April 13
  49. 49. Freitag, 12. April 13
  50. 50. • is actually async ......... +1• runs all uploads in parallel ........ +1• error handling ........ +1• upload multiple files :)New requirementFreitag, 12. April 13
  51. 51. Freitag, 12. April 13
  52. 52. FileUploader.jsS3Put.jsfrom filenameupload frombufferS3Uploader.jsHTTP PUTfrom bufferfrom filenamesFreitag, 12. April 13
  53. 53. • Get to know what you really need• Just as much as necessary• It‘s a proof of concept• Reveals the APIPrototypingFreitag, 12. April 13
  54. 54. • Let the architecture come by itself• Don‘t turn off the brain• Have clear interfaces - so you can mock them• Use explicit names and the API modules evolveTDDFreitag, 12. April 13
  55. 55. Thank you@wolframkriesingWolfram Kriesing, CTOuxebuFreitag, 12. April 13

×