Sunday, 21 July 2013

Skimmer's Guide - Functional Programming for Java Developers



“Multithread programming requiring synchronised access to shared mutable state is the assembly language of concurrency.”

WHAT IS THE ABOUT? 

Dean Wapler brings to us "Functional Programming for Java Developers". Although two years old now, the book touches on concepts that are still highly relevant both today and upon the introduction of Lambdas to Java.

We begin with why functional programming is so important and look at actual techniques we can utilise. Immediately after we are encouraged to apply our learning in handy and thought provoking exercises. This format is followed in each of the following chapters and really helps to reinforce learning!

How we model our data and operate with it is the next focus, introducing the "functional power tools" that are filter, map and fold. Along with the following section on functional concurrency, these two form an incredible bounty of invaluable information.

Recapping on everything we have learnt, we look at how to improve our object orientated programming and where to go from here.

WHAT STOOD OUT? 

Declarative vs Imperative Programming (p. 7) 
Highlighting the key difference between functional and object-orientated programming using a well thought out factorial example.

The Actor Model (p. 41) 
Fantastic coverage of this concurrency tool which is short and sharp, very useful for beginners.


IIF YOU READ NOTHING ELSE... 

Why Functional Programming? (p. 1 - 5) 
Concise chapter on why Functional Programming actually matters.

Combinator Functions: The Collections Power Tools (p. 29) 
A brilliant section on tools that are crucial in any functional language: filter, map and fold. Covers both what these tools do and learning more through actually implementing them for a custom List data structure.

CONCLUSION 

Whilst this book is a great introduction to the basics, it lacks any great depth. Published in 2011, the available functional programming tools of the time (such as GS Collections and Google Guava) are surprisingly absent.

In my view, what is lacking in depth is made up for by having such a broad coverage in only 72 pages. This book forms a good bridge for those starting with functional programming to take toward exploring specific topics/tools in greater depth.

Wednesday, 10 July 2013

Recycling Time

Inspired by Sandro Mancuso's Software Craftsmanship book.

"… I would but I don't have the time" 

How many times do we lie to ourselves with this line? We all waste time, in one form or another. However if we really wanted to, we could "recycle" time that is used up by other day-to-day things.

Commuting is a brilliant example of this. I spend half an hour every morning and evening travelling on the London Underground. Previously I would fill this by playing random Android games or reading manga. When I joined the LJC Book Club, suddenly I had to find time to read everyday. So now on my tube journey, instead of pulling out my phone, I pull out a book instead.

Other examples of times that could be recycled include:

  • While cooking/eating... 
  • While waiting for people to arrive to meetings, at the doctors, etc...
  • Over your lunch break at work 
  • Before/after your marathon gaming session ;) 

Having said all of this, it is important to note that everything should be done in moderation. We can't be productive every waking hour of every day! In fact, doing things to unwind is critical to our productivity.

If you are tickled by this idea, highly recommend you give Sandro's book a go!