SlideShare a Scribd company logo
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

More Related Content

What's hot

Why Functional Programming and Clojure - LightningTalk
Why Functional Programming and Clojure - LightningTalkWhy Functional Programming and Clojure - LightningTalk
Why Functional Programming and Clojure - LightningTalkJakub Holy
 
Build a Bot Workshop
Build a Bot WorkshopBuild a Bot Workshop
Build a Bot WorkshopBasant Medhat
 
Head First Java Chapter 2
Head First Java Chapter 2Head First Java Chapter 2
Head First Java Chapter 2Tom Henricksen
 
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 scriptGil Fink
 
Why do we need TypeScript?
Why do we need TypeScript?Why do we need TypeScript?
Why do we need TypeScript?Nitay Neeman
 
Ruby on Rails: a brief introduction
Ruby on Rails: a brief introductionRuby on Rails: a brief introduction
Ruby on Rails: a brief introductionLuigi De Russis
 
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 scriptGil Fink
 
Python in Industry
Python in IndustryPython in Industry
Python in IndustryDharmit Shah
 
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 aPeter A. Pirc
 
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 walkthroughRoland Tritsch
 
Getting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGetting Started with the TypeScript Language
Getting Started with the TypeScript LanguageGil Fink
 
Golang (Go Programming Language)
Golang (Go Programming Language)Golang (Go Programming Language)
Golang (Go Programming Language)ShubhamMishra485
 
Object oriented javascript
Object oriented javascriptObject oriented javascript
Object oriented javascriptGarrison Locke
 
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 beginnersEdy Segura
 

What's hot (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
 

Viewers also liked

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 2015Michiel Borkent
 
Macros in Clojure
Macros in ClojureMacros in Clojure
Macros in Clojuresohta
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the webMichiel Borkent
 
JS Lab`16. Роман Лютиков: "ClojureScript, что ты такое?"
JS Lab`16. Роман Лютиков: "ClojureScript, что ты такое?"JS Lab`16. Роман Лютиков: "ClojureScript, что ты такое?"
JS Lab`16. Роман Лютиков: "ClojureScript, что ты такое?"GeeksLab Odessa
 
JDK: CPU, PSU, LU, FR — WTF?!
JDK: CPU, PSU, LU, FR — WTF?!JDK: CPU, PSU, LU, FR — WTF?!
JDK: CPU, PSU, LU, FR — WTF?!Alexey Fyodorov
 
Getting started with ClojureScript
Getting started with ClojureScriptGetting started with ClojureScript
Getting started with ClojureScriptSiva Jagadeesan
 
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 ClojureScriptMurilo Pereira
 
Continuous Deployment of Clojure Apps
Continuous Deployment of Clojure AppsContinuous Deployment of Clojure Apps
Continuous Deployment of Clojure AppsSiva Jagadeesan
 
Writing DSL in Clojure
Writing DSL in ClojureWriting DSL in Clojure
Writing DSL in ClojureMisha Kozik
 
Atomics, CAS and Nonblocking algorithms
Atomics, CAS and Nonblocking algorithmsAtomics, CAS and Nonblocking algorithms
Atomics, CAS and Nonblocking algorithmsAlexey Fyodorov
 
ClojureScript Anatomy
ClojureScript AnatomyClojureScript Anatomy
ClojureScript AnatomyMike Fogus
 
[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 ScalaYuriy Guts
 
Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slideselliando dias
 
Java concurrency in practice
Java concurrency in practiceJava concurrency in practice
Java concurrency in practiceMikalai Alimenkou
 
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?Mikalai Alimenkou
 

Viewers also liked (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?
 

Similar to HelsinkiJS - Clojurescript for Javascript Developers

The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional ProgrammerDave Cross
 
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)All Things Open
 
Node.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleNode.js Web Apps @ ebay scale
Node.js Web Apps @ ebay scaleDmytro Semenov
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015Jorg Janke
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
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
 
Javascript Update May 2013
Javascript Update May 2013Javascript Update May 2013
Javascript Update May 2013Ramesh Nair
 
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 stepsManuel Eusebio de Paz Carmona
 
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 KrausWomen in Technology Poland
 
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...Aurélien Pupier
 
Introducing Yeoman 1.0 beta
Introducing Yeoman 1.0 betaIntroducing Yeoman 1.0 beta
Introducing Yeoman 1.0 betadigitalzombie
 
Counterclockwise past present future
Counterclockwise  past present futureCounterclockwise  past present future
Counterclockwise past present futurelolopetit
 
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 KrausWomen in Technology Poland
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartMukesh Singh
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkAlive Kuo
 

Similar to 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
 

Recently uploaded

10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka DoktorováCzechDreamin
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeCzechDreamin
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...Product School
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupCatarinaPereira64715
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Thierry Lestable
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...Product School
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekCzechDreamin
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxAbida Shariff
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesBhaskar Mitra
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...CzechDreamin
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsPaul Groth
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
 

Recently uploaded (20)

10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 

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