Hello again!
The first installment was interesting and showed what can be possible.
Since then I've had a few thoughts on how this could be extended and one particular thing stood out for me:
While the exercises that we did were of the right measure (introducing a concept, having examples worked out with the help of an expert), they are not enough - or, to be more precise: not suitable. While these examples help introducing a beginner to the language, they do not 'convince' one of the language.
I imagined my co-workers in such a workshop and although a few might be interested from an academic point of view, I'd also imagine questions such as "How would switching to Scala (from Java) benefit us?".
So, I figured instead of a bottom-up approach, perhaps a top-down approach might be more fruitful:
- Show a small Java example using BDD/acceptance testing with JBehave and the corresponding String-/Annotation-based bindings; And then the same example with a DSL made entirely within Scala, without hassle about the string stuff. (I've heard yesterday that scala-test provides this (?))
If then time and interest permits, go into details how this is achieved: functions without a parameter can be called without parentheses and so forth...
- Show a small example of the Command-Pattern with interface, clumsy execute() implementation and all the nice dressing of brackets and fields everywhere; And then the same example with functions as first-class members.
Then, time and interest permitting, show some more detailed stuff with functions as parameters
- Then an example that is then easily solved with a for-comprehension; Or the compatibility to existing Java libraries, ... -- you get the idea.
My point: I don't think the idea of functional programming can be sold within 1.5 hours. But things working easier out-of-the box can.
And only then, when the people are hooked, i.e. one wants to know how this is done, draw them into functional programming as a side-effect ;)
have fun,
ch