Your SlideShare is downloading. ×
0
Clojure/West 2013 in 10-ish mins                                                 Leonardo Borges                          ...
Day 1Saturday, 30 March 13
DDD in Clojure - Amit Rathore @amitrathoreSaturday, 30 March 13
DDD in Clojure - Amit Rathore @amitrathore                               OO can still teach us a thing or twoSaturday, 30 ...
DDD in Clojure - Amit Rathore @amitrathore                        In OO:                        - nouns                   ...
DDD in Clojure - Amit Rathore @amitrathore                        In OO:                       In Clojure:                ...
DDD in Clojure - Amit Rathore @amitrathore                        A few general guidelines for your domain:               ...
DDD in Clojure - Amit Rathore @amitrathore                        Namespace organisation at Zolo:                        -...
DDD in Clojure - Amit Rathore @amitrathore                        When you have no idea:                        - zolo.hom...
DDD in Clojure - Amit Rathore @amitrathore                        Still relevant:                        - SOLID principle...
RESTful Clojure - Siva JagadeesanSaturday, 30 March 13
RESTful Clojure - Siva Jagadeesan                               Richardson Maturity                               ModelSat...
RESTful Clojure - Siva Jagadeesan                               Richardson Maturity                               Model   ...
RESTful Clojure - Siva Jagadeesan                        Richardson Maturity Model:                        - Level 0      ...
RESTful Clojure - Siva Jagadeesan                        Level 0                        - GET /api?action=create_order&par...
RESTful Clojure - Siva Jagadeesan                        Level 1 - Resources                        - GET /orders?action=c...
RESTful Clojure - Siva Jagadeesan                        Level 2 - HTTP Verbs                        - GET /orders        ...
RESTful Clojure - Siva Jagadeesan                        Level 3 - Hypermedia                        - GET /orders        ...
RESTful Clojure - Siva Jagadeesan                        Level 3 - Hypermedia                        - GET /orders        ...
Engines of Abstraction - Jim DueySaturday, 30 March 13
Engines of Abstraction - Jim Duey                        Ah, one more monads talk!                        - Monoids in clo...
Engines of Abstraction - Jim Duey                         Who wants a monads talk at #cljsyd? :)Saturday, 30 March 13
Clojure in the Large - Stuart sierraSaturday, 30 March 13
Clojure in the Large - Stuart sierra                        Lisp is a ball of mud                        - not a lot of st...
Clojure in the Large - Stuart sierra                        Encapsulation anti-pattern:                                 ;;...
Clojure in the Large - Stuart sierra                        Encapsulation: use local-state instead                        ...
Clojure in the Large - Stuart sierra                        with-* macros:                        - assumes body starts an...
Clojure in the Large - Stuart sierra                        Anti-pattern - thread-bound state:                            ...
Clojure in the Large - Stuart sierra                        Local state with dynamic extent: nested with-resources        ...
Clojure in the Large - Stuart sierra                        When is it safe to use global Vars?                        - T...
Pedestal                        No point in showing it here. Go to http://pedestal.io/Saturday, 30 March 13
Beyond contracts - Paul deGrandisSaturday, 30 March 13
Beyond contracts - Paul deGrandis                        core.specs: automatically generate tests and                     ...
Day 2Saturday, 30 March 13
PuppetDB - centralised DB for Puppet developed in                                         ClojureSaturday, 30 March 13
PuppetDB - centralised DB for Puppet developed in                                         Clojure                        W...
Securing Clojure Web Apps/Services with Friend -                                         Chas EmerickSaturday, 30 March 13
Securing Clojure Web Apps/Services with Friend -                                         Chas Emerick                     ...
Securing Clojure Web Apps/Services with Friend -                                         Chas Emerick                     ...
Securing Clojure Web Apps/Services with Friend -                                         Chas Emerick                     ...
pallet.clj - Infrastructure project fileSaturday, 30 March 13
pallet.clj - Infrastructure project file                        pallet-lein plugin: https://github.com/pallet/pallet-lein  ...
clj-v8 and the dieter asset pipelineSaturday, 30 March 13
clj-v8 and the dieter asset pipeline                        JS/CSS minification, concatenation and cache busting:          ...
Day 3Saturday, 30 March 13
Ritz - The missing Clojure tooling:                           https://github.com/pallet/ritzSaturday, 30 March 13
Macros vs. MonadsSaturday, 30 March 13
Macros vs. Monads                        Synthread: https://github.com/LonoCloud/synthread                        - Presen...
Macros vs. Monads                        And it’s got lots of other useful macros:                         ->/do          ...
The End                            Questions?                                Leonardo Borges                              ...
Upcoming SlideShare
Loading in...5
×

Clojure/West 2013 in 30 mins

1,325

Published on

Clojure/West 2013 presented at the Clojure Sydney User Group in March 2013

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,325
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
10
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Clojure/West 2013 in 30 mins"

  1. 1. Clojure/West 2013 in 10-ish mins Leonardo Borges @leonardo_borges http://www.leonardoborges.com http://www.thoughtworks.comSaturday, 30 March 13
  2. 2. Day 1Saturday, 30 March 13
  3. 3. DDD in Clojure - Amit Rathore @amitrathoreSaturday, 30 March 13
  4. 4. DDD in Clojure - Amit Rathore @amitrathore OO can still teach us a thing or twoSaturday, 30 March 13
  5. 5. DDD in Clojure - Amit Rathore @amitrathore In OO: - nouns - processes owned by nouns - nouns are classes - processes are methodsSaturday, 30 March 13
  6. 6. DDD in Clojure - Amit Rathore @amitrathore In OO: In Clojure: - nouns - verbs - processes owned by nouns - domain model: functions that - nouns are classes transform data - processes are methodsSaturday, 30 March 13
  7. 7. DDD in Clojure - Amit Rathore @amitrathore A few general guidelines for your domain: - no side-effects - no dependencies on external services - validate outside the model boundary (validateur, bouncer, clj- scheme) - no illegal state in domain functions (slingshot)Saturday, 30 March 13
  8. 8. DDD in Clojure - Amit Rathore @amitrathore Namespace organisation at Zolo: - main namespace called core (most projects do this) - zolo.models.(user | contacts | …) - zolo.gateway.(facebook | linkedin | twitter | …) - zolo.utils.(calendar | strings | maps | …) - zolo.api.* - zolo.services.(user-service | …)Saturday, 30 March 13
  9. 9. DDD in Clojure - Amit Rathore @amitrathore When you have no idea: - zolo.homeless.*Saturday, 30 March 13
  10. 10. DDD in Clojure - Amit Rathore @amitrathore Still relevant: - SOLID principles - Few public fns (lots of private, helper fns) - small fns (3-4 lines) - optimize for readabilitySaturday, 30 March 13
  11. 11. RESTful Clojure - Siva JagadeesanSaturday, 30 March 13
  12. 12. RESTful Clojure - Siva Jagadeesan Richardson Maturity ModelSaturday, 30 March 13
  13. 13. RESTful Clojure - Siva Jagadeesan Richardson Maturity Model ?Saturday, 30 March 13
  14. 14. RESTful Clojure - Siva Jagadeesan Richardson Maturity Model: - Level 0 - Level 1: Resources - Level 2: HTTP Verbs - Level 3: HypermediaSaturday, 30 March 13
  15. 15. RESTful Clojure - Siva Jagadeesan Level 0 - GET /api?action=create_order&param1=val1 - GET /create_order?param1=val1Saturday, 30 March 13
  16. 16. RESTful Clojure - Siva Jagadeesan Level 1 - Resources - GET /orders?action=create&param1=val1Saturday, 30 March 13
  17. 17. RESTful Clojure - Siva Jagadeesan Level 2 - HTTP Verbs - GET /orders - POST /orders ( includes body payload)Saturday, 30 March 13
  18. 18. RESTful Clojure - Siva Jagadeesan Level 3 - Hypermedia - GET /orders - POST /orders ( includes body payload)Saturday, 30 March 13
  19. 19. RESTful Clojure - Siva Jagadeesan Level 3 - Hypermedia - GET /orders - POST /orders ( includes body payload) { "id": 1, "items": [ { "id": 2 } ], "link": { "rel": "delete", "href": "/orders/1" } }Saturday, 30 March 13
  20. 20. Engines of Abstraction - Jim DueySaturday, 30 March 13
  21. 21. Engines of Abstraction - Jim Duey Ah, one more monads talk! - Monoids in clojure - list, concat, set, union, hash-map... - Functors - a context datatype and a fn (fmap) to apply a function to each value inside that context - Applicative Functors - a context datatype and two functions: one that wraps a value in the context type amap applies fns wrapped in the context to parameters wrapped in the context - Monads - context data type, fn that wraps values, fn (bind) to apply a fn to wrapped values. The applied fn takes a value and returns a wrapped value.Saturday, 30 March 13
  22. 22. Engines of Abstraction - Jim Duey Who wants a monads talk at #cljsyd? :)Saturday, 30 March 13
  23. 23. Clojure in the Large - Stuart sierraSaturday, 30 March 13
  24. 24. Clojure in the Large - Stuart sierra Lisp is a ball of mud - not a lot of structure: namespaces and vars. That’s it. - namespaces: not first-class modules - def and defn are global by default Also talked about encapsulation and global stateSaturday, 30 March 13
  25. 25. Clojure in the Large - Stuart sierra Encapsulation anti-pattern: ;; Tempation to share it promiscuously! (def state-a (ref {})) ;; Hidden dependencies (defn op1 [] (dosync (alter state-a ...)))Saturday, 30 March 13
  26. 26. Clojure in the Large - Stuart sierra Encapsulation: use local-state instead ;; Well-defined initial state. Go together semantics (defn constructor [] {:a (ref {}) :b (atom 0)}) ;; Makes function dependencies clear (defn op1 [state] (dosync (alter (:a state) ...)))Saturday, 30 March 13
  27. 27. Clojure in the Large - Stuart sierra with-* macros: - assumes body starts and ends in a single thread - assumes doesn’t return lazy seqs - limits caller to one resource at a timeSaturday, 30 March 13
  28. 28. Clojure in the Large - Stuart sierra Anti-pattern - thread-bound state: (def ^:dynamic *resource*) (defn- internal-op1 [] ... *resource* ...) ;;another hidden dependency (defn op1 [arg] (internal-op1 ...))Saturday, 30 March 13
  29. 29. Clojure in the Large - Stuart sierra Local state with dynamic extent: nested with-resources ;; Pass around "context" argument (defn op1 [context] ;; not confined to a single thread ;; acquire resources (let [resource (::resource context)] ;; use namespace qualified keys (assoc context ::result1 ...))) ;; still need to manage resource lifecycle (defn finish [context] (update-in context [::resource] dispose))Saturday, 30 March 13
  30. 30. Clojure in the Large - Stuart sierra When is it safe to use global Vars? - True constants: (def ^:const gravity 6....) - True singletons: (def runtime (Runtime/getRuntime)) - For REPL dev - Private dynamic vars are OK: (def ^:private ^:dynamic *state*) (binding [*state* ....] ...)Saturday, 30 March 13
  31. 31. Pedestal No point in showing it here. Go to http://pedestal.io/Saturday, 30 March 13
  32. 32. Beyond contracts - Paul deGrandisSaturday, 30 March 13
  33. 33. Beyond contracts - Paul deGrandis core.specs: automatically generate tests and documentation and contracts from REPL explorations: https://github.com/ohpauleez/sterlingSaturday, 30 March 13
  34. 34. Day 2Saturday, 30 March 13
  35. 35. PuppetDB - centralised DB for Puppet developed in ClojureSaturday, 30 March 13
  36. 36. PuppetDB - centralised DB for Puppet developed in Clojure Why Clojure? - Issues with Ruby: slow, GIL, garbage collection Puppet DB is a layer on top of PostgreSQL Write pipeline: - async, parallel, MQ-based, automatic retry Read pipeline: - DLS, AST-based, transferred over the wire using JSON - you can write your ownSaturday, 30 March 13
  37. 37. Securing Clojure Web Apps/Services with Friend - Chas EmerickSaturday, 30 March 13
  38. 38. Securing Clojure Web Apps/Services with Friend - Chas Emerick - Authentication and Authorization library for Clojure - Ring middlewareSaturday, 30 March 13
  39. 39. Securing Clojure Web Apps/Services with Friend - Chas Emerick Batteries included: - Authentication workflows - form-based "interactive" login - HTTP basic (Digest, soon) - OpenId (Google, Yahoo, Wordpress etc...) - "Channel enforcement" (e.g. require HTTPS) - Authorization Options - Roles based on Clojures ad-hoc hierarchies - functions, macros, and ring middleware for enforcinf role-based auth policy - Arbitrary imperative controlSaturday, 30 March 13
  40. 40. Securing Clojure Web Apps/Services with Friend - Chas Emerick https://github.com/cemerick/friendSaturday, 30 March 13
  41. 41. pallet.clj - Infrastructure project fileSaturday, 30 March 13
  42. 42. pallet.clj - Infrastructure project file pallet-lein plugin: https://github.com/pallet/pallet-lein create pallet.clj file > lein pallet up <-- local or on EC2...Saturday, 30 March 13
  43. 43. clj-v8 and the dieter asset pipelineSaturday, 30 March 13
  44. 44. clj-v8 and the dieter asset pipeline JS/CSS minification, concatenation and cache busting: https://github.com/edgecase/dieterSaturday, 30 March 13
  45. 45. Day 3Saturday, 30 March 13
  46. 46. Ritz - The missing Clojure tooling: https://github.com/pallet/ritzSaturday, 30 March 13
  47. 47. Macros vs. MonadsSaturday, 30 March 13
  48. 48. Macros vs. Monads Synthread: https://github.com/LonoCloud/synthread - Presented as an alternative do the state monad: (require [synthread :as ->]) (-> {} f1 f2 f3)Saturday, 30 March 13
  49. 49. Macros vs. Monads And it’s got lots of other useful macros: ->/do ->/if ->/when ->/for ->/assoc ->/update-inSaturday, 30 March 13
  50. 50. The End Questions? Leonardo Borges @leonardo_borges http://www.leonardoborges.com http://www.thoughtworks.comSaturday, 30 March 13
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×