JAVA DEVELOPERS
FIRST CLOJURE PROJECT
CRAIG MALONE
OVERVIEW
CLOJURE PROJECT
OVERVIEW
WHAT / WHY
▸ Clojure project overview
▸ Perspective of a Java developer
▸ Feedback
OVERVIEW
CONTEXT
▸ Target niche market
OVERVIEW
CONTEXT
▸ Target niche market
▸ Quilting patterns
OVERVIEW
CONTEXT
▸ Target niche market
▸ Quilting patterns
▸ Pattern design tool
▸ Pattern marketplace
▸ Interactive patterns
RESOURCES
LEARNING CLOJURE
RESOURCES
BOOKS, NEWSLETTERS, VIDEOS
▸ Book: Joy of Clojure
RESOURCES
BOOKS, NEWSLETTERS, VIDEOS
▸ Book: Joy of Clojure
▸ Book: Clojure Applied
RESOURCES
BOOKS, NEWSLETTERS, VIDEOS
▸ Book: Joy of Clojure
▸ Book: Clojure Applied
▸ Book: Functional Programming Patterns in
Scala and Clojure
RESOURCES
BOOKS, NEWSLETTERS, VIDEOS
▸ Book: Joy of Clojure
▸ Book: Clojure Applied
▸ Book: Functional Programming Patterns in
Scala and Clojure
▸ Newsletter: Purely Functional - Eric
Normand
RESOURCES
BOOKS, NEWSLETTERS, VIDEOS
▸ Book: Joy of Clojure
▸ Book: Clojure Applied
▸ Book: Functional Programming Patterns in
Scala and Clojure
▸ Newsletter: Purely Functional - Eric
Normand
▸ Newsletter: REPL - Daniel Compton
RESOURCES
BOOKS, NEWSLETTERS, VIDEOS
▸ Book: Joy of Clojure
▸ Book: Clojure Applied
▸ Book: Functional Programming Patterns in
Scala and Clojure
▸ Newsletter: Purely Functional - Eric
Normand
▸ Newsletter: REPL - Daniel Compton
▸ Videos: Rich Hickey, David Nolen
RESOURCES
BOOKS, NEWSLETTERS, VIDEOS
▸ Book: Joy of Clojure
▸ Book: Clojure Applied
▸ Book: Functional Programming Patterns in
Scala and Clojure
▸ Newsletter: Purely Functional - Eric
Normand
▸ Newsletter: REPL - Daniel Compton
▸ Videos: Rich Hickey, David Nolen
▸ Videos: Clojure/West, Clojure/Conj,
EuroClojure, StrangeLoop
DEV ENV
PROJECT SETUP
DEVELOPMENT ENVIRONMENT
LANGUAGE
▸ Clojure for microservices
DEVELOPMENT ENVIRONMENT
LANGUAGE
▸ Clojure for microservices
▸ ClojureScript in Web SPA
DEVELOPMENT ENVIRONMENT
LANGUAGE
▸ Clojure for microservices
▸ ClojureScript in Web SPA
▸ ClojureScript in React Native
Android and iOS
DEVELOPMENT ENVIRONMENT
LANGUAGE
▸ Clojure for microservices
▸ ClojureScript in Web SPA
▸ ClojureScript in React Native
Android and iOS
▸ Clojure/ClojureScript for AWS
Lambda functions
DEVELOPMENT ENVIRONMENT
EDITOR
▸ Emacs
▸ prelude bundle
▸ smartparens
▸ cider
▸ clj-refactor
▸ projectile
▸ neotree
▸ outline minor mode
▸ clojure-snippets
DEVELOPMENT ENVIRONMENT
TESTING
▸ Unit testing: clojure.test and clj.test
DEVELOPMENT ENVIRONMENT
TESTING
▸ Unit testing: clojure.test and clj.test
▸ Generative testing: test.check
DESIGN
OO TO FUNCTIONAL
DESIGN
DESIGN TECHNIQUES
▸ Business Components
DESIGN
DESIGN TECHNIQUES
▸ Business Components
▸ Domain Driven Design
DESIGN
DESIGN TECHNIQUES
▸ Business Components
▸ Domain Driven Design
▸ Denotational design
DESIGN
DESIGN TECHNIQUES
▸ Business Components
▸ Domain Driven Design
▸ Denotational design
▸ Category theory
DESIGN
DESIGN TECHNIQUES
▸ Business Components
▸ Domain Driven Design
▸ Denotational design
▸ Category theory
▸ Patterns
DESIGN
NAMESPACES
▸ Namespaces govern and reflect
design
DESIGN
NAMESPACES
▸ Namespaces govern and reflect
design
▸ General rules
DESIGN
NAMESPACES
▸ Namespaces govern and reflect
design
▸ General rules
▸ Standard names
DESIGN
NAMESPACES
▸ Namespaces govern and reflect
design
▸ General rules
▸ Standard names
▸ Namespace type rules
DESIGN
NAMESPACES
▸ Namespaces govern and reflect
design
▸ General rules
▸ Standard names
▸ Namespace type rules
▸ Examples
DESIGN
NAMESPACES
▸ Namespaces govern and reflect
design
▸ General rules
▸ Standard names
▸ Namespace type rules
▸ Examples
DESIGN
EXAMPLE - CRUD WORKFLOW
▸ Reusable CRUD workflow code
DESIGN
EXAMPLE - CRUD WORKFLOW
▸ Reusable CRUD workflow code
▸ Java: interfaces, implementation
inheritance
DESIGN
EXAMPLE - CRUD WORKFLOW
▸ Reusable CRUD workflow code
▸ Java: interfaces, implementation
inheritance
▸ Clojure: protocols
DESIGN
EXAMPLE - CRUD WORKFLOW
▸ Reusable CRUD workflow code
▸ Java: interfaces, implementation
inheritance
▸ Clojure: protocols
▸ Clojure: function maps
DESIGN
EXAMPLE - CRUD WORKFLOW
DESIGN
EXAMPLE - CRUD WORKFLOW
DESIGN
EXAMPLE - RENDER PATTERN
▸ Render different data types to different devices
▸ Java: abstract output device, abstract render methods
▸ Clojure: data transformation from one model to another
▸ Transform in pure domain code, render I/O done on edges
▸ Example code
DESIGN
EXAMPLE - RENDER PATTERN
DESIGN
EXAMPLE - RENDER PATTERN
DESIGN
EXAMPLE - RENDER PATTERN
DESIGN
EXAMPLE - RENDER PATTERN
SERVER
TECH STACK
SERVER
LUMINUS
▸ Collection of clojure libraries
SERVER
LUMINUS
▸ Collection of clojure libraries
▸ Some glue code via leiningen template
SERVER
LUMINUS
▸ Collection of clojure libraries
▸ Some glue code via leiningen template
▸ compojure-api - RESTful API
▸ hugsql - SQL persistence
▸ migratus - database migration
▸ logback - logging
▸ cprop - edn and environment variable
configuration
▸ mount - component lifecycle
▸ buddy/clauth - OAuth2 authentication
SERVER
HUGSQL
▸ Clojure SQL library
SERVER
HUGSQL
▸ Clojure SQL library
▸ Embraces SQL syntax
SERVER
HUGSQL
SERVER
HUGSQL
▸ Clojure SQL library
▸ Embraces SQL syntax
▸ Runtime replacement of values
SERVER
HUGSQL
SERVER
HUGSQL
▸ Clojure SQL library
▸ Embraces SQL syntax
▸ Runtime replacement of values
▸ Extend the parameter replacement
types in clojure code
SERVER
HUGSQL
SERVER
HUGSQL
▸ Clojure SQL library
▸ Embraces SQL syntax
▸ Runtime replacement of values
▸ Extend the parameter replacement
types in clojure code
▸ Common CRUD SQL
SERVER
HUGSQL
SERVER
SWAGGER AND DOCKER
▸ Compure-api generates swagger.json
SERVER
SWAGGER AND DOCKER
▸ Compure-api generates swagger.json
▸ Swagger2Markup incorporates
custom workflow documentation
SERVER
SWAGGER AND DOCKER
▸ Compure-api generates swagger.json
▸ Swagger2Markup incorporates
custom workflow documentation
▸ Gradle used to generate swagger
doc
SERVER
SWAGGER AND DOCKER
▸ Compure-api generates swagger.json
▸ Swagger2Markup incorporates
custom workflow documentation
▸ Gradle used to generate swagger
doc
▸ Gradle used to generate docker
container
SERVER
SWAGGER AND DOCKER
▸ Compure-api generates swagger.json
▸ Swagger2Markup incorporates
custom workflow documentation
▸ Gradle used to generate swagger
doc
▸ Gradle used to generate docker
container
▸ Docker customization due to security
code
SERVER
JAVA / CLOJURE COMPARISON
▸ Java vs Clojure for "Update User"
SERVER
JAVA / CLOJURE COMPARISON
▸ Java vs Clojure for "Update User"
▸ Compare objects vs namespaces
SERVER
JAVA / CLOJURE COMPARISON
▸ Java vs Clojure for "Update User"
▸ Compare objects vs namespaces
▸ Compare code
CLIENT
TECH STACK
CLIENT
UI / UX
▸ React
CLIENT
UI / UX
▸ React
▸ Om
CLIENT
UI / UX
▸ React
▸ Om
▸ Google's Material Design
CLIENT
UI / UX
▸ React
▸ Om
▸ Google's Material Design
▸ Material-ui
CLIENT
UI / UX
▸ React
▸ Om
▸ Google's Material Design
▸ Material-ui
▸ cljs-material-ui
CLIENT
UI / UX
▸ React
▸ Om
▸ Google's Material Design
▸ Material-ui
▸ cljs-material-ui
▸ Processing
CLIENT
UI / UX
▸ React
▸ Om
▸ Google's Material Design
▸ Material-ui
▸ cljs-material-ui
▸ Processing
▸ quil
CLIENT
CLJ, CLJS, CLJC
▸ Most code is cljc
CLIENT
CLJ, CLJS, CLJC
▸ Most code is cljc
▸ Components are cljs
CLIENT
CLJ, CLJS, CLJC
▸ Most code is cljc
▸ Components are cljs
▸ cider/figwheel workflow
CLIENT
CLJ, CLJS, CLJC
▸ Most code is cljc
▸ Components are cljs
▸ cider/figwheel workflow
▸ Avoid bulk cljs compilation
CLIENT
JAVASCRIPT LIBRARIES
▸ Search cljsjs
CLIENT
JAVASCRIPT LIBRARIES
▸ Search cljsjs
▸ Add new cljsjs package
CLIENT
JAVASCRIPT LIBRARIES
▸ Search cljsjs
▸ Add new cljsjs package
▸ Foreign libs with js files in project
CLIENT
JAVASCRIPT LIBRARIES
▸ Search cljsjs
▸ Add new cljsjs package
▸ Foreign libs with js files in project
▸ Foreign libs module feature
SUMMARY
THOUGHTS SO FAR
SUMMARY
THOUGHTS
▸ Fun and easy
▸ Persistent data structures and pure functions
▸ OO transition not difficult
▸ Running on JVM and JS platforms is key
▸ Growing the community important

A Java Developers first Clojure project