You may have heard of functional programming. Modern languages like Scala and Clojure made it a hot topic in software developer communities. But what is functional programming? Why would you want to use it? And what does Groovy provide to let you program functionally?
In this session I'm going to introduce you to the idea of a functional programming with a concrete example. We'll start with a an application solving a real-life problem and programmed in imperative (read "traditional") Groovy. We'll then transform it to a functional style making it shorter, more readable, extendable and better performing along the way. We'll then review the basic building blocks of functional programming such as immutable data, stateless functions free of side-effects, use of recursion, closures and higher-order functions, seeing how each concept is applicable in Groovy. We'll see how functional programming may contribute to application performance through parallel computations. And since no technology is ever perfect we'll discuss what could be the possible drawbacks of a functional style and which way to overcome them. I'll provide a set of patterns you can use to identify blocks of an imperative Groovy code as an immediate candidates for a conversion to a functional style. Finally, we're going to conclude the session with more examples from my own projects where a functional style was just the ideal thing to use.
By the end of this session you'll be able to see what functional programming is good for, why it is such an important part of today's computing world and what can you do next to climb aboard.