Imagine you’ve received a bug report from your favourite app. It happened on a complex system and you wouldn’t actually know what each part is doing. In this case, the first defense is trying to reproduce it with enabled DevTools. Either you know how to fix it immediately or you waste a lot of time with solving it without success. Have you ever experienced one of these bugs? Trying to fix them for hours without any result? It sucks and simply wastes too much precious time.
This talk is going to dive deep into advanced debugging JavaScript apps. We talk about the most powerful strategies and less known techniques in order to be more effective in fixing THE problem.
Debugging War Stories & Strategies to Survive on RejectJS 2014
1. Image by - en.wikipedia.org/wiki/Monster_Bug_Wars
2. Image by - en.wikipedia.org/wiki/Monster_Bug_Wars
3.
4.
5. define(['./module'], function (module) {!
'use strict';!
/* global google */!
!
/**!
* @ngdoc service!
* @name GoogleService!
* @description!
* Wraps the global Google Map instance!
*/!
module.factory('GoogleService', function () {!
!
if (typeof google !== 'object') {!
throw 'google map vendor is not defined.';!
}!
!
return google;!
});!
});!
8. <body ng-cloak>!
!
<ui-view></ui-view>!
!
<script type="text/javascript" src="https://maps.googleapis.com/…"></script>!
<script type="text/javascript" data-main="js/main" src="…/require.js"></script>!
</body>!
The solution: <ui-view></ui-view>
(just close the Tag in order to work with AngularJS)
30. Image by - sodancapassion.blogspot.de/2012_05_01_archive.html
31. Use debugging for pay
interest on your
knowledge
Image by - www.steffen-haschler.de/2013-14-ei-7a-physik.html
32. Complex systems are more handsome
Image (c) by Charles Rincheval - goo.gl/ouhFoM
when working together on it.
Train by Pair Programming, Coding DoJos
40. Debug Utils
// Attach an event handler that starts debugger when trigerred.!
$duv(object, 'eventName'); !
!
// Debug when something tries to get at a property of an object.!
$dug(object, 'property');!
!
// Debug when something tries to set a property on an object.!
$dus(object, 'property');!
!
// Wraps an object's method with a wrapper function with a debugger statement.!
$dum(object, 'method');!
https://github.com/amasad/debug_utils
41. Yet another LiveReload: fb-flo
Modify running apps without reloading
facebook.github.io/fb-flo/