Functional Programming Patterns in Scala and Clojure: Write Lean Programs for the JVM Buy on Amazon

https://www.ebooknetworking.net/books_detail-1937785475.html

Functional Programming Patterns in Scala and Clojure: Write Lean Programs for the JVM

33.53 36.00 USD
Buy New on Amazon 🇺🇸 Buy Used — $18.11

Usually ships in 24 hours

Book Details

ISBN / ASIN1937785475
ISBN-139781937785475
AvailabilityUsually ships in 24 hours
Sales Rank1,008,913
CategoryComputers
MarketplaceUnited States  🇺🇸

Description

Q&A with Michael Bevilacqua-Linn, author of "Functional Programming Patterns in Scala and Clojure"

Q. Why did you write "Functional Programming Patterns"?

A. Languages with a functional flavor are getting more and more mainstream, and I wanted to write something that would help folks with a lot of traditional OO pattern knowledge start to make the transition.

Q. I don't know Scala or Clojure. How hard would it be for me to understand the examples in the book?

A. This book is written for programmers who are new to Scala and Clojure, but who have significant experience with Java and object-oriented patterns. One of its goals is to help ease experienced object-oriented programmers into a more functional style.

Q. What can I do with functional patterns that I couldn't do before?

A. It's not so much what you can do, as what you can do better! Functional programming, and the patterns that go along with it, tends to be more declarative than imperative programming, so you can solve problems with code that's both more straightforward and shorter. The functional focus on immutable data reduces bugs in large programs, especially ones involving concurrency.

Q. Functional programming has no place in the object-oriented world, does it?

A. While object-oriented programming and functional programming are often seen as opposite paradigms, the truth is a bit more complex. Even Java is getting more of a functional style with Java 8's Lambdas. Scala explicitly blends object-oriented and functional styles. While Clojure is explicitly not object-oriented, it does borrow many good ideas from the object-oriented world, such as polymorphism and programming to interfaces.

Q. Which one should I use? Scala or Clojure? What are the differences and which would be easier to start with?

A. Scala tends to provide an easier on-ramp for object-oriented programmers, as they can start working with it in a mainly object-oriented style and transition to a more functional style as they gain more experience. Scala also has a sophisticated static type system, and blends object-oriented and functional programming together. Clojure, on the other hand, is a modern, practical Lisp and comes with the powerful macro system inherent to Lisps.

Both are excellent, general-purpose languages, but I have to confess that I prefer Clojure. I find that I can write clear, concise code it in much more easily than I can in any other language. However, knowing both will give you a very broad understanding of modern languages with a functional flavor.


5 Functional Programming Tips from Michael Bevilacqua-Linn, Author of “Functional Programming Patterns in Scala and Clojure”

  1. Look for opportunities to replace object-oriented patterns with simpler functional language features.
  2. Don't be afraid to create functions that return functions.
  3. Consider composing behaviors using higher order functions rather than building hierarchies.
  4. Reach for higher order functions over collections before recursion.
  5. You often don't need mutability, even when you think you do! Try to find a higher order function that helps you transform an immutable data structure into a new, immutable data structure rather than modifying it in place.

More Books in Computers

Donate to EbookNetworking
Functional Programm...Prev
Modern C++ Programm...Next