Skip to content

OneLessHam/FCIP-talk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoffeeScript and Unit Testing

Why are we here?

  • web/native development
  • slow standard evolution [get numbers]

JavaScript is great

  • runs everywhere (*)
  • functional paradigms
  • mature library support

JavaScript is terrible

  • verbose/inconsistant
  • bad parts to avoid

Enter CoffeeScript

  • just JavaScript
  • [get some history]

Where is this going?

  • popular/supported [get stats]
  • Dropbox
  • Kickstarted compiler framework

The Stack

  • Node.js
  • CoffeeScript
  • jQuery/underscore/Backbone
  • PhantomJS
  • Bootstrap

CoffeeScript in 10 minutes

  • JSON/objects
  • functions
  • @/this

The environment

  • Framework (Yeoman, etc) vs diy
  • Cakefiles - classic build environment with separate source, output
  • Server-side

What is better?

  • declarative syntax - less comments, still clear
  • Great simplified versions of common JS patterns
  • Class definitions
  • Functions are free
  • Rewarded for making nice code

What's the catch?

  • More complicated environment
  • Write/debug different languages
  • Need to know JS pretty well (especially @)
  • long-term maintainability - dev tools don't offer much support

Everything else is the same (JS vs CS)

  • JS OO limitations
  • difficult to find mature libraries - cobble them together or swallow the pill
  • browser incompatibilities
  • performance/experience not as good as native apps

Resources

  • [get these]

Unit Testing

Essential for maintainable dynamic code

  • pay back some of the time savings

tdd to the point practical

  • works for well-defined requirements
  • more difficult for exploratory code
  • don't be lazy and never get back to it

good tests

  • simple - test one thing, minimize dependencies
  • assume nothing for expectations
  • need to watch it fail

complications

  • external dependencies
  • async code

options

  • jasmine
  • [others]

declarative tests

some examples

  • setup/teardown
  • sinon for server response

async gotchas

  • waitsfor/runs
  • ensure path is followed

About

CoffeeScript talk for FCIP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors