Krakow Decompressed

Krakow Decompressed

(or 'What I learned @EuroClojure 2014')

@kevin_noonan

Clojure Ireland

3rd Sept 2014, Dublin

Hit 'M' for overview of slides. Press 'M' again to exit.

Part 1.

Swagger & Prismatic Schema

To document & validate an API developed in Clojure

Prismatic Schema

https://github.com/Prismatic/schema

Define a data-type with Schema

Test a sample of valid data

Pass invalid data to Schema

Compojure-api

https://github.com/metosin/compojure-api

Integrates several packages

Compojure & Ring (basic web-stack)

Prismatic Schema (to validate data-types)

ring-swagger (generate JSON to document an API)

Define data-type & set up routing...

Define an API endpoint...

Swagger UI

JavaScript to consume JSON to document an API.

https://github.com/wordnik/swagger-ui

Available for many languages (not just Clojure)

Alternatives to Compojure-api

Octohipster (based on Liberator)

Prismatic Fnhouse (alpha)

Alternative to ring-swagger

https://github.com/narkisr/swag

Part 1 was inspired by...

"Schema & Swagger: making your Clojure web APIs more awesome", by Tommi Reiman.

http://www.slideshare.net/metosin/euroclojure2014-schema-swagger-making-your-clojure-web-apis-more-awesome

Part 2.

JVM breakglass

A dynamic backdoor to diagnose a static (Java) system.

JVM- breakglass

https://github.com/matlux/jvm-breakglass

breakglass demo

One-page tutorial-style guide to using JVM Breakglass

https://github.com/matlux/jvm-breakglass/blob/master/bootloader/src/main/clojure/cl_java_introspector/examples.clj

Part 2 was inspired by...

"JVM Break Glass - Using a Clojure REPL to troubleshoot live Java/JVM processes", by Mathieu Gauthron

http://slides-euroclojure2014.matlux.net

Part 3.

"Generative testing" with test.check

Make assertions about your code

Let the test-library bombard your functions with generated test-data.

test.check reimplements QuickCheck (available for Erlang, Haskell)

https://github.com/clojure/test.check

Generators

generate random data, of a given type; starts off simply

Properties

for making general statements about data

Test the sort function

Run tests against the sort function

Example of a bad property

Run test.check...

Part 3 was inspired by...

"Generative testing with clojure.test.check", by Philip Potter

http://www.philandstuff.com/slides/2014/euroclojure.html

Videos from EuroClojure 2014

http://vimeo.com/euroclojure/videos

Call to Action

Document & Validate APIs with Schema & Swagger

Build an API with Compojure-api (or Octohipster)

Diagnose a static Java system with JVM-breakglass

Generate test data with test.check

Questions

@kevin_noonan

/