Fix is to link openssl@1.1 as openssl
1069 cd /opt/homebrew/opt # OR WHEREVER?
1070 rm openssl
1071 ln -s openssl@1.1 openssl
(ns cnd.analyse-code | |
"Use rewrite-clj zipper to walk code. | |
Niggles | |
* Doesn't use the (ns...) aliases to resolve aliases to full paths. | |
" | |
(:require [clojure.java.io :as io] | |
[clojure.zip :as zip] |
Fix is to link openssl@1.1 as openssl
1069 cd /opt/homebrew/opt # OR WHEREVER?
1070 rm openssl
1071 ln -s openssl@1.1 openssl
{:deps {clj-jgit/clj-jgit {:mvn/version "1.0.1"} | |
org.clojure/data.csv {:mvn/version "1.0.0"}}} |
Looking at some old code there were a couple of undesirable features. One particular code smell is a good motiviating example: handlers calling other handlers.
It encourages the developer to "register handlers as reusable components" but that's a pretty clumsy way to write utilties. Over time those util handlers were collecting barnicles and were becoming very hard to reason about or refactor.
With the advent of :fx
we have a clean composable alternative with some desirables traits.
My app has three namespaces (app.handlers, app.actions and app.utils)
Some code to generate an SQLite dump from a database via a JDBC connection.
First we need a deps.edn
file
{:deps {org.clojure/java.jdbc {:mvn/version "0.7.12"}
org.xerial/sqlite-jdbc {:mvn/version "3.34.0"}
com.oracle.database.jdbc/ojdbc8 {:mvn/version "21.1.0.0"}}}
Put a clj-statechart somewhere in my mobile app! Learn from the process.
Certainly better for orchestrating interesting behaviour when compared with simple re-frame handlers. The registration process has lots of corner cases. More of those are covered. The code is by rights more maintainable. I was able to refactor as I expanded it with confidence. So lots of wins there.
Actions tend to be hardcoded to a specific use case. Primarily because they have to dispatch an event which the fsm expects.
(def machine
(fsm/machine
{:id ::traffic
:initial :red
:states {:red {:on {::tick :green}}
:green {:on {::tick :orange}}
:orange {:on {::tick :red}}}}))
(ns app.statecharts | |
(:require [app.utils :as utils] | |
[statecharts.core :as fsm] | |
[interop.anomalies :as anom] | |
[re-frame.core :as rf])) | |
; Guards | |
(defn offline? [state event] (not (get-in state [:db :app/online?]))) | |
(defn has-errors? [state event] (seq (utils/login-form-errors (get-in state [:db :app/login-form])))) | |
(defn incorrect? [state event] (anom/incorrect? (:data event))) |
package.json
{
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@blueprintjs/core": "^3.22.0",
"@blueprintjs/datetime": "^3.15.1",