Dec 6 2019

Garden Planner - Switching to Clojure(Script)

I have 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 updated: Friday, December 6th, 2019

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 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 application 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, converting the data from one format to another is pointless. I am confident this is possible, but I don't have experience with it. I might have to make an EDN - JSON - EDN conversion.

A lingering issue is the representation of relations in the schema form. 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.

Explore by Tag

On each tag page, you can find a link to that tag's RSS feed so you only get the content you want.