Hacker News new | ask | show | jobs
by tabtab 2063 days ago
I find declarative and functional (D/F) code is often difficult to debug. It's generally easier to break imperative code into fractal-like steps, sub-steps, sub-sub-steps etc. D/F just can't be dissected fractal-ish like that nearly as easy. It's just a magic property of imperative code that's hard to replicate in other paradigms. It's why imperative still dominates after 50+ years of D/F attempts.

Someone once said that D/F makes it easier to express what you intend, but imperative makes it easier to figure out what's actually happening. One improves writing, the other improves reading (or at least debugging).

2 comments

On the other hand, imperative code sometimes makes it very difficult to compare what is happening with what you want to happen (problem specification).
One can still break a larger function into smaller ones and use a debugger to see intermediate values.