Garden planner - switching to Clojure(Script)

I liked Clojure since the first day I met it. This week, for the first time, I went seriously far from evaluating a few expressions in the REPL.

ClojureScript and hiccup in an app page view.

Last week I had a first draft of the schema, and I did this project in Clojure without considering how difficult it would be. I am under no illusion—this will not be an easy journey. But it will be a fun one!

So, having gone the Clojure route, I've done the basics—set up my local machine for Clojure development, got myself into the Clojurians Slack channel, and started looking at the schema again.

The first thing I did was to convert the schema to edn instead of graphql. I will no longer be using GraphQL because it simply makes little sense to me to add the additional dependencies only to operate in the Neo4J database. A friend was nice enough to open-source his Neo4J driver, so I will use it.

The edn format works well for me and my needs with this schema. It's also straightforward to read if indented correctly. For all things Clojure, I use the Calva extension for VS Code, which works like a charm and quickly cleans up my messy edn or parens.

Processing that schema into one that the front-end will receive for generating forms was not as hard as I had expected, nor as messy as I thought it would be. Keywords, combined with built-in Clojure functions, made life fairly easy. A quick pair-programming session with my better half helped with understanding some syntax issues. Yey for teamwork!

Now I have to figure out how to send EDN formatted data through web sockets - so I don't have to deal with encoding/decoding. Since the front-end is also in Clojure, it's pointless to convert the data from one format to another. I am confident this is possible. I just need to find out how exactly to do it in my project.

A lingering issue is the representation of relations in the form schema. I should be able to make assumptions about the node label, but I'd rather not.

Front-end-wise, switching from Vue.js to Reagent is no trivial affair. I must say that I enjoy the REPL tremendously, but I miss the Vue.js Developer Tools. I guess I will just have to learn how things work in React / Reagent.

© Anca I/O 2011-2023. All rights reserved.