Skip to content

magomimmo/modern-cljs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Latest tutorials

Part II of a step by step reasoned porting of the Official React Tutorial to Reagent.

Part I of a step by step reasoned porting of the Official React Tutorial to Reagent.

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

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 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:

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.

NOTE: If you are interested in learning more about Emacs here are some [resources to help get you started] (https://github.com/magomimmo/modern-cljs/blob/master/doc/supplemental-material/emacs-cider-references.md).

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

Clojure community documentation

Community created clojure documentation sites that you may find helpful are clojuredocs and Grimoire.

Libraries and tools

Clojure Toolbox is a directory of libraries and tools for CLJ/CLJS.

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.

Create and configure a very basic CLJS project.

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

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

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

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

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

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

Programmatically manipulate DOM elements in response to DOM events.

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

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

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

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

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.

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

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

Make the Test Driven Development Environment more customizable.

Integrate validators into a web form in such a way that the user will be notified with the corresponding help messages when they enter invalid values in the form.

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

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

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

Part I of a step by step reasoned porting of the Official React Tutorial to Reagent.

Part II of a step by step reasoned porting of the Official React Tutorial to Reagent.

License

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

About

A series of tutorials on ClojureScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published