Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Fight the Rot - Refactor stinky JavaScript

Fight the Rot - Refactor stinky JavaScript

Is you node.js application hard to maintain? Is your buglist growing while the list of deployable features shrinks? Is bad code slowing you down? Then the rot has taken over and you are probably afraid of touching your code.

I will show you how to start refactoring, when there are no tests around, no documentation exists, and architecture is hard to understand. Covering strategy, unit tests, documentation, measuring progress, tools, best practices and things to avoid.

damienklinnert

July 19, 2013
Tweet

More Decks by damienklinnert

Other Decks in Programming

Transcript

  1. a typical day? • Mr. Wheatley, owner of Copy+Paste Inc.,

    asks for a (simple) change in his web store • backstage passes should rise by 3 points in quality, if there are less than 6 days to event Donnerstag, 18. Juli 13
  2. refactoring is disciplined technique for restructuring an existing body of

    code, altering its internal structure without changing its external behavior Donnerstag, 18. Juli 13
  3. refactoring • break dependencies • bring system under tests •

    refactor • add feature • measure code quality Donnerstag, 18. Juli 13
  4. add tests • mocha, karma.js • instrument with istanbul, js-coverage

    • test current behavior, not expected Donnerstag, 18. Juli 13
  5. refactor • few good tools around for js • pair

    programming Donnerstag, 18. Juli 13
  6. clean code • everything is pretty much what you expect

    • documented • as if by one and the same author • following your style guide Donnerstag, 18. Juli 13
  7. bad code • detect with jsmeter • or jshint complexity

    settings • not linted • not tested • complex Donnerstag, 18. Juli 13