- console.log() which means you debug in your editor and add and remove debugging steps there
- watches which means you instruct the (browser) developer tools to log automatically when changes happen
- debugger; which means you debug in your editor but jump into the (browser) developer tools
- breakpoints which means you debug in your (browser) developer tools
The reason was that having worked with editors and developer tools in browsers, I was curious how much either are used. I also wanted to challenge my own impression of being a terrible developer for not using the great tools we have to the fullest. Frankly, I feel overwhelmed with the offerings and choices we have and I felt that I am pretty much set in my ways of developing.
Developer tools for the web have been going leaps and bounds in the last years and a lot of effort of browser makers goes into them. They are seen as a sign of how important the browser is. The overall impression is that when you get the inner circle of technically savvy people excited about your product, the others will follow. Furthermore, making it easier to build for your browser and giving developers insights as to what is going on should lead to better products running in your browser.
I love the offerings we have in browser developer tools these days, but I don’t quite find myself using all the functionality. Turns out, I am not alone:
The results of 3970 votes in my survey where overwhelmingly in favour of console.log() as a debugging mechanism.
Poll results: 67% console, 2% watches, 15% debugger and 16% breakpoints.
- As with any too simple poll about programming, a lot of them argued with the questioning and rightfully pointed out that people use a combination of all of them.
- There was also a lot of questioning why alert() wasn’t an option as this is even easier than console().
- There was quite some confusion about debugger; – seems it isn’t that common
- There was only a small amount of trolling – thanks.
- There was also quite a few mentions of how tests and test driven development makes debugging unimportant.