Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One problem I have with functional programming is that I find it hard to debug.

With imperative programming you can follow a program step by step, line by line, it can be done with a debugger, pen and paper, or in your head.

With functional programming, not so much. It runs functions. What do these functions do? Don't know, they are pieced up from someplace else in the code. And thanks to lazy evaluation, they may not even exist. In the design phase, it is mostly a good thing, as it is flexible, and pure functions are less likely to make a mess than functions with side effects, but there will be a point where the program will not behave as it should, no matter your paradigm. And that's when it becomes a problem.

It is also a problem with object programming if you abuse abstraction, in fact, it is a general problem with abstraction, but functional programming makes it the default, whereas imperative programming is concrete by default.

As for the Python example, I am a bit surprised that the optimizer didn't catch it, all three are common and equivalent constructs that could have been replaced by the most performant implementation, presumably the third one. But well, optimizers are complicated.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: