“With loosely-coupled objects that communicate only by passing behaviors (functions) around (rather than entire bundles of state and behavior in the form of objects), the early part of design may become easier.“
What did we read about?
This was our twelfth week of ‘Functional Programming for the Object-Oriented Programmer‘ by Brian Manick.
We begin on Page 115 at the start of section 9.4, picking up the exercises from last week’s reading. We finish at Page 120 at the end of chapter 9.
The exercises revolve around putting into practice what we have learnt about “Point-Free Programming”. We are introduced to the new juxt function before being tasked with a diverse set of exercises to test understanding on various topics so far.
Finally we look at higher order functions from the perspective of object orientated programming and how we can decouple our design using “function passing” (either directly in Ruby or via single abstract method interfaces in Java).
What stood out?
- Exercise 2 introduces the neat little function juxt, definitely a good tool to know about and not a bad exercise either.
If you read nothing else this week…
- Exercise 7 – 10 are brilliant practice of the Clojure we have learnt so far. Highly recommend everyone gives it a try as they are great for working on your code style and thinking about reducing duplication.
- “9.5 Higher-order functions from the object-oriented perspective” – only two pages but makes you think about how you should handle your dependencies (on functions or on objects).