The past Saturday I was on devCrowd.pl in Szczecin, Poland where I ran two sessions about Clojure as a functional programming language to develop web applications. I don’t have slides to share as they were (supposed to have been) live coding sessions about what Clojure can offer for web development. The first session was after a talk about functional programming in a day-job development by Sebastian Pietrowski (@pedrowaty) and I wished I’d skipped the introductory part in my talk to spare more time for the demo instead.
It was a made-in-heaven, always-dreamt-of conference where not only could I demo Clojure in a 1-hour session with around 40 people (off 120 registered for the conference at that time and with a workshop about node.js and a talk about IT project management in parallel), but also ran another 1-hour live coding session organized in a hurry yet attracted ca. 10 people (some even left the Scala workshop!) when a speaker didn’t make it to the conference. I’m so glad the organizators ultimately convinced me to have run it for the price of me skipping a Scala workshop. It was definitely worth it!
“Always choose wisely” – they say. When faced with a choice of attending a session or leading one, I’d pick the later. It’s a no-brainer now.
After having spent 2 hours with the audience I could experience an addictive feel of empowerment, esp. when I was convinced to have done things in Clojure I really shouldn’t have in public with no prior preparation. It was very risky, but once done, it turned out easy and worth the effort. I felt as if I had grasped the most of Clojure. No macros were presented, though, as I had not studied and practiced them much.
I was afraid that finding a good balance between introducing Clojure with slides and later the live coding sessions might’ve been a huge undertaking, but the comments on twitter (#devcrowdpl + @jaceklaskowski) about my sessions seem to prove that people might’ve enjoyed the sessions. I also managed to speak to a few people who spent some time with functional languages – Clojure and F#.
I had a cheatsheet on my Android mobile device to cover my back in case of troubles which was very helpful at times.
The live coding session started with a lein2 project – lein2 new, lein2 run -m to have it run standalone with lein2 uberjar after :gen-class and :main true (in the Clojure namespace) and :aot (in the project.clj) were added and explained a bit. With a minor hitch, it went very smoothly. With the standalone jar I managed to demo a standalone Java application to call the Clojure namespace. No problems along the way (I was so much surprised to have done it with no issues!) Then I switched to lein2 repl and played with integrated pomegrade and ring-jetty-adapter. I used a var of a handler right away to handle HTTP requests and showed how to change the handler dynamically. As the last step in the demo, I had a var with a function that was used by a Thread and used telnet to access the REPL to change the function at runtime with no interruption to the running thread. A bit of Eclipse with Counterclockwise, more introduction to functional programming with Clojure with map, reduce and filter amongst the other features (immutable data structures) concluded the sessions.
I’m going to described the parts of my sessions which have not yet found their place in my blog. Stay tuned.
Should you want to join a live coding session with Clojure and me, I wholeheartedly recommend to attend the presentations of mine on 4Developers in Poznan on 18. April, GeeCON in Poznan on 18. May and hopefully Confitura in Warsaw on 30. June.
p.s. I felt in love with functional programming with Clojure and F# so much that I could very likely consider a job as a team leader or a lead developer, too.