Code Monkey home page Code Monkey logo

sjonvarp's Introduction

ClojureScript demo application

"Clojure rocks. JavaScript reaches."

"Programming isn't about typing, it's about thinking."

What

A single-page, data-driven ClojureScript web app which shows a daily schedule of shows on four of the principal Icelandic TV stations.

In this learning session we will consider:

  • JavaScript as a runtime
  • ClojureScript as a state management solution
  • Figwheel as a tool for live programming
  • React as an optimized HTML rendering engine
  • clojure.spec for programming by contract
  • core.async as a tool for facilitating asynchronous programming
  • Rum as a convenient API to tie everything together

Why

What do ClojureScript and Rum give us that JavaScript or other compile-to-JavaScript languages don't?

ClojureScript is primarily of interest when you have already bought into Clojure. It perhaps makes less sense if you haven't or don't intend to. In this case, you may get more mileage from Elm or even PureScript.

Since Akvo already has an investment in Clojure, ClojureScript could be very attractive in that it allows the use of one language throughout the web application stack. Rum also supports server-side component rendering.

Clojure, unlike JavaScript, has a stable and concise syntax which is not subject to change or interpretation.

A recent enhancement to Clojure, clojure.spec is a pragmatic solution to the problem of type safety. See README_SPEC for more information on this exciting topic.

React is rapidly becoming the toolkit of choice for modern web developers and is developed by a huge corporation with unlimited development resources. It can be seen as an industry-standard rendering engine ClojureScript gets for free.

core.async is, essentially, a code-rewriting macro that facilitates asynchronous programming. It is nothing "magical" but, rather, provides a Clojure-idiomatic way of making asynchronous code much easier to think about and write. Think of it, perhaps, as a way of escaping Callback Hell.

No Node.js. No NPM. No Bower. No Gulp. No Grunt. No Webpack. No Browserify. No Brunch. No Yeoman. No Uglify. Relax! \o/

How

Prerequisites

A basic grasp of Clojure code & data structures is useful (but not essential) for this session. JavaScript domain knowledge will also be beneficial.

To build this app yourself, you will need to have a recent JVM installed. Clojure itself can be installed as follows:

brew install clojure

Build and run

Once everything is installed, type the following to create an optimized, production build of the app:

clojure -A:prod

Now open resources/public/index.html in your web browser.

Live ClojureScript development

You can run the app in development using Figwheel as follows:

cljojure -A:dev

This command will also pop open a browser window running the application.

Note that some unit tests are included and will run in the browser console every time the application code is saved. Tests can be found in the tv.test.impl namespace.

Who

This app was written by Paul Burt.

But is it any good?

Yes.

Further information

ClojureScript for Skeptics is worth a watch if you're not (yet) convinced by ClojureScript.

sjonvarp's People

Contributors

peeb avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.