Software Delivery

Jim Barritt – Bring the power of Clojure to your browser app – Live Blog 2015

Jim Barritt has been writing code for many years. He is currently a Principal Consultant for ThoughtWorks.  His passion is the code and systems architectures, helping teams deliver reliably and rapidly. You can catch up with jim on Twitter.

Note: This is primarily a code demo session.


Clojure is a cross compiler for JavaScript which is compatible with the advanced compilation mode of the Google Closure optimising compiler.

Today we are looking at Clojure Script to React.js compilation.

Jim shows the structure of a basic Clojure app. The syntax looks very clean and simple, with much less verboseness than plain javascript.

Clojure meets its goals by: embracing an industry-standard, open platform – the JVM; modernizing a venerable language – Lisp; fostering functional programming with immutable persistent data structures; and providing built-in concurrency support via software transactional memory and asynchronous agents. The result is robust, practical, and fast.

There is the same awesomeness in the chome console that you would expect from standard JS. It even highlights syntax errors. Very handy.

The ClojureScript hello world is as follows:

(ns hello-world.core)

(enable-console-print!)

(println "Hello world!")

This declares the namespace and prints to the console.

Unlike vanilla js, Clojure applies structure to JS similar to CoffeeScript / Dart. This helps reduce the difference between members code, increasing readability.

Clojure Script

It encourages coding of UI’s rather than templating.

 

Facebook Twitter Email