Learning the syntax of a new language is easy, but learning to think under a different paradigm is difficult. This practical guide from renowned software architect Neal Ford helps you transition from a Java-writing imperative programmer to a functional programmer, using Java, Clojure, and Scala as examples.
Rather than focus on specific language features, Functional Thinking looks at a variety of common practices in OOP languages and then shows you how to solve the same problems with a functional language. For instance, you know how to achieve code-reuse in Java via mechanisms such as inheritance and polymorphism. Code reuse is also possible in functional languages, using high-order functions, composition, and multi-methods.
Ford encourages you to value results over steps, so you can begin to think like a functional programmer. Expect your mind to be bent, but you’ll finish with a much better understanding of both the syntax and semantics of functional languages.
Neal Ford is Software Architect and Meme Wrangler at ThoughtWorks, a global IT consultancy with an exclusive focus on end-to-end software development and delivery. He is also the designer and developer of applications, instructional materials, magazine articles, courseware, video/DVD presentations, and author and/or editor of 5 books spanning a variety of technologies. He focuses on designing and building of large-scale enterprise applications. He is also an internationally acclaimed speaker, speaking at over 100 developer conferences worldwide, delivering more than 600 talks. Check out his web site at http://www.nealford.com. He welcomes feedback and can be reached at nford@thoughtworks.com.
Functional programming can often sound like magic, in its promises of greatly improved productivity and near guarantees of accuracy and expressiveness. But one problem is that the examples usually given are those in an unfamiliar form, using languages very different than the procedural and object oriented languages most of us are used to. And the advantages are not apparent when presented. What Ford does in Functional thinking is to present the advantages of functional programming within the context of an object oriented language that can support this, then move to more appropriate languages to show how the advantages can be more clear when the language supports it more directly. It does not stand alone, you will not learn functional programming from this book, but it does offer a more clear argument for why functional programming can useful and better in some circumstances.
The setting that I have seen functional programming explained and taught has always been in the context of demonstrating a functional programming language, such as a Lisp (Lisp, Scheme, Clojure). Or sometimes, a language that has some functional features (R, Python). But I always had to take the commentators word at why this was good. Ford using Java 8 (as it adds some functional features), Groovy, Scala, and Clojure provides a progression from functional features in an object-oriented language (Java), to functional features in multi-paradigm language (Groovy and Scala), to it look in a language that is clearly functional (Clojure). This provides a good look at its qualities by showing how these features improves upon an object-oriented solution, then how it is more expressive and closer to the problem when presented in the cleaner form (i.e. in Groovy, then Clojure). I probably would not have caught the lessons of this if this was my first exposure, and I stopped after the first chapter to watch one of Ford's talks on YouTube so I could get an overview of the book before I finished. But the reward is that it gives context for my learning of Clojure (and functional programming in general).
Not for learning a programming language, but for learning how to think about problems in new ways, enabled by functional programming.
Note: I received a free electronic copy of this for review as part of the O'Reilly Press Blogger program.
The book is largely not about functional programming specifically, and only JVM languages are covered: Java, Groovy, Scala, Clojure.
For a book subtitled "Paradigm over Syntax" it spent a *lot* of time explaining various syntaxes and at one memorable point literally explained a unit test example line-by-line.
Especially the latter half of the book becomes less about "functional programming" and more about "hey these JVM languages newer than Java 7 have some neat features". The author discusses value of "modern languages" that allow extensibility and metaprogramming, which, sure, but it's not functional programming.
There's some amusing moments. Despite stressing the value of language-provided utilities vs rolling your own, the author explains how to roll your own memoization in Scala (you know, the functional programming language) and explains how to avoid out-of-memory exceptions in Groovy (you're expected to specify the cache size to avoid those, apparently?). Seemed amusingly bad considering Python has had a one-line LRU cache decorator that Just Works since 2011.
Special mention goes to the hilariously unuseful Figure 6-3.
Relatively short introduction into basic concepts of functional programming for people who never heard about it. No theory & complex terms - everything explained in simple language with many examples, showing how to solve the same task with OOP & FP approaches. For examples, the Java 8, Scala, Groovy & Clojure are used.
While practical examples of theory can enhance understanding, this book takes the opposite tack: theoretical wisdom is drowned in a deluge of practical examples.
That said, if you’re a dyed-in-the-wool Java 7 developer, this book is for you. Plenty of useful refactoring and simplification opportunities are laid out in several different languages, including Scala, Groovy and Clojure.
I read the early release version, which contains some typos and is missing the finalized citations and images. And apparently missing some connective tissue as well, as the transitions between sections are a bit choppy.
Despite the book's length, it is essentially an overview, with the principles of functional programming condensed into a couple of chapters, giving examples of functional code and contrasting it with imperative or OO code.
I liked that the functional code examples were in a variety of languages, giving a glimpse of the variety available, and letting the reader translate into the language of his/her own choice. I disliked that all of the imperative code examples were in Java, which seems to be an awkward choice for imperative code, being so strictly OO.
A large chunk of the book was given to showing how to get functional languages to do OO sorts of things, and OO languages, specifically Java, to do functional things. On one level this makes sense, as you would want to have the widest variety of tools available in whatever language you choose to use. But on another it makes me feel uneasy, as if you're trying to get around the fact that you didn't choose the right language for the task in the first place.
I would recommend this book for programmers who grew up with Java, and know nothing else, as it will expose them to different ways of doing things. But more experienced programmers would be less likely to learn much from it.
… my second book from the Humble Functional Bundle. Much better than Becoming Functional.
I should preface a prejudice of mine: the JVM is a wasteland; the languages roaming it, all monsters, locked in brutish struggle for survival, bloated and grotesque assemblages of the dregs tossed over the walls preserving civilization.
In this book, several examples are worked through, from a variety of styles and in a variety of languages. "Functional" ends up mostly meaning immutability and map/reduce upon lazy streams. This isn't a bad thing— it's really all it could mean in world of Java.
The book concludes with a heavy dose of proselytizing DSLs and other upsells for the author. Java 8 and Scala are strongly pushed.
I'm not interested in using JVM languages which the book uses as main reference, but still there are some valuable insights which are language-agnostic. What I liked was the authors observation of how FP fits in the evolution of programming languages and programming styles in general and how it can be used to reduce complexity. I'm not sure I share the author's view about place of functional and imperative languages in software architectures and now and then there were some thoughts which were completely off (like language classification)
I found juggling examples in several different languages to be more work than it was worth, but as an intro, background, & argument in favor of functional programming, it nailed it.
How provocative can I be in a single introductory statement? 😉
A book I've been putting off and on in 2015-2017. During a short stint of writing Clojure, getting overhyped by functional programming, how great it is, how much brighter it makes you, etc. I can say that this is a load of intellectual compensation that doesn't even lead to good engineering outcomes. 😁
Functional programming has its place in the world, but it's not something that, to this date, I recommend anyone practice beyond a few small snippets. I've seen too much functional programming hype, failed projects, and poor engineering outcomes. Even the journey towards reaching these engineering outcomes is painful and a push towards proving an academic interest that has poor practical application in the real world. 🤔
To me, this is the least useful Neal Ford book, among many great ones that I enjoy and recommend to people. It seems like functional programming is a passion of his, which is not bad. I have a different life experience and that's fine. :))
I've been programming functionally (with Scala) for a year, and I'm currently looking for ways to expand my understanding of cathegory theory applied to programming. This book was not for me. If you're looking for something to show you how the same problem can be modeled functionally in Groovy, Scala, Clojure and Java, look no further. If you're a Java developer who got stuck in a pre-Java 8 project, and want to get up and running with Lambdas and Streams, you might find some value here, but there are probably many shorter and cheaper blog posts. However, if you're not, like me, you'll probably feel yourself drown in the lengthy code snippets, per-language explanations, and problem descriptions.
This was a mostly quick and digestible read with a nice overview of functional programming in the small.
The book spent less time than I was hoping talking about larger scale issues such as state management and the actual carrying out of effects when needed (eg, write to a database). At the end, I felt equipped to write small chunks of code in a functional style within an otherwise more mainstream paradigm, but not how to structure entire programs functionally.
Not bad introduction to some functional concepts and constructs but really should be called Functional Thinking for Java Programmers. It was useful though read concurrently with the Scala and Clojure chapters of Bruce Tate's Seven Languages in Seven Weeks. However, to get the most out of both, I ended up reading a book on Java as well.
I think there are better resouces for learning functional programming, but this book introduces some concepts that are interesting and worth thinking about, especially around reducing moving parts and preferring immutability as a default, not just within functions but throughout the entire technology stack.
Super basic intro into functional concepts, but didn't really cover anything super useful. I don't like the attempt to cover these concepts in so many languages as it created so many examples to parse which made the reading tedious. I would've loved more concepts of core ideas instead of just a description of common functional functions.
I read this book with interest and fully fulfilled my expectation. As standard Java programmer, I realize several facts about functional programming. Some of them I already heard but the context that they were put to in this book was really nice for me. I liked that examples were provided in several JVM languages - Groovy (I know the most), Scala, Closure (nice to see Lisp dialect in action) and Java at some places. Comparing ways how the same thing could be done in different languages was perfect.
From building blocks (operations as filter, map, reduce), closures, memoization, currying to thinking in functional way to design a thing, all was inspiratory for me.
A whirlwind tour of functional programming mainly intended for Java programmers. Almost every code example is written in Groovy, Scala & Clojure. Neatly illustrated functional programming concepts are contrasted to the imperative & OO style in Java. The book shows how most mainstream languages are getting more functional with time (LINQ, closure support, etc) and examples serve to reinforce the advantages of using functional programming in your language of choice.
The book is somewhat short and unsatisfying for someone expecting deeper & more advanced functional ideas. Already described concepts are re-hashed in later chapters without expanding to real-world scenarios. For someone familiar with function composition, Clojure multimethods, currying and such, this book offers little value, otherwise a good introduction book for programmers experienced in (only) OO and Java.
The most beneficial insight gained from the book is the observation how functional programming helps us bend the language towards problem domain contrasted with OO mindset where the programmers are lead to believe their job is to "translate" the domain knowledge in their programming language.
This is book is meant for Java programmers that do not have a lot of experience in functional languages. Which puts me right in the middle of the target audience. It shows how important functional concepts are implemented in different languages, such as Java 8, Scala, Clojure and Groovy. The advantage of this approach is that it does not force you to choose any one language. The disadvantage, however, is that some syntax is so hard to follow (I am looking at you, Clojure), that it obscures the point that is being made.
The author does make it clear that you will have to think differently to find functional solutions to your problems, if you are used to the object oriented way of thinking. Take design patterns, for example. I am so used to them I did not realise that some of these were invented to work around the limitations of object orientation.
The book is mercifully short, which is mostly a good thing. It is obviously intended to get you headed in the right direction, instead of being complete. The examples are also short, and theoretical. I would have preferred more code that is applicable to the real world.
While I can imagine this book to be useful for someone who's never heard about immutability, lambdas or higher-order functions like map/filter/fold/ etc., I fail to see any reason why would that person want to read about functional programming in the first place. All the concepts discussed there are already mainstream in nearly all modern programming languages, furthermore, there is a overwhelmingly big number of good introductions for this kind of stuff in the form of a blog posts. To sum up, this book lacks depth. Don't bother, unless you've never used anything but Java.
A very easy book on fundamentals and building blocks of functional programming. Nice to read if you're completely new to the field or want to be reminded of the basics. Book is very short—two evenings read–, and if you're looking to start writing functional code after reading it, you'd be a little disappointed. It's more of a small and clear guide than a comprehensive or motivational functional resource.
This book has lot of gems on FP, however, the problem I had being a beginner in FP world was, the concepts were not explained cohesively. If someone is familiar with FP concepts, and read this book, they may find few useful things. But I wouldn't recommend this beginners.
I'm glad the author provided plenty of examples in different languages to explain some of the concepts.
Where to start? Within the first 10 pages Neal completely discredits himself. He presents the evolution of programming as a singular linear event. Where are all the languages and paradigms lay flatly one after the other. When in reality languages and the paradigms that categorize them have independent timelines which occasionally overlap. The differences between the languages within a paradigm are not as stark as comparing languages in one paradigm contrasted with another's simply because they're tools meant to solve different problems.
His description of object-oriented programming is so shallow and frankly primitive it has me debating whether he is pandering or a hack. Which let's be clear, is fine if you're a software engineer who only needs to know how to program with tools you use at work is a-ok, but being an academic is literally half the job of an architect. You need to be able to objectively explain the merits of every paradigm as its applied to a given problem. This book doesn't do that. It presents functional programming as swiss army knife which its not. Its no more a purpose built tool than a hammer.
An overview of functional programming, aimed squarely at Java programmers. Very practical but missing much needed theory. If you are familiar with map, filter and reduce, there is very little this book offers.