Holy Dev Newsletter March 2022

Welcome to the Holy Dev newsletter, which brings you gems I found on the web, updates from my blog, and a few scattered thoughts. You can get the next one into your mailbox if you subscribe.

What I am watching

I have been long interested in formal methods and better way to make sure that our algorithms and code are correct. TLA+ is a popular high-level language for modeling and testing the design of algorithms and this free TLA+ video course by its father and Turing Award winner Leslie Lamport is really TLA+ By Leslie Lamport (won the Turing Award) Approachable, engaging, motivating.

  • TLA+ is “A language for high-level modeling of digital systems.” [such as altos, programs] & has tools for checking those models, primarily the TLC model checker

  • Model as a state machine

  • Model at a higher level to check your design (algorithm, …)

  • “TLA+ is an elegant, expressive language for describing state machines.”

  • “For concurrent and distributed systems, if you design them and care if they work, you should use TLA+”

  • “TLA+ will teach you to be better at abstraction.”

  • Brannon Batson said ±-: The hard part of learning to write TLA+ specs is learning to think abstractly about the system.

Fulcro

I am working on adding a plugin for the open-source graph database Asami to Fulcro’s Rapid Application Development addon, so that you can use a flexible, embedded, in-memory or on-disk database for your RAD projects. I hope to have an alpha version finished soon.

Other

I have released a GitHub Action CljDoc Check that runs the CljDoc analyzer (read the announcement in Slack) on your code to verify that cljdoc will be able to import it and display its API docs. I have also added it to Fulcro (currently for PRs only).

Gems from the world wide web

👓 KingMob/TrueGrit: A data-driven, functionally-oriented, idiomatic Clojure library for using Resilience4j. [clojure, library, performance]
A data-driven, functionally-oriented, idiomatic Clojure library for using Resilience4j, the top Java library for robust systems. Includes circuit breakers, bulkheads, retry policies, timeouts and rate limiters. It’s been battle-tested in production for years.

👓 S3 Compatible Object Storage Powered by Web3 [web3, SaaS, data storage]
An alternative to AWS S3 for file storage based on web3 technologies (such as Sia and IPFS), encrypted and geo-redundant. 5GB for free and 1TB of storage+transfer for $6/month (S3 costs ± $23 for storage only).

👓 Clojure - First Impressions [clojure, experience]
Interesting, short read by Franz Neubert. Switching from Scala to Clojure, one month in and getting good handle of things. Simpler, more obvious (but slightly more repetitive). Missing static typing a little but REPL and tests make up for it. REPL being the most valuable tool. Fast feedback loop, restartless. "There isn't anything I don't like about Clojure."

👓 Throwaway the Irrelevant - CoRecursive Podcast [software development, functional programming, opinion]
A podcast with a transcript about multiple topics, including general x specialized code, from the perspective of Haskell & friends. One reason for writing more general, polymorphic code is that you know less about the input and thus can do less to it =>
> [..] you make it harder to introduce bugs by cutting down on the size of the implementation space, but you also make the code much more reusable. [..] you’re still making it harder for that function to go wrong.
> So, polymorphism is how we throw details out of our implementation space to constrain the space of implementations and to make our code much more reusable and easier to get correct. And then, principled type classes [JH: ~ minimal types leveraging algebraic principles] are how we add structure back in, just enough structure to be able to solve the problem at hand, no more.
Though thinking at a higher level of abstraction / polymorphism and reading such code is a skill that needs to be learned.
Idea: more abstract/polymorphic return types instead of concrete ones, just something that satisfies a set of rules and the concrete implementation is picked later, when we know the wider context => fewer conversions like Rust's Option <_ result="result" etc.="etc." _="_" span="span">
And soem stuff about Scala and monads :)
(Via Fredrik R. Thanks!)

👓 oha — Rust application // Lib.rs [rust, tool, performance] - Ohayou(おはよう), HTTP load generator, inspired by rakyll/hey with tui animation | Rust/Cargo package
HTTP load generator work a nice textual UI and progress indicator, written in Rust.

👓 Apache ECharts [data visualization, library, javascript]
According to ClearPeaks: Apache ECharts is one of the most advanced frameworks for building charts and visualisations, simplifying the inclusion of highly customisable charts [..]. ECharts comes with ready-to-use interactive components to perform operations such as multi-dimensional data screening and zoom-in zoom-out views, and it can also display any kind of text, image, or shape. With the visualMap component, it’s possible to map data of different dimensions to colour, size, transparency, shading, etc. thanks to its rich visual coding. ECharts can present a visualisation of huge amounts of data by using an incremental rendering approach and optimising all aspects. Furthermore, interactions such as scaling and morphing are all fluid. Data can be delivered incrementally via WebSockets. Almost 40 different types of charts including maps/geo. High performance. Mobile-friendly UX. Declarative. Support for custom event handlers. Can render into both Canvas and SVG. Server-side rendering (on Node.js, into an SVG).
Apache ECharts is an intuitive, interactive, and powerful charting and visualization library ideally suited for commercial-grade presentations. The project originated in 2013 at Baidu and entered the Apache Incubator in January 2018, graduating from it in 2021. It is also being used in Apache Superset, the data exploration and visualization platform.
Cons: The English API docs seem not to have been updated for v5 in a year.

👓 lambdaisland/cljbox2d [clojure, library, clojurescript]
Idiomatic (data instead of imperative API) and cross-platform Clojure/Script version of the Box2D physics engine API. You most likely want to combine it with a graphics library to show something on the screen. We bundle some helpers to get you started on Quil or Clojure2D. The Clj backend jBox2D can do a lot, including Rigid body physics, Gravity, Persistent contact solver, Sliding friction, Boxes, circles, edges and polygons, Motors, Continuous collision detection, Liquid particle simulation. The Cljs backend Planck.js's site is also revealing.

🎥 Gene Kim on how Clojure and Datomic made him a happy programmer again. He is a great speaker and it is a delightful, lightweight...
Gene Kim on how Clojure and Datomic made him a happy programmer again. He is a great speaker and it is a delightful, lightweight talk. Includes SQL horror stories.

👓 Introducing Ladle | Ladle [tool, javascript, productivity]
Ladle by Uber is a would-be successor to (and drop-in replacement for) Storybook with focus on much better performance (production build time, dev start time) and with other improvements such as simpler usage (a single package and command). It achieves that e.g. by leveraging native browser support for ES Modules (and ditching Webpack in favour of Vite).
Storybook and Ladle are tools for testing and showcasing React components in isolation, with their various states and settings.

👓 jarohen/chord: A library designed to bridge the gap between the triad of CLJ/CLJS, web-sockets and core.async. [clojure, library, clojurescript]
A core.async channel over websockets (the backend via http-kit). Support for encoding messages with Transit, EDN, Fressian, JSON, raw strings.

👓 Tea | Automated Statistical Analysis [statistics, data analysis]
A Python library and DSL for testing hypothesis on data, where Tea itself infers the applicable, valid statistical tests to apply. (Currently it can do Null Hypothesis Significance Testing but more kinds of analyses are coming.) You load the data (e.g. from CSV), describe the variables in the data (type: nominal, range, ...), describe your assumptions about the data (such as normal distribution of some variables), how it was collected (e.g. observational study or experiment), the independent/dependent variables, and the hypothesis (e.g. that the probability of a particular outcome is higher for a particular value of an independent variable) - see this demo.
I could not find documentation other than community examples but perhaps there are API docs in the library. It is possible that the paper on Tea is intended as the main reference. There is also a 2019 talk on Tea and there is a discussion forum.

👓 fmnoise/flow: Functional (and opinionated) errors handling in Clojure [clojurescript, clojure, library] - Functional (and opinionated) errors handling in Clojure - GitHub - fmnoise/flow: Functional (and opinionated) errors handling in Clojure
Error handling with early return for transformation pipelines. Works with standard threading macros, using custom wrappers for each step that check for Exception vs anything else. A couple of helpers for catching, producing, and dealing with exceptions (including the stack trace-less and thus cheap custom Failure). Similar to failjure to some extent.
Ex.: (->> (check-user req) (then (fn [_] (check-entity-id req))) (then #(check-entity-exists db %)) (then #(check-entity-access % (:user req))) (then #(update-entity! % (:params req))) (else format-error)))

👓 steffan-westcott/clj-otel: An idiomatic Clojure API for adding telemetry to your libraries and applications using OpenTelemetry. [devops, clojure, library, monitoring]

👓 7GUI tasks implemented in plain JS [webdev, comparison, framework]
7GUIs (7 Graphical User Interfaces) is a programming benchmark to compare implementations in terms of their notation. 7GUIs defines 7 tasks that represent typical challenges in GUI programming. This site implements the 7 tasks using vanilla HTMLCSS & JavaScript

👓 Epic Castle [wasm, clojurescript, productivity]
Hot loading C wasm with heap preservation

Hot loading C wasm into the browser while preserving the state of the heap - let the browser code (here ClojureScript) manage the WASM heap so that it survives reloads of the wasm code.

👓 barracudanetworks/lighthouse: A data-driven Kubernetes pre-processor [devops, tool]
Generate Kubernetes manifests by combining EDN data instead of templating YAML. Lighthouse takes the approach of using EDN data structures in a directory tree with simple inheritance rules to support generating manifests in a flexible and reliable manner.

👓 liquidz/dad: Small configuration management tool for Clojure [devops, tool, clojure]
A simple configuration management tool for Linux/Mac, available as a binary or a Babashka pod. It can create directories and files (possibly from templates), download, execute commands, execute git, install packages (via Homebrew on Mac). You can and use your own (idempotent!) functions.

👓 Deploy app servers close to your users · Fly [devops, paas]
A newish (2017) app deployment platform, somewhat similar to Heroku, but smarter - the application is started/moves to the location nearest to the current user demand, scaling the app up and down (vertically and horizontally) as necessary. You can deploy one of the supported app types (Go, Node, Remix, ..) or any Docker container using either their CLI or the web interface. The VMs can use a persistent storage and Fly can also run a clustered PostgreSQL for your app. Apps within an organization can communicate over a private network (and you can ssh into any!). An interesting, multi-national team, cheap pricing with a free tier. You can read about Fly's architecture (and their use of Firecracrer MicroVMs, Rust, and WireGuard VPN).
We make it easy to run full-stack apps—any app, in any framework—close to your users. We're a simple and powerful way to run any application, with modern dev UX, advanced Postgres deployments with replication, and app scaling knobs that don't require you to learn Terraform to use. But we're especially shiny for frameworks that benefit from geographic distribution.

👓 ribelo/fatum [clojure, library, clojurescript]
Another Clojure/Script library for working with errors as data in pipelines, inspired by flow and failjure, using a cheap, stacktrace-less Exception to represent errors. Example:
(defn create-user "completely meaningless but well nested code" [req] (-> req (f/fail-if {:staus 500} "something went wrong") (f/fail-if {:staus 404} "something went even worse") (f/then-if {:status 200} (comp make-user :body)) (f/fail-if (complement valid-user?) "invalid user" (partial array-map :user)) (f/then (partial update-db :add-user)) (f/fail-if (complement :success?) #(find % :message)) (f/maybe-throw)))

👓 phronmophobic/dewey: Index of Clojure libraries available on github. [clojure, tool]
Index of Clojure libraries available on GitHub, for including in a project as a git dependency in deps.edn. Machine-friendly.

👓 Liverm0r/robot: Clojure wrapper to simplify writing desktop scripts with java.awt Robot and Clipboard [clojure, tool, productivity, automation]
Clojure wrapper fro java.awt.Robot for desktop manupulation - you can type keys / special keys / text ⌨️, copy & paste using the clipboard, move / read / click the mouse 🐁, get a map of key codes to key names (char), get the color of a pixel. You could also use the Robot directly to take a screenshot.
An alternative to Babashka's obb for Mac automation, I guess, but cross-platform.

👓 Home [standard, webdev]
Interesting fledgling standardization effort. The purpose of Open UI to the web platform is to allow web developers to style and extend built-in web UI controls, such as dropdowns, checkboxes, radio buttons, and date/color pickers - so that they can stop reinventing these to give designers full control over their appearance and behavior. Thus Open UI aims to fully specify the component parts, states, and behaviors of the built-in controls and provide test suits. Long term, they hope that Open UI will establish a standard process for developing high-quality UI controls suitable for addition to the web platform.
It can be also useful to look at their research when designing a new UI element.

👓 Ultra [javascript, library, deno, reactjs]
A modern, full-stack JS/TS React 18 framework with streaming and Deno Deploy support. Uses ESM -> no bundling. Leverages Suspense and React 18' Streaming HTML and Selective Hydration so that (server-side rendered) parts of the app can load and become interactive in parallel, independently from each other. It uses SWR for easy to use data fetching and the tiny Wouter for client & server-side routing. TypeScript and JSX.

👓 Secure and immutable development environments with Dev Containers [security] - "But, it works on my machine" "If I install this NPM package, is it going to rm -rf / or infect me with a cryptominner?"
I find it always scary to install npm - or any other - packages that could include any evil code. A solution is to run your dev env in a sandbox. VS Code with its Remote - Containers makes that simple and convenient - just add a file linking to a Dockerfile / image, what plugins to install, what ports to expose and open the project in Code, which will automatically offer to open it in the container. (Sylvain has also a good tip to run set up as root as Code needs but then switch to an unpriviledged user for increased security.)

👓 Micro:bit Educational Foundation [kids, learning]
A Arduino-like micro-computer aimed at kids 7-11 / 11-14, supporting the graphical Scratch, Python, and Microsoft MakeCode, a free online learn-to-code platform. The micro:bit site offers a bunch of lessons and projects. There is a great selection of accessories such as a speaker, LED display, motor, a tiny, sensor-equiped "car" (that you stick microbit into), a lego-like crane.

👓 Hedy - A gradual programming language [kids, learning]
Hedy is a great bridge between a graphical coding environment such as Scratch and Python. Inspired by how we learn to write, it starts with a minimal syntax that becomes progresively more elaborate (but also powerful), as you progress. Both the site and language keywords can be switched to your native language - an often requested feature even by kids good in English. At the final level, you are essentilly writing Python. There is a bunch of exercises at each level - you can either do them all or stick to a few and evolve them from level to level.

👓 Tonic.ai, The Fake Data Company [tool, SaaS, testing, ai]
Via Console.dev: Fake data platform. Generates realistic fake data through analysis of the real data. Understands field types with a large range of generators e.g. addresses, cross-table sums, UUIDs, etc. Can implement differential privacy and statistical relationships between fields / foreign keys. Maintains consistency through constraints, cardinality and duplication. SaaS or on-prem. Generated data is exported directly to the source database - no option to download rather than export.

👓 Introduction - Difftastic Manual [tool]
Difftastic (source on GitHub) is a diff tool that understands syntax. It supports over 20 languages including Clojure, CSS, Go, Java, JS + JSON, Rust, TS.

👓 The Programmer's Brain [book]
An interesting book (by the author of the Hedy educational programming language): "Your brain responds in a predictable way when it encounters new or difficult tasks. This unique book teaches you concrete techniques rooted in cognitive science that will improve the way you learn and think about code." It gets very positive reveiws.

--

Thank you for reading!


Tags: newsletter


Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob