2024-11-20 π programmerhumor β RE: eldavi
Iβve noticed that debugging tends to be more important in imperative languages than functional ones. With imperative style, you have a lot of implicit state that you need to know to figure out what actually happened. So, you end up having to go through the steps of building that state up before you can start figuring out what went wrong. On the other hand, the state is passed around explicitly with the functional paradigm, and you can typically figure out the problem by looking at the exact spot where the error occurred.
My typical debugging workflow with Clojure is to just read the stack trace, go to the last function in it, and then see what itβs doing wrong. Very rarely do I find the need to start digging deeper. I think another aspect of it is having an interactive development workflow. When youβre running code as youβre developing it, you see problems pop up as you go and you can fix them before you move to the next step. This way you donβt end up in situations where you wrote a whole bunch of code that you havenβt run, and now youβre not sure if it all works the way you expected.
2024-11-20 eldavi β edited β 1π¬
With imperative style, you have a lot of implicit state that you need to know to figure out what actually happened. So, you end up having to go through the steps of building that state up [β¦]
ββββ
ββββ