Posts
Experiments part 9
Previously in Experiments, part 8,… I got SSE working on the server-side and was happy about that.
Now… Tonight, I’m going to hook that up to ReactJS. I am questioning how to do that, though. I know that I want to get, and then set the state of the root component. I wonder what ReactDOM.render returns. Does it return the actual component?
Time for an experiment var component = ReactDOM.
Posts
Experiments part 8
Previously in Experiments, part 7,… I switched from Compojure to Pedestal in order to take advantage of its support for Server-sent Events. I want to use that to send background updates to the client on completion of a task.
This took a while I expected this feature to be done very quickly. Up to now, every library I had to integrate into my app did so nearly seamlessly. It was a matter of reading the appropriate section of the library’s documentation, doing a few REPL experiments, integrating the code and doing manual testing.
Posts
Experiments part 7
Previously in Experiments, part 6,… I used core.async to background a slow task, namely fetching the HTML of the saved URL and parsing out the <title> tag.
Up next… I need to do a bit of yak-shaving. As I alluded to before, I want to use Server-sent Events, to send the above background update to the client on completion. To do that, I have to switch libraries. Up to now, I’ve used Compojure, but after reading up on SSE and Clojure, I have been convinced that I need to use either Pedestal or yada.
Posts
Experiments part 6
Previously in Experiments, part 5,… I added a synchronous way of fetching a title from an HTML page, using Enlive.
Let’s async this thing OK, I want to get the quick response back, but still keep this new functionality. This is where I introduce core.async.
;; in project.clj [org.clojure/core.async "0.2.374"] ;; in handler.clj's require (:require [clojure.core.async :as async :refer [>! < ! chan go]]) This library is based on concepts presented in a book called Communicating Sequential Processes.
Posts
Experiments part 5
Previously in Experiments, part 4,… I added a form for creating new links. Instead of introducing a database, the links are being added to an atom.
In tonight’s installment… I am going to start working the trickier parts of bookmarking links, retrieving a title of a link and possibly the body. At some point, I’ll have to commit to a database, but I can push that off for at least one more post.
Posts
Experiments part 4
Previously in Experiments, part 3,… I set up a card-based UI and added a few more records to my test data set.
In tonight’s installment… It’s still (mostly) about the UI. I’m going to create a form for adding new links. I will be appending the links to the test data set and push dealing with the DB until later.
Onward, then… Up to now, this has been a read-only app.
Posts
Experiments part 3
Previously in Experiments, part 2,… I set up dummy data on the backend, then created the initial set of components on the front end that consume that data.
In tonight’s installment… It’s all about the UI. I’m going to add a few more links to the dummy set, then set up my card-based UI.
Onward, then… Firstly, I’m going to add 3 more links to my dataset so that I can play with the layout.
Posts
Experiments part 2
Previously in Experiments,… I set up a Clojure backend and installed ReactJS front-end. I also created a basic skeleton, but that didn’t actually show up, because JSX.
In tonight’s installment… Firstly, I’m going to fix up the transpiling from JSX to JS, so that changes to the React front-end are picked up and shown. I’ll add the expected route, but serve dummy data. Then, I’ll get the front-end to consume that data.
Posts
Experiments, part 1
A different tack I’ve been very lucky to have had steady employment using Ruby and Rails. At times, it felt like cheating. How can I have so much fun and get paid well for it?
Continuing my search for that fun high, I started looking at other technologies. I’ve been an admirer of Clojure for a while. Its approach to composing programs seems to suit how I think software development should be.
Posts
Passing lambdas as parameters
Background At my current job, I have been working on merchants stores’ integration with third parties. As a part of this task, I found that I needed to ensure that our app batches API calls to the third party. After doing a quick measurement, I found that batching API calls lowered the processing time by about 2x-5x when compared to doing the same calls in sequential order. However, whereas sequential processing had a clear approach of dealing with successful and failed calls, the batch call had none of that.