Functional Programming, Simplifie

Alvin took a roundabout path to software development. He graduated from Texas A&M University with a degree in Aerospace Engineering despite the fact that all he wanted to do was play baseball. After becoming a practicing engineer, he realized he preferred software and programming to engineering. So he taught himself Fortran, C, Unix, network administration, sed, awk, Lisp, Perl, Java, JavaScript, Python, Ruby, JRuby, PHP, and Scala in roughly that order. During this time, he established a software consulting firm, grew it to fifteen employees, sold it, and relocated to Alaska.


You're not alone if you've struggled to learn Functional Programming (FP). Alvin Alexander — author of the Scala Cookbook for O'Reilly, the Scala Book for the official Scala website, and former teacher of Java and Object-Oriented Programming (OOP) classes — writes about his own struggles with FP and how he eventually conquered it (and you can too!).


In Functional Programming, Simplified, he teaches FP in a straightforward manner, avoiding abstract concepts such as functors, monads, and category theory. Instead, he explains FP through a steady stream of small, practical code examples.


For example, he discovered that experienced FP developers (FPers) are motivated by two goals: to use only immutable values and to write only pure functions. He later discovered the larger truth: FPers have these goals because their true desire — or mental model — is for all of their code to look and work exactly like algebra.


While this appears to be a simple task, it turns out that these objectives necessitate the use of some advanced Scala features, which they frequently employ simultaneously. As a result, their code may appear completely alien to inexperienced FP developers. "When you first see their code, it's easy to ask, 'Why would you write code like this?'" writes Mr. Alexander.


Mr. Alexander then responds to the "Why?" question by explaining the benefits of writing pure functional code. Once you've grasped those benefits — your motivation for learning FP — he shares five programming rules in the book:

  • All fields must be immutable.
  • Every function must be a pure function.
  • Null values are not permitted.
  • If you use a 'if,' you must also use a 'else.'
  • Instead of creating OOP classes that encapsulate data and behavior, you'll design data structures with Scala 'case' classes and write pure functions that operate on those data structures.


In the book, you'll learn how to write pure, functional code that reads like algebra by following five simple rules. He also shares another learning Golden Rule: Always ask “Why”? Among the lessons in the book are:

  • Why and how should you write only pure functions?
  • Why are pure function signatures far more valuable than OOP method signatures?
  • How to write recursive algorithms and why recursion is a natural tool for functional programming
  • Because the Scala 'for' expression is so important in FP, dozens of pages are dedicated to explaining how it works.
  • Finally, you'll realize that monads aren't all that difficult because they're a natural extension of the Five Rules.
  • The book concludes with lessons on FP data modeling as well as two major approaches for organizing your pure functions.


Author: Alvin Alexander

Link to buy: https://www.amazon.com/Functional-Programming-Simplified-Alvin-Alexander/dp/1979788782

Ratings: 4.6 out of 5 stars (from 170 reviews)

Best Sellers Rank: #235,411 in Books

#15 in Functional Software Programming

#168 in Microsoft Programming (Books)

https://www.amazon.com/
https://www.amazon.com/
https://www.amazon.com/
https://www.amazon.com/

Toplist Joint Stock Company
Address: 3rd floor, Viet Tower Building, No. 01 Thai Ha Street, Trung Liet Ward, Dong Da District, Hanoi City, Vietnam
Phone: +84369132468 - Tax code: 0108747679
Social network license number 370/GP-BTTTT issued by the Ministry of Information and Communications on September 9, 2019
Privacy Policy