SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
ClojureScript for JavaScript
Developers
Juho Teperi / Metosin
HelsinkiJS
26.5.2016
Who?
● Juho Teperi / Deraen
○ Mongo, Express, AngularJS, Node.js...
○ Grunt, Gulp
○ 2.5 years Clojure, 1.5 years ClojureScript
○ Open source contributor: Boot & tasks, Cljsjs...
● Metosin
○ Founded 2012
○ Around 11 people
○ World headquarters at Tampere, southern Finland branch at Helsinki
○ Consulting, Software development, Clojure training
Contents
● Basics
● ….
● Hot stuff
● Cool stuff
● …
● Why should One Use ClojureScript?
Lisp
Old family of programming languages
List is a data-structure
(list is represented using parentheses)
Code is expressed as lists
Macros can modify the code
Allows extending language without changing the
syntax
But Parentheses?
Source: xkcd.com/297/
Clojure
● A Lisp dialect for JVM
○ Benefits from Java ecosystem
● Functional Programming
○ Immutable data
● Concurrency - STM
● Strongly typed, dynamic typing
○ Static typing as a library
clojure.org/about/rationale
ClojureScript
● Clojure dialect
● Compiled to JavaScript
● GitHub statistics
○ 6034 stars, 136 contributors
○ Comparable to other compile
to JS langs
Immutable Data
● Immutable Data is built-in, used by all libraries
(def a {:a-map "This is a map"})
(def b (assoc a :map-is-like "an Object"))
(let [c ["a" "vector" "is" "like" "an" "array"]
d (map clojure.string/upper-case c))]
d) ;; => ("A" "VECTOR" ...)
;; Map is lazy and the result is only realized when needed
(reduce + 0 [1 2 3]) ;; => 6
Async Programming
(go
(let [response (<! (http/get "/url"))]
(if (http/success? response)
(do-something response)
(js/console.error response))))
Core.async provides “Go blocks”
Allows writing async code that looks like synchronous code
(It looks quite similar to ES7 Await)
Using JavaScript
First class interoperability
cljsfiddle.com/#gist=608eb29293dcc80d9b4145966b53fc49
(js/setTimeout
(fn [] (js/console.log "Hello World"))
1000)
Useful stuff
Build Tooling
Boot
● Extended using tasks
● Tasks are functions, using
middleware pattern
● Tasks can be composed
Leiningen
● Extended using plugins
● Declarative configuration
● Plugins don’t really compose
How is The Development Experience?
Lets take a look at
https://github.com/Deraen/saapas
What was that?
● Boot, boot-cljs, boot-reload etc.
(inspired by Figwheel, a Leiningen plugin)
● Live reload without losing state
● Browser REPL integrated with editor
Common Libraries
● Schema, declarative data description and validation
● Core.async, Go style asynchronous programming
● Om, React wrapper
● Om.next, like ^ and Relay style declarative data
requirements
● Reagent, React wrapper with FRP style features
● Re-frame, Redux/Elm style architecture model and
implementation for Reagent (great documentation!)
● EDN, extensible data notation (data format)
● Transit, JSON based data format
● Garden, Create CSS from Clojure datastructures
UI programming - Reagent
Global state: cljsfiddle.com/#gist=5aa5101e3f207595ce96a1e1276b0bcb
Local state in closure: cljsfiddle.com/#gist=8716f35f9eb042fe963d5ce9b0dca35b
(defonce beers (atom 0))
(defn beer-counter [{:keys [name]}]
[:div
[:h1 "Hello, " name]
[:p "You have drank " @beers " beers"]
[:button
{:on-click #(swap! beers inc)}
"Drink a beer"]])
Some Cool Stuff
● ClojureScript-in-ClojureScript: clojurescript.net
● CLJS Fiddle: cljsfiddle.com
● Stand-alone OS X REPL using JSC: github.
com/mfikes/planck
● React Native: cljsrn.org
Why should One Use ClojureScript?
Same Platform for Multiple Targets
● Backend - Clojure on JVM
● Web frontend - ClojureScript
● Mobile - ClojureScript with React Native
Shared Logic
● Shared logic between the apps
● For example, we often define the Domain
objects using Schema
○ These are used to define backend endpoints
○ Frontend form validation
Better Language Than JS?
● Less syntax -> Better syntax?
● Very effective for data manipulation
○ Read data, manipulate, manipulate, …, write
somewhere / show to user
○ Lodash / Immutable.js etc. built-in
Ecosystem
● The latest and greatest ideas from JavaScript
will probably be available in ClojureScript
● Sometimes new ideas are developed at the same
time for ClojureScript!
● Sometimes the features are available in
ClojureScript first!
Community
● Active Slack community, 5500 6100 members
● Google groups
● /r/clojure
● Multiple conferences in Europe
○ EuroClojure
○ ClojuTRE, Sep 10th
2016
○ ClojureX (London), ClojureD (Berlin), ClojureDays
(Amsterdam)...
How to get started?
● github.com/clojure/clojurescript/wiki/Quick-
Start (Tool indepented basics)
● github.com/magomimmo/modern-cljs (includes
Boot tutorial)
The Missing Parts
● Compile time errors are not as great as in Elm
○ But provides more feedback than JS
● Static typing
○ Core.typed, currently targets JVM first
Thanks!
Questions?
Sources & Further Material
● ClojureScript for Skeptics - Derek Slager, ClojureConj 2015: www.
youtube.com/watch?v=gsffg5xxFQI
● ClojureScript: Lisp’s Revenge - David Nolen, GOTO 2014: www.youtube.
com/watch?v=MTawgp3SKy8
Dependencies
● Piggiebacks Clojure and Java: packaged as JARs and deployed to Maven
repositories
○ Reliable, easy to reason about dependency tree
○ Battle tested over 11 years (vs. NPM 6 years)
● Clojars: Easy Clojure community Maven repository with
○ Integrated to tooling
○ Less restrictuve
Externs
Google Closure optimizations require extern files

Contenu connexe

Tendances

Posladkajmo si JavaScript z uporabo TypeScript a
Posladkajmo si JavaScript z uporabo TypeScript aPosladkajmo si JavaScript z uporabo TypeScript a
Posladkajmo si JavaScript z uporabo TypeScript a
Peter A. Pirc
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascript
Garrison Locke
 

Tendances (20)

Protocol buffers
Protocol buffersProtocol buffers
Protocol buffers
 
Why Functional Programming and Clojure - LightningTalk
Why Functional Programming and Clojure - LightningTalkWhy Functional Programming and Clojure - LightningTalk
Why Functional Programming and Clojure - LightningTalk
 
TypeScript
TypeScriptTypeScript
TypeScript
 
Build a Bot Workshop
Build a Bot WorkshopBuild a Bot Workshop
Build a Bot Workshop
 
Head First Java Chapter 2
Head First Java Chapter 2Head First Java Chapter 2
Head First Java Chapter 2
 
One language to rule them all type script
One language to rule them all type scriptOne language to rule them all type script
One language to rule them all type script
 
Why do we need TypeScript?
Why do we need TypeScript?Why do we need TypeScript?
Why do we need TypeScript?
 
ActiveDoc
ActiveDocActiveDoc
ActiveDoc
 
Ruby on Rails: a brief introduction
Ruby on Rails: a brief introductionRuby on Rails: a brief introduction
Ruby on Rails: a brief introduction
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type script
 
FluentDom
FluentDomFluentDom
FluentDom
 
Python in Industry
Python in IndustryPython in Industry
Python in Industry
 
Posladkajmo si JavaScript z uporabo TypeScript a
Posladkajmo si JavaScript z uporabo TypeScript aPosladkajmo si JavaScript z uporabo TypeScript a
Posladkajmo si JavaScript z uporabo TypeScript a
 
Scala, Android & BLE - Scala Meetup Dublin - Hands on code walkthrough
Scala, Android & BLE - Scala Meetup Dublin - Hands on code walkthroughScala, Android & BLE - Scala Meetup Dublin - Hands on code walkthrough
Scala, Android & BLE - Scala Meetup Dublin - Hands on code walkthrough
 
Getting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGetting Started with the TypeScript Language
Getting Started with the TypeScript Language
 
Mongodb (1)
Mongodb (1)Mongodb (1)
Mongodb (1)
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascript
 
Grails workshops
Grails workshopsGrails workshops
Grails workshops
 
2017 Facebook DevC SRS - JavaScript for beginners
2017 Facebook DevC SRS - JavaScript for beginners2017 Facebook DevC SRS - JavaScript for beginners
2017 Facebook DevC SRS - JavaScript for beginners
 

En vedette

Macros in Clojure
Macros in ClojureMacros in Clojure
Macros in Clojure
sohta
 
Getting started with ClojureScript
Getting started with ClojureScriptGetting started with ClojureScript
Getting started with ClojureScript
Siva Jagadeesan
 
Continuous Deployment of Clojure Apps
Continuous Deployment of Clojure AppsContinuous Deployment of Clojure Apps
Continuous Deployment of Clojure Apps
Siva Jagadeesan
 

En vedette (18)

ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
Macros in Clojure
Macros in ClojureMacros in Clojure
Macros in Clojure
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
 
JS Lab`16. Роман Лютиков: "ClojureScript, что ты такое?"
JS Lab`16. Роман Лютиков: "ClojureScript, что ты такое?"JS Lab`16. Роман Лютиков: "ClojureScript, что ты такое?"
JS Lab`16. Роман Лютиков: "ClojureScript, что ты такое?"
 
JDK: CPU, PSU, LU, FR — WTF?!
JDK: CPU, PSU, LU, FR — WTF?!JDK: CPU, PSU, LU, FR — WTF?!
JDK: CPU, PSU, LU, FR — WTF?!
 
Getting started with ClojureScript
Getting started with ClojureScriptGetting started with ClojureScript
Getting started with ClojureScript
 
Introduction to datomic
Introduction to datomicIntroduction to datomic
Introduction to datomic
 
The Case for React.js and ClojureScript
The Case for React.js and ClojureScriptThe Case for React.js and ClojureScript
The Case for React.js and ClojureScript
 
Continuous Deployment of Clojure Apps
Continuous Deployment of Clojure AppsContinuous Deployment of Clojure Apps
Continuous Deployment of Clojure Apps
 
Writing DSL in Clojure
Writing DSL in ClojureWriting DSL in Clojure
Writing DSL in Clojure
 
Atomics, CAS and Nonblocking algorithms
Atomics, CAS and Nonblocking algorithmsAtomics, CAS and Nonblocking algorithms
Atomics, CAS and Nonblocking algorithms
 
ETL in Clojure
ETL in ClojureETL in Clojure
ETL in Clojure
 
ClojureScript Anatomy
ClojureScript AnatomyClojureScript Anatomy
ClojureScript Anatomy
 
DSL in Clojure
DSL in ClojureDSL in Clojure
DSL in Clojure
 
[JEEConf 2015] Lessons from Building a Modern B2C System in Scala
[JEEConf 2015] Lessons from Building a Modern B2C System in Scala[JEEConf 2015] Lessons from Building a Modern B2C System in Scala
[JEEConf 2015] Lessons from Building a Modern B2C System in Scala
 
Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Java concurrency in practice
Java concurrency in practiceJava concurrency in practice
Java concurrency in practice
 
Do we need JMS in 21st century?
Do we need JMS in 21st century?Do we need JMS in 21st century?
Do we need JMS in 21st century?
 

Similaire à HelsinkiJS - Clojurescript for Javascript Developers

Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)
Per Henrik Lausten
 
Introducing Yeoman 1.0 beta
Introducing Yeoman 1.0 betaIntroducing Yeoman 1.0 beta
Introducing Yeoman 1.0 beta
digitalzombie
 
Counterclockwise past present future
Counterclockwise  past present futureCounterclockwise  past present future
Counterclockwise past present future
lolopetit
 

Similaire à HelsinkiJS - Clojurescript for Javascript Developers (20)

The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
Javascript Frameworks (and How to Learn Them)
Javascript Frameworks (and How to Learn Them)Javascript Frameworks (and How to Learn Them)
Javascript Frameworks (and How to Learn Them)
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scale
 
Dust.js
Dust.jsDust.js
Dust.js
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)Intro to XPages for Administrators (DanNotes, November 28, 2012)
Intro to XPages for Administrators (DanNotes, November 28, 2012)
 
Developer effiencency
Developer effiencencyDeveloper effiencency
Developer effiencency
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Node.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsNode.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first steps
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Adopting language server for apache camel feedback from a java/Eclipse plugi...
Adopting language server for apache camel  feedback from a java/Eclipse plugi...Adopting language server for apache camel  feedback from a java/Eclipse plugi...
Adopting language server for apache camel feedback from a java/Eclipse plugi...
 
Introducing Yeoman 1.0 beta
Introducing Yeoman 1.0 betaIntroducing Yeoman 1.0 beta
Introducing Yeoman 1.0 beta
 
Counterclockwise past present future
Counterclockwise  past present futureCounterclockwise  past present future
Counterclockwise past present future
 
Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
 
Better java with design
Better java with designBetter java with design
Better java with design
 
JavaScript | Introduction
JavaScript | IntroductionJavaScript | Introduction
JavaScript | Introduction
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

HelsinkiJS - Clojurescript for Javascript Developers

  • 1. ClojureScript for JavaScript Developers Juho Teperi / Metosin HelsinkiJS 26.5.2016
  • 2. Who? ● Juho Teperi / Deraen ○ Mongo, Express, AngularJS, Node.js... ○ Grunt, Gulp ○ 2.5 years Clojure, 1.5 years ClojureScript ○ Open source contributor: Boot & tasks, Cljsjs... ● Metosin ○ Founded 2012 ○ Around 11 people ○ World headquarters at Tampere, southern Finland branch at Helsinki ○ Consulting, Software development, Clojure training
  • 3. Contents ● Basics ● …. ● Hot stuff ● Cool stuff ● … ● Why should One Use ClojureScript?
  • 4. Lisp Old family of programming languages List is a data-structure (list is represented using parentheses) Code is expressed as lists Macros can modify the code Allows extending language without changing the syntax
  • 6. Clojure ● A Lisp dialect for JVM ○ Benefits from Java ecosystem ● Functional Programming ○ Immutable data ● Concurrency - STM ● Strongly typed, dynamic typing ○ Static typing as a library clojure.org/about/rationale
  • 7. ClojureScript ● Clojure dialect ● Compiled to JavaScript ● GitHub statistics ○ 6034 stars, 136 contributors ○ Comparable to other compile to JS langs
  • 8. Immutable Data ● Immutable Data is built-in, used by all libraries (def a {:a-map "This is a map"}) (def b (assoc a :map-is-like "an Object")) (let [c ["a" "vector" "is" "like" "an" "array"] d (map clojure.string/upper-case c))] d) ;; => ("A" "VECTOR" ...) ;; Map is lazy and the result is only realized when needed (reduce + 0 [1 2 3]) ;; => 6
  • 9. Async Programming (go (let [response (<! (http/get "/url"))] (if (http/success? response) (do-something response) (js/console.error response)))) Core.async provides “Go blocks” Allows writing async code that looks like synchronous code (It looks quite similar to ES7 Await)
  • 10. Using JavaScript First class interoperability cljsfiddle.com/#gist=608eb29293dcc80d9b4145966b53fc49 (js/setTimeout (fn [] (js/console.log "Hello World")) 1000)
  • 12. Build Tooling Boot ● Extended using tasks ● Tasks are functions, using middleware pattern ● Tasks can be composed Leiningen ● Extended using plugins ● Declarative configuration ● Plugins don’t really compose
  • 13. How is The Development Experience? Lets take a look at https://github.com/Deraen/saapas
  • 14. What was that? ● Boot, boot-cljs, boot-reload etc. (inspired by Figwheel, a Leiningen plugin) ● Live reload without losing state ● Browser REPL integrated with editor
  • 15. Common Libraries ● Schema, declarative data description and validation ● Core.async, Go style asynchronous programming ● Om, React wrapper ● Om.next, like ^ and Relay style declarative data requirements ● Reagent, React wrapper with FRP style features ● Re-frame, Redux/Elm style architecture model and implementation for Reagent (great documentation!) ● EDN, extensible data notation (data format) ● Transit, JSON based data format ● Garden, Create CSS from Clojure datastructures
  • 16. UI programming - Reagent Global state: cljsfiddle.com/#gist=5aa5101e3f207595ce96a1e1276b0bcb Local state in closure: cljsfiddle.com/#gist=8716f35f9eb042fe963d5ce9b0dca35b (defonce beers (atom 0)) (defn beer-counter [{:keys [name]}] [:div [:h1 "Hello, " name] [:p "You have drank " @beers " beers"] [:button {:on-click #(swap! beers inc)} "Drink a beer"]])
  • 17. Some Cool Stuff ● ClojureScript-in-ClojureScript: clojurescript.net ● CLJS Fiddle: cljsfiddle.com ● Stand-alone OS X REPL using JSC: github. com/mfikes/planck ● React Native: cljsrn.org
  • 18. Why should One Use ClojureScript?
  • 19. Same Platform for Multiple Targets ● Backend - Clojure on JVM ● Web frontend - ClojureScript ● Mobile - ClojureScript with React Native
  • 20. Shared Logic ● Shared logic between the apps ● For example, we often define the Domain objects using Schema ○ These are used to define backend endpoints ○ Frontend form validation
  • 21. Better Language Than JS? ● Less syntax -> Better syntax? ● Very effective for data manipulation ○ Read data, manipulate, manipulate, …, write somewhere / show to user ○ Lodash / Immutable.js etc. built-in
  • 22. Ecosystem ● The latest and greatest ideas from JavaScript will probably be available in ClojureScript ● Sometimes new ideas are developed at the same time for ClojureScript! ● Sometimes the features are available in ClojureScript first!
  • 23. Community ● Active Slack community, 5500 6100 members ● Google groups ● /r/clojure ● Multiple conferences in Europe ○ EuroClojure ○ ClojuTRE, Sep 10th 2016 ○ ClojureX (London), ClojureD (Berlin), ClojureDays (Amsterdam)...
  • 24. How to get started? ● github.com/clojure/clojurescript/wiki/Quick- Start (Tool indepented basics) ● github.com/magomimmo/modern-cljs (includes Boot tutorial)
  • 25. The Missing Parts ● Compile time errors are not as great as in Elm ○ But provides more feedback than JS ● Static typing ○ Core.typed, currently targets JVM first
  • 27. Sources & Further Material ● ClojureScript for Skeptics - Derek Slager, ClojureConj 2015: www. youtube.com/watch?v=gsffg5xxFQI ● ClojureScript: Lisp’s Revenge - David Nolen, GOTO 2014: www.youtube. com/watch?v=MTawgp3SKy8
  • 28. Dependencies ● Piggiebacks Clojure and Java: packaged as JARs and deployed to Maven repositories ○ Reliable, easy to reason about dependency tree ○ Battle tested over 11 years (vs. NPM 6 years) ● Clojars: Easy Clojure community Maven repository with ○ Integrated to tooling ○ Less restrictuve
  • 29. Externs Google Closure optimizations require extern files