3 ms·
It depends on what you're doing. I find console statements helpful when testing out a new function that you don't necessarily expect to misbehave so I check the
by etler 3y ago
It depends on what you're doing. I find console statements helpful when testing out a new function that you don't necessarily expect to misbehave so I check the internal state is correct without having to stop the code.
Debuggers provide much more information, but stopping and stepping through the code is much more time intensive than printing out variables at various points and running the function and doing a quick double check that they're correct.
It also allows you to check the state of the program earlier for problems that may only emerge after the fact. Instead of having to stop what I'm doing and retry and step through with the debugger, I can just look back at the log and see what went wrong where.
I think both debug logs and debuggers have valuable use cases.
- tincholio 3y agoTracing debuggers give you the best of both worlds. I've recently started using Flow-storm [0], by @jpmonettas), and it's been quite transformative. You can still easily see the values flowing through your system (better than just "prints"), and it can handle multi-threaded / async scenarios quite nicely. You don't need to manually step through code, you can just "see" your data flow, and when you have loops or some other form of iteration, you can see the data for each pass. Coupling this with a good data visualization tool (such as Portal [1]) really feels like magic. I've been doing Clojure for quite a few years now, and was very happy with my plain REPL-driven workflow, but this is way better. [0] https://github.com/jpmonettas/flow-storm-debugger https://github.com/jpmonettas/flow-storm-debugger [1] https://github.com/djblue/portal https://github.com/djblue/portal
- etler 3y agoThat sounds like a really cool idea! Thanks for letting me know it exists
- jabradoodle 3y agoAwesome tools. Personally I can't imagine coding in clojure without scope capture https://github.com/vvvvalvalval/scope-capture https://github.com/vvvvalvalval/scope-capture