![]() |
9 years ago | |
---|---|---|
clojure-objc-sample | 9 years ago | |
core | 9 years ago | |
ios-client | 9 years ago | |
pubsub-service | 9 years ago | |
resources | 9 years ago | |
web-client | 9 years ago | |
MIT-LICENSE.txt | 9 years ago | |
README.md | 9 years ago | |
project.clj | 9 years ago | |
project.org | 9 years ago |
An industry grade project using clojure everywhere.
To be presented at ForwardJS 4.
A baseline Clojure stack that runs on any and all platforms, that is nice to develop and horizontally scalable.
The fundamental data structures representing code and data; nothing more, nothing less.
Based on reagent, which using a special atom as the client side sate. Stacks a nice pattern for composable reactive processing of UI actions. Plays well with CQRS and Doman Driven Design.
A separation of concerns model for use on all platforms.
We use a custom lifecycle dispatcher that uses multimethods, as suggested by the author's documentation.
Actually this style is much slower than Protocol based dispatch, but very nice to work with.
(ns my.component
(:require [clojure.tools.logging :refer [debugf infof]
[component :refer [react-to] :as c]))
(defmulti react)
; namespaced keywords for dispatch
; (when (= *ns* 'my.component) (= ::my-message :my.component/my-message))
(defmethod react :component/start [component]
(debugf "Starting my.component"))
(defmethod react :component/stop [component]
(debugf "Stopping my.component"))
(defmethod react ::my-message [component event]
(infof "Got a event, what are we going to do about it? %s" event))
; alternative syntax (experimental)
(react-to ::my-message [event]
(infof "Got an event, what are we going to do about it? %s" event))
A comparable protocol-based approach loses some of its niceness, but may win in dispatch speed. A macro could be constructed to use an in-memory map based dispatch (ie. constant lookup time).
(ns my.component
(:require [clojure.tools.logging :refer [debugf infof]
[component :refer [event-key Lifecycle]]))
(defrecord Reactor [dispatch]
Lifecycle
(start [component]
(debugf "Starting my.component"))
(stop [component]
(debugf "Stopping my.component"))
React
(react [component event]
(when-let [handler (get dispatch (event-key event))]
(handler component event))))
(defn- my-message [component event]
(infof "Got an event, what are we going to do about it? %s" event)
(def component (->Reactor {::my-message my-message}))
;(react component event)
Deploy non-Docker packages. Nothing in particular against Docker, but I don't see the case for it with Marathon and debootstrap.
familiar with it. yaml basaed DSL. as simple as you want it to be. downside? not edn.
APT debootstrap
IntelliJ Idea with Cursive (free licenses for OSS!)
emacs with clojure-mode and org-mode
homebrew + cask
Thanks to all the authors and contributors of the projects used and literature referenced.