

Ask HN: How do I become an expert JavaScript and Python debugger? - andrewstuart

I spend so much time debugging.  If I can become super fast and effective at debugging then I&#x27;ll get MUCH more done.<p>What are your best tips for becoming a more effective debugger in JavaScript and Python?
======
lollipop25
For JS:

\- Learn how to use a certain debugger religiously. Know its features from the
inside out. For instance, I consider myself good enough to wield the Chrome
Dev tools to the point that I can debug anything with it.

\- Know different debugging techniques like the different ways to pause and
inspect code. Know how to add breakpoints, break on exceptions, inject
debugger statements in code and dynamically. How to read the stack traces and
watch variables.

\- Know your error messages. It's faster if you know how they're caused,
rather than having to spend 5 mins on Google to know what caused it.

\- If you're spearheading a project, choosing a good architecture could help.
For instance, I have favored Flux over MVC because it pins down mutations to a
single place - your stores. So if you can log actions and their payload, and
the state of the store before and after mutation, then that could really help
you debug the app.

\- Know JavaScript. The language itself is your greatest tool.

~~~
trialstartup
Cool.

------
mc_hammer
some things that help:

\- integrate a good repl to your workflow, maybe lighttable? and build a
logger that matches your needs

\- maybe a scratchpad/playground app like jsfiddle or hsandbox can help also
(idk)

\- learn to code golf, writing unnecessary lines of code wastes time

\- for learning: go back and optimize something once a week, or optimize other
peoples code for fun. especially render pipelines, or bottlenecks identified
by profiling, pretty good learning experience for me.

\- for learning: maybe idle in irc and answer peoples questions

\- i tend to keep a warehouse folder or txt file of code snippets that help me
debug the current project im working on. expiriments, testbeds, helper
functions, whatever

\- alternatively you can build your own debug.py over time for each project,
adding a test/helper function when you use it, then you wont have to write it
next time.

\- invest in a good dual 20-24" monitor setup, this way you can have docs
open, shell open, dev tools open, and still 2-3 code windows open.

anyway thats my idea, gl :)

