Debug Repl — debugging clojure code
Lets first make sure we need a debugging tool. I for one believe (addicted) to test driven development. I should not say believe, in fact my mind works better when I write tests. Writing tests force to me to think all different scenarios code could be executed and what should be the outcome. So I have good test coverage and it is easy to debug my code when a test fail. As I will know exactly where the problem is. But when I am running my code in context of some environment it is difficult to find issues. That is when I use poor man’s debugging tool (yes I am talking about println) and try to find what is causing issue. So there is a need for a debugging tool …
My friend and colleague George introduced to me to debug-repl. In fact he wrote it. It is so simple to use. Include
(use 'alex-and-georges.debug-repl)
and put
(debug-repl)
where you want debug repl to start. When you run code, debug repl will stop the execution of code and will start a repl. Now you are free to see what values are set etc.
Check it out …
You can find debug repl at http://github.com/GeorgeJahad/debug-repl
Happy debugging … (but write tests … no excuses)
