magomimmo/modern-cljs


A series of tutorials on ClojureScript

Language: Clojure


Latest tutorials

Tutorial 20 - House Keeping

Step to step guide for publishing a library to clojars repository by using boot.

Tutorial 19 - Livin' on the edge

Explain how to make a library compliant with the new Reader Conditionals extension of CLJ/CLJS compilers.

Tutorial 18 - Augmented TDD session

Complete the client-side form validation by exploiting the TDD environment augmented with CLJ/CLJS REPLs.

Modern ClojureScript

ATTENTION NOTE: I'm in the process of publishing the second edition of the series. The main difference from the first edition regards the use of the Boot build tool instead of Leiningen. This second edition is still a draft version and you should be forgiving if you'll find errors, typos or even bugs in the code.

WARNING NOTE FOR WINDOWS USERS: At the moment boot does not run on MS Windows less than 10. If this is your case, to be able to follow the modern-cljs series you can use use a virtual machine or docker linux container.

Modern ClojureScript (modern-cljs) is a series of tutorials that guide you in creating and running ClojureScript (CLJS) projects.

CLJS is a compiler for the Clojure programming language that targets JavaScript. It emits JavaScript code which runs in web browsers and other client-side or server-side JavaScript interpreters (e.g. nodejs).

Required background

These tutorials require that you have some prior programming experience. They assume you've gotten your hands dirty by trying a little Clojure, even if you're not proficient in it yet. It will also be quite helpful if you have some experience programming for the Web using HTML, JavaScript and the browser DOM.

If you don't know anything about Clojure (or about Lisp), I recommend you learn a little bit before starting these tutorials.

There are plenty of outstanding resources on Clojure that are freely available on the Internet, and you can't overestimate the benefit of reading a book on Clojure (or another Lisp dialect) to your value as a programmer.

Here are some book recommendations:

  • Clojure Programming: written by three of the heroes of Clojure, it contains everything you need to know about Clojure and its ecosystem.
  • Programming Clojure: written by another legendary Clojure developer, it's the easiest path to learning Clojure.
  • The Joy of Clojure: the title speaks by itself. A must read!
  • ClojureScript Up and Running: at the moment, it's the only published book on ClojureScript. The book is a bit outdated since ClojureScript is evolving quickly. It's brief and useful, especially if you want to integrate with external JavaScript libraries.
  • SICP - Structure and Interpretation of Computer Programs: this is the best programming book I've read in my very long career. It uses Scheme/Racket (a Lisp dialect) rather than Clojure and is available online, in print, or in a lecture series.
  • On Lisp: if you want to learn about macros, this is the place to start. It uses Common Lisp (a Lisp dialect) rather than Clojure.

Required tools

Many people worry about which operating system and editor/IDE are best for developing in Clojure and ClojureScript. I personally use Mac OS X, Debian and Ubuntu. I use Emacs as an editor.

Because I'm an old-timer, *nix and Emacs are the OS and editor I know best. That being said, in this series of tutorials you're not going to find any suggestions or reference to operating systems or editors. Use whatever tools you already have and know. I have too much respect for people developing IDE/plugins for Clojure/CLJS to say that one is better than another, and you don't want to combine learning a new programming language with trying to learn a new programming environment.

You will need to have git and Java installed and you'll need some familiarity with the basics of git.

Why the name Modern ClojureScript?

You might wonder why this tutorial series is named modern-cljs when ClojureScript is so recent. I started this series in 2012 while trying to port a few examples from the Modern JavaScript: Develop and Design book to ClojureScript, and now it's too late to change.

The Tutorials

As said, this is the second edition of the series and is based on the Boot build tool. I'm not going to update or support the first edition of the series which was based on the Leiningen build tool.

Introduction

This series of tutorials guides you in creating and running simple CLJS projects. The bulk of the series follows the progressive enhancement of a single project.

While working through the tutorials I strongly suggest you start at tutorial 1 and type in all the code for each tutorial yourself. In my experience this is the the best approach if you're not already very fluent with the programming language.

Tutorial 1 - The Basics

Create and configure a very basic CLJS project.

Tutorial 2 - Immediate Feedback Principle

Approach as close as possible the Bret Victor Immediate Feedback Principle to build a very interactive development environment.

Tutorial 3 - House Keeping

Automate the launching of the boot command to approach the Immediate Feedback Development Environment (IFDE).

Tutorial 4 - Modern ClojureScript

Have some fun with CLJS form validation by porting the JavaScript login form example from Modern JavaScript: Develop and Design to CLJS.

Tutorial 5 - Introducing Domina

Use the Domina library to make our login form validation more Clojure-ish.

Tutorial 6 - The Easy Made Complex, and the Simple Made Easy

Investigate and find two different ways to solve an issue from the last tutorial.

Tutorial 7 - Introducing Domina Events

Use Domina events for a more Clojure-ish approach to handing DOM events.

Tutorial 8 - DOM Manipulation

Programmatically manipulate DOM elements in response to DOM events.

Tutorial 9 - Introducing AJAX

Use AJAX to let the CLJS client-side code communicate with the server.

Tutorial 10 - A Deeper Understanding of Domina Events

Apply Domina events to the login form example from the 4th Tutorial.

Tutorial 11 - HTML on Top, Clojure on the Bottom

Explore the highest (HTML5) and deepest (Clojure on the server) layers of the login form example from the previous tutorial.

Tutorial 12 - Don't Repeat Yourself

Respect the Don't Repeat Yourself (DRY) principle by sharing validators between the client-side CLJS and the server-side Clojure.

Tutorial 13 - Better Safe Than Sorry (Part 1)

Set the stage for unit testing by learning about the Enlive template sytem and starting the shopping calculator example. Use code refactoring to satisfy the DRY principle and to solve a cyclic namespaces dependency problem.

Tutorial 14 - Better Safe Than Sorry (Part 2)

Add validators to the shoppingForm, and do some unit testing.

Tutorial 15 - Better Safe Than Sorry (Part 3)

Configure a development environment that simultaneously satisfy in a single JVM the Immediate Feedback Principle by Bret Victor and the Test Driven Development (TDD).

Tutorial 16 - On pleasing TDD practitioners

Make the Test Driven Development Environment more customizable.

Tutorial 17 - REPLing with Enlive

Integrate validators for the into a web form in such a way that the user will be notified with the corresponding help messages when the she/he enters invalid values in the form.

Tutorial 18 - Augmented TDD session

Complete the client-side form validation by exploiting the TDD environment augmented with CLJ/CLJS REPLs.

Tutorial 19 - Livin' on the edge

Explain how to make a library compliant with the new Reader Conditionals extension on CLJ/CLJS compilers.

Tutorial 20 - House Keeping

Step to step guide for publishing a library to clojar repository by using boot.

License

Copyright © Mimmo Cosenza, 2012-2015. Released under the Eclipse Public License, the same license as Clojure.

Project Statistics

Sourcerank 6
Repository Size 32.6 MB
Stars 2,891
Forks 307
Watchers 116
Open issues 38
Dependencies 0
Contributors 47
Tags 0
Created
Last updated
Last pushed

Top Contributors See all

Mimmo Cosenza Matt Oquist Sam Umbach David Goldfarb James Campos Ilshad Khabibullin Sean Johnson Adam Steel nchurch Mathieu Agopian Mark Simpson Oliver George Mika Vilpas noodlewiz rbxbx serialhex Marcus Blankenship riwsky Darrick Wiebe Greg Slepak

Interesting Forks See all

TranslateBabelJapan/modern-cljs
A short series of tutorials on ClojureScript
Clojure - Last pushed - 8 stars - 1 forks

Something wrong with this page? Make a suggestion

Last synced: 2017-11-24 18:30:14 UTC

Login to resync this repository