4 ms·
Functional language advocates have been making these kinds of claims for years but I don't think they have yet produced any hard evidence that languages like Ha
by cageface 17y ago
Functional language advocates have been making these kinds of claims for years but I don't think they have yet produced any hard evidence that languages like Haskell actually do increase programmer productivity in typical real-world scenarios. It may be that they do but I wouldn't be surprised if we find that the kinds of errors they minimize aren't the kind that often impede development in practice and that the strictures of FP languages, particularly lazy ones, make some common programming tasks significantly more difficult.
People also like to claim that functional languages are particularly well suited for concurrent programming, but, as Simon Peyton Jones has himself said, just getting rid of mutable state doesn't automatically make your code parallelizable.
People used to hold up Darcs as a Haskell success story but as far as I can tell people have hacked together DVCS systems in "inferior" languages like C and Python that are at least as robust and featureful.
- dons 17y agoI believe in advoacy by doing things, and yes, arguments without dollar figures attached are less convincing. Studies on programmer productivity are rare, but a different argument might be found in where Haskell (for example) is used when correctness matters. For example, in hydraulic control of vehicles at Eaton, or secure cryptographic algorithms at Galois. Python isn't going to fly when you need to convince people of correctness, while Haskell (for example) does have tools and approaches that work. I wrote a post last year on the collective experiences of engineers at Galois after using Haskell for the past decade, which has some nice anecdotes, http://www.galois.com/blog/2009/04/27/engineering-large-projects-in-haskell-a-decade-of-fp-at-galois/ http://www.galois.com/blog/2009/04/27/engineering-large-proj... The other data point is the way finance has jumped on functional programming -- often because they can see a (huge) dollar figure in (small?) improvements in productivity or correctness. Jane Street, Barclay's, Credit Suisse, ABN Amro, Standard Chartered, JP Morgan and others (http://cufp.org http://cufp.org) don't use FP because it is a fad.
- cageface 17y agoThe correctness argument is interesting, but certainly plenty of critical-to-be-correct software has been written in imperative languages too. I'd like to see something closer to hard numbers on bug counts, man hours etc on similar projects in Haskell or ML vs C++ or Java, for instance. I realize it's hard to find a truly apples to apples comparison here. The uptake of FP in finance is interesting. I'd like to hear more about exactly how FP is being used in these contexts. Is it used in a narrow, specialized domain or broadly? To what extent are the advantages of FP in this domain realizable in others? Is FP only suitable for small, elite teams or can mainstream programmers pick it up with the right training? To what extent does the less mature or less conventional toolchain offset the advantages of the language itself?
- dons 17y agoCheck the experience reports from CUFP for such examples: * http://haskell.org/haskellwiki/Haskell_in_industry#Haskell_in_Industry http://haskell.org/haskellwiki/Haskell_in_industry#Haskell_i... Barclay's Capital has written a journal article on why they use FP (Haskell in this case): http://lambda-the-ultimate.org/node/3331 http://lambda-the-ultimate.org/node/3331
- cageface 17y agoThanks for the links. Looks like some good afternoon reading. It's interesting that the Barclay's article discourages overuse of the point-free style. In my attempts at learning Haskell I've also found heavy use of this style can make Haskell code hard to understand.
- jrockway 17y agoFP is also catching on at BAML; we have a bit of production Haskell, and are starting to hire Scala developers instead of Java developers for new projects. (Java developers are too hard to find. Never thought I'd be saying that...) Of course, most of the code that actually makes us money is Excel spreadsheets :)
- dons 17y agoGreat to know! You should add a small entry to http://haskell.org/haskellwiki/Haskell_in_industry#Haskell_in_Industry http://haskell.org/haskellwiki/Haskell_in_industry#Haskell_i... ...
- jrockway 17y agoI use Haskell for financial ETL processes. What I've found is that the upfront development time is about the same as using Perl, but debugging time is much less. Once my process starts running, it runs to completion. It never dies in the middle with "can't call method foo on undefined value" as is pretty common in Perl. It starts running, and it finishes running... always. Haskell is also nice because I occasionally have to interact with poorly-written third-party C/C++ libraries. The FFI works fine with ghci, so I can play with their functions interactively and learn about the bugs without having to write a lot of code. And, when it comes time to write the application, I can use Haskell's type system to make sure I don't get the library into a state where it starts messing things up. It's nice to hack for a few hours, have the compiler find a few type mistakes, and then have the process run and produce the correct result. Much better than type, run, wait, fix error, run, wait, fix error, ... I don't know about "everyone", but Haskell has sure saved me a lot of time; in both waiting for programs to run (Perl is slow), and in waiting for me to get all the bugs worked out. I also really like Haddock. I never liked generated documenetation until I started using Haddock. I'm not really sure why, but I never bother doing "perldoc MyCode.pm" on my own code... but with Haddock, I always have my own docs open in a nearby web browser. I also like the syntax for in-code annotation. It's lightweight, easy, and the output is great!
- ghotli 17y agoI'd be interested to see a skeleton of your Haskell ETL scripts. I've been looking to clojure to clean up my current processes and I sure would like to see how you approach it in haskell.
- jrockway 17y agoNothing special. Everything happens in some instance of MonadError and MonadState; error for aborting when there is some problem, and state for logging. (Why not writer for logging? After a week of playing with various levels of strictness over Writer, with the help of #haskell, I couldn't get any variant of writer to not use all my stack space. Dropping in State fixed the problem. I know why State fixed the problem, but I don't know why I couldn't make Writer strict enough. Oh well.) Unlike with most logging, I don't really care to see the results as the process is running; the log is just a list of failed sanity checks that may indicate problems with the data. It just gets printed at the end, and I can check out the datasets that are suspicious when I feel like it. Thanks to Catch and some wrappers I have that turn IO errors into Lefts, I know that my process isn't going to die halfway through. My only worry is possible data corruption because some assumption is violated, so if I see anything weird, I make a note and continue. If something is clearly wrong, then that dataset is Left instead of Right, and is skipped. I also have a function that downgrades Lefts to Right + a warning, so I can have a few failures in the ETL run and worry about those after the non-error sets are processed. The actual scripts just read config data from a file or the command-line, and run some function that actually does the work. These are named something like theFooProcess/Main.hs, and are built into executables like "theFooProcess.exe" with Cabal. (I also build the library code as a separate Cabal target, but I don't have any projects that refer to each other yet, so this really just wastes my time during compilation. Heh.) (Oh yeah, did I mention that my processes are all Windows-based because the third-party libraries are Windows-only? Yeah. But GHC handles it great! Emacs + ghci + cabal on Windows is exactly like Emacs + ghci + cabal on UNIX. With Haskell, Windows is not much of a problem... except for the security updates that reboot my machines in the middle of ETL runs :)
- viraptor 17y ago> I don't think they have yet produced any hard evidence that languages like Haskell actually do increase programmer productivity in typical real-world scenarios. I know of at least one such study: http://www.haskell.org/papers/NSWC/jfp.ps http://www.haskell.org/papers/NSWC/jfp.ps There might be more.