4 ms·
> Well-structured software is easy to write and to debug I agree that functional programming makes software easy to write (it’s easy to reason about pure funct
by cbeach 2y ago
> Well-structured software is easy to write and to debug
I agree that functional programming makes software easy to write (it’s easy to reason about pure functions). However, having spent a decade writing and supporting Scala apps in the wild, I disagree with the notion that FP makes software easier to debug.
Perhaps this is a reflection on the way FP has been shoe-horned onto the JVM, but too many of my stack traces contain deeply nested calls to anonymous functions, and the semantics of the original program are almost completely buried in noise. This gets a lot worse when you start working with heavy framework code.
When writing code, I love Scala’s succinctness and expressiveness. When debugging, I miss the simplicity of stack-friendly imperative code.
- tadfisher 2y agoIt's not much better in Haskell; while you can coerce GHC into printing a stack trace, you'll need some knowledge of how the language is evaluated in order to understand it. I think the mapping of imperative "stack frames" to functional code is leaky when there's a runtime sitting in between. Traces should be done in the runtime, however it makes sense to display them.