I have a situation where most people in my group come from an object oriented programming background with little to no understanding of functional programming. Not even basics like closures.

Any suggestions about what might be a good way to introduce them to functional coding style? A lot of coding that we do can be shortened if we do the functional way for our specific cases.

I have already given couple of presentations about functional and coding paradigms. Unfortunately we don't use a proper functional programming language like Haskell (basically legacy code is in C, C++, Java) so we have to do whatever is there with these.

  • 11
    Before asking how, ask why. Are you working on problems that can be more easily solved in a functional style than an object-oriented style? OO works really well for a lot of things (that's why it's been so successful) and not so well for others. From your question, it makes it just sorta sound like "I want to do our code in functional style just because I think functional programming is cool, even if we don't have a language that supports it and the team doesn't know how to do it!" That's a very bad idea. Remember, the right tool for the right job. Apr 18, 2012 at 17:05
  • 2
    @MasonWheeler: I know why we need functional. Not into cool language of the month thing. Too old for that.
    – Fanatic23
    Apr 18, 2012 at 17:10
  • 1
    Let's assume someone knows Haskell, could you get it to work in your system?
    – JeffO
    Apr 18, 2012 at 17:37
  • 4
    Its looks like functional programming is solving a problem your team has not got. They know how to code C,C++ Java which are not natural candidates for functional programming (implementing closures is plain horrible in these languages). Apr 19, 2012 at 1:32

7 Answers 7


Do your colleagues code outside of work?

Considering that you don't do any FP at your company, then getting anyone to learn a new language/paradigm when they don't do anything outside of their direct work tasks will be next to impossible.

If they do, then find interesting projects that they'll like that are related to functional programming and show them. You're not in a position to mandate a change, so you'll have to sow the seeds if interest on a personal level. This is how I was introduced to it - granted, by my best friend who happens to work with me.

Outside of that, most people write in-house tools to make small tasks easier. Try to write some of them in a functional language. Anyone who wants to see the code will be exposed to the (hopefully/possibly) beauty of the code and will likely ask you about it when they do. That is an opportunity to sell the idea.

Remember, there are functional languages that will work on your stack (scala/closure both run on the JVM). It's not "purely functional" like Haskell is, but it's a good start on a long journey.

If you have any control over hiring, hire people who have some functional experience (or are at least interested in functional programming).

And finally... you might be at the wrong company if you're that passionate about writing functional code. You're not going to change the way your entire company writes software - especially if they're making money and even more especially not in any reasonably short amount of time.

This is all about selling it to the devs... management is a whole other beast entirely.


Luca Bolognese made this fantastic presentation where he introduces functional programming (to present F#) using a coffee example which is really great and helped me a lot to introduce Functional Programming to friends and colleagues.

You can also look a Real World Functional Programming by Petricek which is an excellent way to start thinking functionally in my opinion.

  • that presentation is fantastic.. especially since it's given by a vampire!! LOL!! j/k.. the guys got charisma..
    – hanzolo
    Apr 18, 2012 at 18:13

Switching from imperative to pure functional programming is a big change with a steep learning curve. I would suggest to try a less rapid transition, and in that case you have many options. For example Python supports list comprehensions and generator expressions, Ruby supports higher-order functions through code blocks, etc. Since you mentioned Java, if all of you have a Java background and you want full functional programming support, you can try Scala.


Hire (or get the boss to hire) a functional programmer

Eventually, this is going ot rub off on the rest of your team.

Also, as stated before, encouraging them to write code in a functional language during their off-time wouldn't hurt either.


If functional programming is really going to make life much easier in your cases, then I suggest isolating one such case, and demonstrating equivalent implementations in both OO and functional languages to your colleagues.

If the difference in complexity is as wide as you say, then this should speak for itself.


+1 to faif for mentioning Scala: this started as a comment on that answer but got too big...

I wanted to learn something about functional programming (coming from C/C++, some Python & rusty Java); I tried diving in at the deep end with Ocaml and then Haskell and Just Didn't Get It. Then I tried Scala and found it let me start using functional things in a comfortable OOP/Java-ey environment where I could easily fall back to familiar imperative style when a functional approach eluded me. Some might complain the "multiparadigm", "hybrid" nature of the language means you're never forced to stretch yourself to go "pure functional", but I'd say it does mean you can be pragmatic about things and know you'll be able to get real stuff done easily somehow when you need to.

A couple of years on (and 200+ Project Euler Scala solutions in Scala later) the encounter with functional has definitely influenced my Python (much more use of map, filter, reduce, lambdas, itertools, list comprehensions and passing functions around than I'd ever contemplated before) and to a lesser extent C++: maybe a bit more attempt to use STL's functional trappings, but the main impact is I'm a lot more comfortable using TBB's map/reduce constructs and really like how exploiting immutability can tame complexity in multithreaded code.

So personally, if I was you, I'd be making a case for introducing Scala into some of your Java-world development, preferably by showing some examples of it enormously simplifying something and producing the benefits you claim. What happens next is down to the whole business of "championing" new ideas and driving change... which sounds like it may be a much bigger problem.

  • 1
    @timeday Very well said. I'm a Java/OO guys. I picked up Scala a year ago. And it's been quite challenging for me to learn FP. I am doing a bit at a time and sitting with it. I am not trying to get it all at once. Apr 19, 2012 at 15:20

I would like to recommend a gradual approach using Scala. And I would recommend starting with Scala's creator's book, "Programming in Scala, 2nd Edition". This book is FANTASTIC at slowly introducing one to (FP) Functional Programming using Scala. And in showing the move towards FP, it doesn't reject OO. In fact, it leverages it. I am making my second pass through it now.

Basically, Scala allows one to do Java/OO "without semicolons". And then one can try out a bit of FP without having to go whole hog. For example, in training myself to do FP, I typically will focus on referential transparency at the class method level, but let my methods have however many var-s, mutability and imperative-ness as is needed for me to do a first pass at an implementation. Then, I focus on slowly reworking each method to move it towards pure FP. And I also use the sister site to StackOverflow, CodeReview, to get help with my mental/thinking transition. Here's an example of a recent post I made doing this very thing.

Anyway, best of luck on your FP journey. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.