views:

486

answers:

10

I don't want this question to be too debatable.

I've just finished my 2nd year of studying and kind of missed my chance to study functional programming (Haskell), and am wondering whether it really is worth spending large part of summer studying it or not. I will be working on a project over the summer that involves learning javascript and xul. I know that javascript isn't really challenging, but I have to learn it, unlike Haskell :/ , in order to accomplish the project.

I am a little bit worried that my knowledge, understanding and memory of lambda calculus may shrink over the summer and this would largely affect my ability to learn Haskell. But as a professional developers would you really say that there are some real benefits of knowing functional programming? Would it be better to learn it asap or should I get more experience with other languages like c, java and the ones I mentioned earlier first?

+6  A: 

Short answer: all languages and programming techniques are useful to a computer scientist. The problem is finding time for them. And, yes, functional programming is a different way of looking for a solution to a given problem so it is a good methodology to learn.

Frankly, this doesn't sound like a problem. If you want to learn Haskell, do it.

Bob Cross
+1  A: 

Functional programming is extraordinarily powerful, and is prevalent in many languages.

How do you expect to learn and use JavaScript without it? JavaScript is a very fine functional programming language.

Justice
I don't agree with javascript being fine functional programming language in the same sense Haskell is. I don't think it's even close to it in terms of how you program in it.
Artur
JavaScript data structures (prototypal objects) are very different from Haskell data structures (HM / System F variant). JavaScript expressions are eagerly evaluated (like ML), while Haskell expressions are lazily evaluated. However, JavaScript is fully capable of creating lexical closures and of passing them to functions and returning them from functions, which gives it the full power of a strictly evaluated non-System-F functional programming language.
Justice
If that's how you see functional programming language then you'd probably name C and/or Java functional language as well. There is great description of what functional programming language is on wikipedia.
Artur
C and Java suffer from lack of closures. JavaScript and C# have closures.
Justice
I agree with Justice here. Making the most of Javascript's prototype-based OO really requires a good understanding of some aspects of functional programming.
ephemient
+1  A: 

What you learn studying functional programming will stay with you your whole career. It's good to get experience with other languages too as they will likely what you will be encountering when you enter the job market. But overall, functional programming is well worth your time. Here's a great paper on FP that talks about that (and many other) subjects.

JP Alioto
Blog posts are papers now?
ShreevatsaR
Man, have you read that thing? That's some blog post! :)
JP Alioto
A: 

Aside from the fact that learning function programming is generally useful, I found it particularly useful when (years later) learning Python (which uses some concepts from Haskell), Javascript (where functions are first class objects) and XSLT (which is applicative in nature).

Kathy Van Stone
+1  A: 

lambda is coming into C++0x

bobobobo
A: 

I would certainly recommend learning a functional language; much like a spoken language, software engineers tend to think and code in terms of the features, idioms, and limitations of a language. Learning a new language not only improves your overall skillset, but also can improve your competency in your other languages. In a lot of my modern c++ code, I program in a very functional style (using boost::bind) because of working with languages like lisp and ocaml.

Todd Gardner
+5  A: 

Learning a functional language is super useful, even if you rarely use a pure functional language. You'll learn to love map and reduce variants in any language that provides them; it's shaped my Python programming in a big way.

ojrac
+2  A: 

You should learn things that stretch your knowledge. Javascript is easy to pick up, which means that it's not teaching you much. You already know that Haskell has difficult stuff in it, and that learning it will be a struggle. So of course you should try to learn it. Find a book, or a tutorial and learn it in your spare time if your university doesn't have a course.

Paul Hankin
+5  A: 

Haskell is truly a joy to program in, with one caveat: you have to get good at it.

Unlike the type systems of most languages, I feel like Haskell's type system actually helps me program... not just show that my program doesn't make errors, but it helps me reason about what my program does. You can carry that knowledge into other languages... in other languages, it's more tempting to just get the right answer and avoid understanding the problem.

Dietrich Epp
A: 

Yes, functional programming is a good way to think about some programming problems and a language that supports functional programming will help you write better code when addressing those problems. But if you switch to using a functional language then you lose the strengths that other languages have.

Rather than spend time learning a functional language, it would be better to switch to a language like Python which supports functional programming constructs, some built-in to the standard library, and some available as add-on modules, such as this one. But at the same time you still have all the power of object oriented programming available to you.

Have a look through this Introduction to Functional Programming in Python article and follow that up by reading the articles by David Mertz on IBM's website which is referenced in the other resources section. I think this is a better way for a working programmer to learn about functional programming. Even if you decide that the functional approach isn't much use to you, you will still be able to get some value out of Python, either as an embedded scripting language in your applications, or as a tool for building web applications.

Michael Dillon