Epic codefest: 7 programming languages in 7 days

We challenged our developers to learn Clojure, Scala, JavaScript, Ruby, Java, Kotlin, and Go in a day. Here's how easy it is to make the switch

1 2 3 4 5 6 7 8 9 Page 8
Page 8 of 9

Day seven: Clojure Granny
Developer: Shameem Mohamed Ali, who floats like a Java butterfly and stings like a Spring bee

A descendant of functional programming languages like Lisp, Clojure provides all the advantages of functional programming such as lazy initialization, dynamic binding, and macros. It also allows for integration with Java libraries, which could come in handy for operations such as date-based calculations. In addition, Clojure allows you to alter running code, making it a highly dynamic language.

I used the open source Web framework Compojure and wrote my code in Eclipse. I tried installing the Counterclockwise plug-in to run the project in Eclipse, but I had issues with the installation. The plug-in from the website seems broken, in my opinion, as it did not let me create the project in the standard directory structure that was expected for Clojure projects.

I also used Leiningen to compile and run the project, as it is the preferred way to run Clojure projects, according to users in the Clojure community. It took a while to figure out how to build a Web app using Leiningen; I had hoped to find a plug-in to build the app inside Eclipse itself. I would still prefer implementing the Web app in Java over Clojure as I feel it is easier to return dirty and impure objects from Web app coded quickly in Clojure.

I haven't done a lot of functional programming, but did learn a bit about it during the one-day exercise. I also learned about the various frameworks available for developing a Web app using Clojure before choosing Compojure.

Clojure does not have a monolithic framework analogous to Java's Spring. In fact, the Clojure community upholds a motto of "not tying components together to form a monolithic framework." Instead it provides smaller frameworks for specific functionalities, allowing users to mix and match based on their requirements. This might be a boon, but the pitfall is increased development time meshing together various frameworks.

My Clojure mentor Alan Dipert was of great help in directing me toward Leiningen over the problematic Eclipse plug-in Counterclockwise. He was also great in answering my questions along the way.

I would recommend using Clojure for functional programming rather than whipping up a Web app. Clojure has a higher learning curve for those of us more versed in object-oriented languages, which was probably the biggest drawback I saw. They are few tutorials on the Web, and the ones I was able to find seemed less informative than tutorials for other languages. There are a number of frameworks for developing Web apps in Clojure, such as Compojure, Noir, and Hiccup, but there aren't a lot of detailed tutorials aimed at using the frameworks, adding more to the learning curve.

1 2 3 4 5 6 7 8 9 Page 8
Page 8 of 9