“Only a fool tries to define something as nebulous as a style of programming. So here goes!”
“My solution will seem so inefficient as to border on professional malpractice.”
What did we read about?
This was our eighth week of ‘Functional Programming for the Object-Oriented Programmer‘ by Brian Manick.
We began on Page 78 at the start of Part II and read through to page 90. There were three exercises.
In Part II we are going to learn about writing in a functional style in Clojure.
It started by looking at what a functional style is, and how it is different from an object-oriented style. It is summed up as follows:
- Object oriented: stable relationships and varying paths.
- Functional: Many specialised flows and shapes.
Unfortunately, it isn’t clearly explained what that actually means.
Hopefully working through the example problem, which involves matching students to courses, will make things clearer. The solution involves annotating maps and then filtering them based on those annotations. To help us create the solution sets, map annotations and the arrow operator were introduced.
What stood out?
- We talked about avoiding conditionals back in week 2. Section 7.2 shows how we are actually going to do this. The approach sounds appealing.
- On the group we felt the need to talk about sets several weeks ago. Now the author has finally decided to introduce them in section 7.3.
- The approach described in section 7.4 is rather clumsy. Hopefully we’ll be shown a better way next week.
If you read nothing else this week…
- Sets are introduced in section 7.3
- The arrow operator is introduced in section 7.5