Slide 1

Slide 1 text

Tips & tricks for bug assassination DEBUGGING EMBER.

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

■ Debugging JavaScript ■ Debugging Ember ■ Help Us Help You DEBUGGING EMBER.

Slide 4

Slide 4 text

■ Web Inspector ■ JSHint ■ Demo Tips & tricks for debugging JavaScript on the web. DEBUGGING JAVASCRIPT.

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

THE MOST IMPORTANT TOOL IN YOUR TOOLBOX.

Slide 7

Slide 7 text

■ Console ■ File navigation ■ Breakpoints ■ Execution control TOOLS.

Slide 8

Slide 8 text

Console Navigation Breakpoints Execution Control

Slide 9

Slide 9 text

console.log("hello, world!"); CONSOLE.

Slide 10

Slide 10 text

CONSOLE. Console Output

Slide 11

Slide 11 text

■ Break on Exception ■ Breakpoints ■ debugger; PAUSING EXECUTION.

Slide 12

Slide 12 text

BREAK ON EXCEPTION. Don’t Break (grey)

Slide 13

Slide 13 text

BREAK ON EXCEPTION. Break on Exception (blue)

Slide 14

Slide 14 text

BREAK ON EXCEPTION. Break on Uncaught Exception (purple)

Slide 15

Slide 15 text

BREAKPOINTS. Breakpoint (click to set) All Breakpoints

Slide 16

Slide 16 text

// Why is this kicking // puppies?! if (shouldntBePossible) { this.kickPuppies(); } DEBUGGER STATEMENT. debugger;

Slide 17

Slide 17 text

PAUSED EXECUTION.

Slide 18

Slide 18 text

CALL STACK.

Slide 19

Slide 19 text

STEP INTO STEP OVER STEP OUT

Slide 20

Slide 20 text

EXAM APP STATE.

Slide 21

Slide 21 text

JSHINT.

Slide 22

Slide 22 text

DEMO

Slide 23

Slide 23 text

■ Namespaces ■ Don’t fear the stack trace ■ Understanding common errors ■ Logging ■ Advanced debug-foo Tips & tricks speci c to Ember.js apps. DEBUGGING EMBER.JS

Slide 24

Slide 24 text

>> Core = Ember.Namespace.create(); >> Core.Person = Ember.Person.extend(); >> Core.Person.toString(); => Core.Person >> Core.Person.create().toString(); => NAMESPACES.

Slide 25

Slide 25 text

UNDERSTAND STACK TRACES.

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

IDENTIFY FRAMEWORK CODE AND APP CODE.

Slide 28

Slide 28 text

THE ERROR IS OFTEN IN YOUR APP CODE— IF YOU GO UP FAR ENOUGH.

Slide 29

Slide 29 text

LOGGING.

Slide 30

Slide 30 text

Ember.LOG_BINDINGS = true; LOG BINDINGS SYNC.

Slide 31

Slide 31 text

stateManager.LOG_STATE_TRANSITIONS = true; LOG STATE MANAGERS

Slide 32

Slide 32 text

person = Ember.Object.create({ name: "Tom" }); OVERRIDE PROPERTIES.

Slide 33

Slide 33 text

person = Ember.Object.create({ name: function() { // Break whenever name is // get or set. debugger; }.property() }); OVERRIDE PROPERTIES.

Slide 34

Slide 34 text

Ember.View.reopen({ $: function() { debugger; return this._super.apply(this, arguments); } }); MONKEYPATCH CLASSES.

Slide 35

Slide 35 text

WINDOW.BILLY

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

THEY TOLD ME I COULD BE ANYTHING

Slide 38

Slide 38 text

Ember.View.reopen({ $: function() { if (window.billy) { debugger; } return this._super.apply(this, arguments); } }); WINDOW.BILLY

Slide 39

Slide 39 text

ACCESSING VIEWS.

Slide 40

Slide 40 text

ACCESSING VIEWS.

Slide 41

Slide 41 text

DEBUGGING HANDLEBARS.

Slide 42

Slide 42 text

{{DEBUGGER}}

Slide 43

Slide 43 text

{{LOG FOO}}

Slide 44

Slide 44 text

DEMO

Slide 45

Slide 45 text

■ Creating reduced test cases with jsFiddle ■ Running and writing unit tests ■ Better asserts Making Ember.js easier for you and others. HELP US HELP YOU

Slide 46

Slide 46 text

DEMO

Slide 47

Slide 47 text

QUESTIONS? @TOMDALE EMBERJS.COM