2

Possible Duplicate:
Why isn't functional programming more popular in the industry? Does it catch on now?

I've been working as a J2EE developer for the past 3 years and wanted to learn something different, so I started learning about functional programming by going through lots of articles and books (SICP, Paul Graham's essays and other such articles).

I really like the concepts and elegance, but the thing that bothers me is if it's so good why isn't it catching up in the enterprise space? If some of the best people in the software industry (Paul Graham, Peter Norvig) recommend learning it, why aren't enterprises listening them? Several researchers have spent huge amounts of time doing research on FP but it doesn't seem to materialize. I am new to FP so please pardon me if my concerns are naive.

nrb
  • 181
  • 2
  • 5

2 Answers2

2

The hardest thing about functional programming is using it. Most of us have been using imperative programming since - well, forever - and FP might be really a hard thing to wrap your head around if you are used to imperative programming.

All imperative languages basically work the same way. To learn a new programming language it's usually a matter of learning the syntax and its built-in libraries. Given a problem, you'll probably already have a way of approaching it, it's just a matter of working out the syntax and minor kinks.

This is not the case with FP. This is nothing like the shift to OOP. Good programmers who didn't know OOP were likely using many OOP concepts already. FP on the other hand is a whole new way to program. Trying to implement relatively simple algorithms requires a new approach. Statelessness can be a bit of b@#%!.

However, multithreaded processors are becoming practically ubiquitous, and thread safety is still a very hard thing to "get it right." FP can gain some ground here with its statelessness, which allows you to be more carefree about thread safety and concurrency.

In short, I'd say the first line of resistance against FP is its difficulty for most programmers. Then, enterprises are usually wary of new and/or unproven technologies. With languages like Java, C and C++ firmly entrenched in the enterprise world, it takes a lot of time for anything new (or perceived to be new) to gain market.

Also, large existing codebases are not likely to be touched. You'd be surprised at how many people still use languages like FORTRAN and COBOL nowadays. Some times the decisions like to use a new language lies with managers that don't have a technical background. Good luck convincing them they should switch to a language most people aren't comfortable with (ie: will likely cost them).

NullUserException
  • 840
  • 1
  • 6
  • 15
  • well if something has benefits (as all say) then people just start using it irrespective of it being difficult...but somehow people arent using it.. – nrb Sep 30 '11 at 13:33
  • 2
    @nrb That's easy for you to say, but have you tried using FP? Imagine writing an entire enterprise-level app with that. Also, large code bases die hard. You'd be surprised at how much languages like FORTRAN and COBOL are still being used. – NullUserException Sep 30 '11 at 13:35
  • yes i have tried it ..i think if people can learn C C++ Java and hell lot of other languages then why not this if its considered to be so great.. – nrb Sep 30 '11 at 13:37
  • @nrb Have you tried implementing a real application with it? About C/C++/Java - as I said, once you know one of these languages, you'll know all of them. It's just a matter of learning syntax. – NullUserException Sep 30 '11 at 13:39
2

Disclaimer: I love FP. I do it in all programming languages to the extent possible. So this is not a putdown, it's the sad reality I'm fighting all the time:

From a business perspective it's a huge risk: it's not what everyone else is doing. You have a less numerous and competitive talent pool, able to drive wages high. The benefits in common programming scenarios (anything but big data, really) are not regarded as business value (elegant, readable, maintainable code) even when they should be.

Szocske
  • 251
  • 1
  • 4