神刀安全网

How Do I Learn Some Functional Programming?

Hello, fellow reader!

Behold! You will find some highly opinionated long-read article below this line…

You are warned.

I am sure you have heard about functional programming already. Otherwise, you would never find this article :)

If you are still unsure what is it all about, I’d propose you to stop reading this article and switch to Uncle Bob’s article Functional Programming Basics .

You know what, just go and read it anyway!

How Do I Learn Some Functional Programming?

The first stepis the most controversial.

Yet, I personally think it is the most useful one anyway.

Grab Practical Object-Oriented Design in Ruby (POODR) by Sandi Metz and read it.

Yes, you read it correctly: Object-Oriented Design .

How Do I Learn Some Functional Programming?

"Why?! How… How does it relate to Functional Programming?!" you may wonder.

The thing is – you really need to experience a good, nice OOD to see the immediate value of Functional Programming and make the transition from OOP to FP smooth and easy.

Ah, and do not be afraid of Ruby. The examples are nice and easy, you will understand everything, I promise!

Ok, now when you are back from Ruby Land , let’s talk about some nice stuff we have in the JavaScript Land .

How Do I Learn Some Functional Programming?

And yes, we have some goodies. But I won’t show you everything right away so that you do not get overwhelmed.

I would suggest you the thing I keep repeating all the time:

Start writing some code right from the beginning!

Get this book first: Functional Javascript by Michael Fogus.

I think this is the most pragmatic book you can find to actually start writing some functional code in JS. That’s it!

How Do I Learn Some Functional Programming?

You will learn how to use underscore library (or lodash , if you will) right away.

It will lead you through applicative programming and some basic combinators , showing how it differs from the OOP and Class-oriented approaches you get used to.

Ah, such a nice journey!

Ok, you have played with underscore or lodash already, and all of those .map and .pluck are not scary and useless anymore?

Watch this then: Hey Underscore, You’re Doing It Wrong! .

How Do I Learn Some Functional Programming?

Brian Lonsdorf will show you the idea behind tacit programming technique.

You may find it quite similar to unix tools philosophy of putting the arguments in a specific order: from less often changed to most often changed, target object last , like in git checkout branch . See the similarity?

This is not the coincidence! This style pushes composability further.

What’s the next step?

I’d propose to read JavaScript Allongé, the "Six" Edition by Reg Braithwaite.

You will learn some SKI combinator calculus and high-caliber combinators and decorators with a nice and pleasant ES6 syntax .

How Do I Learn Some Functional Programming?

This is kestrel , or K-combinator

Also, you will learn about all those mixins and delegation based on prototypes in JS. It will make you a better programmer already!

Ok, now you have tried some low-hanging fruits and maybe get a habit of simplifying things.

It’s time to tread on a more abstract ground and learn some Theory™ !

Go read Professor Frisby’s Mostly Adequate Guide to Functional Programming .

How Do I Learn Some Functional Programming?

It will lead you through the path of Real-Deal Functional Programming: currying , Hindley-Milner type system, functors , applicatives , monads … Oh, my!

Don’t be afraid, the book is written in a comprehensible language and all examples are written in a digestible javascript using ramda .

From now on, the World will never be the same again for you!

I think, this is the time you can start using elm and fully appreciate all the powers it gives you.

But, if you want to proceed the journey from here, I would suggest you fighting the real dragon :

Functional Programming in Scala

by Paul Chiusano and Rúnar Bjarnason.

How Do I Learn Some Functional Programming?

They say it is one of the best books on FP today.The Real Deal™. Not the toys.

Also, I would personally suggest you reading both

Clojure for the Brave and True

and Learn You a Haskell for Great Good! .

Not only will you learn other flavours of Functional Programming , but also you will experience a type of books you have never seen before!

And this is the time where I will leave you on your own.

How Do I Learn Some Functional Programming?

After spending the time with all those FP, you are a completely new programmer right now!

I would love to hear back from you!

  • Do you still use JavaScript, or have you switched to ClojureScript, Elm or PureScript?
  • Have you conquered the quirks of Category Theory ?
  • Have you mastered the DataFlow programming? Or maybe Algebraic Effects ? Or even Dependent Types ?

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » How Do I Learn Some Functional Programming?

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址