2. My limited wisdom ...
I shipped the products written in
● Scala
● Python
● JavaScript ES5 and ES6 (stuck at it for all good practical reasons)
Played maturely with
● Clojure (LISP dialect on JVM)
● Haskell (the chosen ONE !)
3. Why ? if i know procedural/structured/oop paradigms
4. But why ? I am still not convinced !
https://en.wikipedia.org/wiki/Blind_men_and_an_elephant
5. Do not take an advice from anyone who has never
shipped workable piece of software to production
built using functional programming language !!!
➔ Do create a your own little end to end
application
➔ Start comparison only after you are done
But more importantly…Statutory Warning
6. How to think functionally ?
● Use function as first class citizen to build abstraction
● Avoid mutation of variable(memory pointer handle) and data (state)
● Chant this mantra every morning, “null is a billion dollar mistake”
● Favour recursion over iteration
● Procure laziness with Streams
● Use expressions over statements
● Composition over inheritance
● Many identical functions for few data structures than few different functions for many data structures
So that .... you and the code you write can be more
● Focused on space (data flow) than time (control flow)
● Declarative (what) than imperative (how)
● Determined to avoid side effects AMAP (Referential Transparency)
7. Steroids
● Closure - Poor man’s object in FP
● Pattern Matching - expect it, extract it, bind it
● Curry - Partial or Extended definition of function using less arguments than
actually needed
● Contract Based programing - Pre and post conditions on function
● Tail call recursion - recursion without stack overflow
● Persistent data structures - avoid full data copy by structural sharing
● Software Transactional Memory - controlled concurrent access to shared memory
8. Purifiers
● Category Theory (for Math nerds and Static type freaks)
○ Category - Language
○ Objects - Type
○ Morphism(s) - static function or variables
● Functors, Applicatives and Monads
● Dependant Types - Writing code and its proof together
● Logic programing - function’s representing a set of facts and rules
9. SOLID
SRP - Function should do only one thing and really well
OCP - (Higher Order) Function may accept another function to be extensible
LSP - Substitute function only if it does not violate original intent (contract)
ISP - function implemented with bare essentials from perspective of consumer
DI - Higher order function and module functors
10. How do I begin ?
Install Racket https://racket-lang.org/download/
Read the book “How to Design Programs ” and
try all examples and exercises sincerely
Free official online book here :
http://www.ccs.neu.edu/home/matthias/HtDP2e/part_prologue.html
“LISP is worth learning for the profound enlightenment experience you will have when
you finally get it; that experience will make you a better programmer for the rest of
your days, even if you never actually use LISP itself a lot.”
―Eric S. Raymond
15. Videos
● Functional Programing, Robert C Martin
● The value of values, Rich Hickey
● Are We there Yet, Rich Hickey
● Simple Made Easy, Rich Hickey
● Persistent Data Structures and Managed References, Rich Hickey
● MIT SICP Lectures, Gerald Jay Sussman & Hal Abelson
● Racket: power of extensibility, Sam Tobin-Hochstadt
● Functional Design Pattern, Scott Wlaschin
● Domain modeling with the F# type system, Scott Wlaschin
● Adventure with Types in Haskell, Simon Peyton Jones
● Category Theory, Erik Meijer
● OCaml, Yaron Minsky
● Dependent Types in Idris, Brian McKenna