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

As I get older, I realize that the functional/imperative debate is far from over. To say that functional code is "more intuitive" is not only off the point but, I would argue, wrong.

Here's a reddit post I wrote about it a few months ago: http://www.reddit.com/r/programming/comments/14hhwa/program_...

Imperative code is much more intuitive in the small. That's why we lose when we make side-by-side code snippets of small toy programs and call it a case for FP. The 25-line imperative method is often more intuitive than the highly-dense 6-line functional one. The problem is that imperative code composes very poorly.



>Imperative code is much more intuitive in the small.

In a single threaded, deterministic environment yes. But when you're talking multithreaded, I'd disagree.

    if (user != null)
        user.company = getCompanyByName("google")
being a NPE waiting to happen (in a multithreaded environment) is certainly non-intuitive.


> The 25-line imperative method is often more intuitive than the highly-dense 6-line functional one.

The 25-line functional program will typically include a 6-line imperative one (with all that imperative code in one place if it's Haskell).




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

Search: