Include interactive Clojure/script code snippets in a web page with SCI & friends

Editor screenshot

I have long dreamt about having interactive code snippets of Fulcro in my teaching materials. Showing people code they could modify and see it render right next to it. Fulcro is a ClojureScript library, but it uses some heavy macros - and those typically require JVM Clojure. Well, not anymore. I was able to rewrite them into Borkdude’s Small Clojure Interpreter (SCI) dialect of Clojure. I.e. I can ask SCI to evaluate a piece of code with these macros, which SCI will macro-expand into more cljs, and execute. With SCI, my Fulcro sci.configs, CodeMirror, and Nextjournal’s clojure-mode, I can have a beautiful in-page editor with code evaluation. And I will show you how to do the same, for your blog.

Continue reading →

Accessing Google API with OAuth2 and a service account from Clojure

How to turn a service account’s service.json into an access token you can actually use to call Google APIs, when you don’t want to use Google’s SDK? With Buddy’s JWT it is pretty simple, and Tim Pratley’s HappyGAPI will show us how to do it. (I believe that the same approach would work with other OAuth providers, just with changes to some of the values.)

Continue reading →

When not to use Fulcro?

Fulcro is great for writing non-trivial, full-stack business SPA web applications, which display and modify data from a general data store. But it can’t possibly be perfect for every kind of web app. So when is it less then a perfect fit? Possibly still usable, but not as beneficial?

Continue reading →

Book highlights: Escaping the Build Trap: How Effective Product Management Creates Real Value

It doesn’t matter how good you are at making software, if you are building the wrong thing. Melissa Perri’s Escaping the Build Trap is an excellent book about fostering culture focused on customer’s problems and producing value. A way too common pitfall is focusing on building features, based on vague, unverified ideas of what customers need or want. (This is the build trap, a.k.a. feature factory trap.) But, as the books says, we should love the problem, not the solution. And we need to assume that we don’t know perfectly what the customers need. I would add, that we can surely build tons of useful features - but the hard question is, which time & effort investments are the most valuable ones, and where the cost of writing and maintaining the code and the consequential increase in complexity are not worth it. Remember, every line of code is a liability.

I have already been pretty much of this mindset (after all, I have read and appreciated The Lean Startup years ago), but still I learned useful things, and remembered others. Some highlights follow. They are rather personal, for a more objective and thorough overview, I highly recommend Julia Park’s 11 Key Learnings from this book.

Continue reading →

Get insight into Pathom 3 in Fulcro with Pathom Viz

Fulcro has great dev tooling in Fulcro Inspect, however the part for exploring Pathom resolvers and attributes - its Index Explorer - is not compatible with Pathom 3. Here we learn what to do about it.

Continue reading →

First craft a language then build your software

Babel Tower

A language suit for purpose enables us to express our thoughts clearly and concisely. In programming, this language consists of our actual programming language, the libraries we use, and the abstractions we build. I believe that most of the incidental complexity in code stems from an unsuitable language. A misfit language forces you to speak in a lengthy and roundabout way, never quite getting at what you actually want to say.

Imagine you lacked the word "snow" and had to always say "white, fluffy, crystalline, frozen water". Now imagine you are writing instructions for waxing of cross-country skiis and you lack the words for snow, skiis, and the different kinds and states of snow. How verbose and incredibly hard to understand that would be! And this is exactly how most of our code looks. As Alan Kay puts it: "Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves." [Kay] Let’s explore this idea further.

Continue reading →

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