Full Stack Fest

Sept. 1–5 2015, Barcelona
Brought
to you by:

Agenda

Diving into ClojureScript

Joaquin Oltra

@joakin
Buy Tickets

Duration: 4 hours

As JavaScript programmers we are getting more and more used to work with transpiled languages for the web platform with the use of Babel for ES6 to ES5 and similar transpilers.

ClojureScript is a modern forward thinking language that transpiles to JS, with a lot of interesting features that will make you a better programmer and will challenge the way you write JavaScript (more info in the next section). Immutability, functional programming and these advantages applied to web UIs with virtual DOM that appeared with the advent of React.js make of ClojureScript an excellent language to learn.

The idea is to play with the language doing exercises, games and a web app, and leave with enough basics, confidence, resources and materials to continue playing with the language.

During the workshop, we will have a hands-on introduction to the language, we will set up a project and code a small web game, while we will learn the advantages and differences with JavaScript, learn more intermediate concepts of the language, code another web project to do a small web application, learn about advanced concepts of the language and show some advanced awesome libraries and a general overview of the ecosystem and tooling.

Why learn ClojureScript

If you love javascript and the web but want a better language to code in; and want to learn and use a modern, functional and practical programming language; Clojurescript is the perfect fit, as a language with great advantages and one of the most advanced compile-to-js languages.

Some of the advantages of the language that will be shown and learnt are:

Sane semantics

ClojureScript has sane, safe and sound semantics, avoiding the extra overhead that dealing with all JavaScript quirks imposes. No more hoisting issues, global variables, weird equality rules, semicolon discussions, etc.

Easy and clear JavaScript interop

Like other famous compile-to-js languages, you can interact with JavaScript without any problems, with special semantics that allow seamless interop.

You can use existing JS libraries with ClojureScript without any problem.

Interactive development (REPL driven development)

ClojureScript is perfectly suitable for live coding and interactive development. You can eval your code and test it as you go coding, making the feedback loop instant, providing the satisfaction and security that you are coding exactly what you want.

Immutable by default

ClojureScript favors immutability by default, making it easier to program with values, and to reason about your code. With really good performance.

Modern data structures

ClojureScript includes a set of rich modern data structures that are immutable by default and have great performance. Vectors, lazy lists, hash maps, sets, a whole group of performant immutable data structures to have you covered when expressing your programs.

The pack is completed with the excellent standard lib that comes with the language.

Excellent standard library

ClojureScript includes cljs.core, cljs.string, cljs.set and more, a library of hundreds of functions to operate on the standard data structures in all ways imaginable. Expressiveness and power included by default. This is something you will surely miss when you have to code in JavaScript.

Besides the core, it gives you access to google closure library, a huge pack of JavaScript libraries written by Google that cover lots of cases with cross browser compatibility in mind.

Functional programming

ClojureScript is very well suited for functional programming with its data structures and the libraries of functions for manipulating and composing data and functions, and being expression oriented.

Favor pure functions when possible with immutable inputs and outputs, and write solid and expressive code.

Modern language (and backwards compatible)

Everything that is and will be coming to JavaScript, is already in ClojureScript available at our fingertips, while remaining compatible among all browsers (including the old ones. Yes, ES3 compliant), but in a well designed consistent language.

Namespaces, destructuring, short function/lambdas, macros, laziness, functional programming, immutability, variadic functions, polimorphism via protocols, CSP concurrency, pattern matching…

Concurrency semantics

With core.async, ClojureScript provides CSP semantics (like in go lang) for great use with concurrent code. A great alternative to callbacks, promises, reactive programming and streams.

Advanced compiler

The ClojureScript compiler emits a subset of JavaScript that is optimizable by the google closure compiler, providing an advanced (production) mode that will minify all our code, and remove dead (unreachable) code while performing several types of optimizations (inlining code, etc), resulting in a exceptionally minified code and in some cases faster execution time.