• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Questions about some sections of Test-Driven JavaScript Development.

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's inside?
  • Understanding unit testing and TDD

  • Is there something different about TDD with js from with other languages? Are they addressed in the book?

  • Choosing the right unit testing framework

  • Could the UT framework solve the cross browser problem automatically?

  • Building cleaner APIs, modularized and robust JavaScript

  • Are they some best practices used in your daily development? Are they different from some sections of the js definitive guide and js the good parts?

  • Continuously improving code through refactoring
  • Five practical TDD sessions: Ajax, DOM manipulation, Node.js and more
  • Test-driven tour to JavaScript for developers not familiar with the language
  •  
    author
    Posts: 46
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Louis Wang wrote:What's inside?

  • Understanding unit testing and TDD

  • Is there something different about TDD with js from with other languages? Are they addressed in the book?



    Both yes and no. Many developers think of JavaScript as part of the UI, thus hard to test. While it's true that JavaScript usually is a part of the UI, JavaScript is "just a programming language", and the logic we implement with it can be tested like in any other language.

    What sets JavaScript apart is the environment in which it runs. Browsers can be a hostile environment, and unlike any other programming language, JavaScript code is expected to run on a wide variety of very different runtimes. This can make testing slightly more complicated, and some help with this is offered throughout the book. Really, the difficult part is the production code itself, not the tests per se.

    Louis Wang wrote:

  • Choosing the right unit testing framework

  • Could the UT framework solve the cross browser problem automatically?



    Well, the test frameworks definitely helps when developing cross-browser code, given that it is an extremely effective way of verifying your code high and wide. For example, JsTestDriver (http://code.google.com/p/js-test-driver/wiki/) the tool used for most examples in the book can automatically run tests in lots of browser simultaneously, and you can control it from the command line or IDE. Obviously, the test frameworks cannot abstract away browser differences like a library like jQuery would, as that would yield surprising results when running code outside of the test environment.

    Louis Wang wrote:

  • Building cleaner APIs, modularized and robust JavaScript

  • Are they some best practices used in your daily development? Are they different from some sections of the js definitive guide and js the good parts?



    These are some suggestions for how to develop JavaScript responsibly, and with a touch of design. This is opposed to "one js file with 800 lines of spaghetti". They're different from the other books you mention in that my book deals with code on a higher level - e.g. how to develop loosely coupled modules that play together in a greater whole. It does this by TDD-ing several small real life projects.

    The book also contains some sections on cross-browser JavaScript which is not covered by either The Good Parts and (as far as I know) The Definitive Guide - unobtrusive JavaScript and feature detection.
     
    Climb the rope! CLIMB THE ROPE! You too tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic