1. 3
  1.  

  2. 1

    I’m a fan of REPL-driven development, and I wish there were better JS REPLs available (Quokka might help there?) and I found this interesting:

    One troublesome part of the code was the function formatting the application state into the form that the backend submit-order required. From a backend error about missing data, I was able to quickly go to running the formatting function against the actual application state, easily comparing the state and formatting output, never leaving my IDE and beloved keyboard shortcuts. As needed, replicating local variables and running parts of the function to zoom in on a particular part, fixing mistakes, and re-running, until all worked.

    In JavaScript/Redux I would have used the Redux DevTools to explore the state, code hot reloading to update the formatting function, and the debugger to explore the output and find the bugs. I would have likely hardcoded the data so as not to loose them upon code reload and commented out the remote call itself. And I would click a button to trigger the functionality.

    I can see how the Clojurescript experience was nice compared to Javascript/Redux, but what about compared to (say) gRPC and Typescript? Rather than a tighter feedback loop of trial-and-error, the author would have been helped by the compiler to right a formatting function that complied with the spec of the API. And that would be that.

    1. 1

      My experience is that I often don’t know what I need up front. Being able to iterate and see the results really helps when you’re exploring different approaches to a problem to see which will work best.

      1. 1

        I agree, I love REPLs for exploratory programming. But in this particular example it seems like there was an existing API and the challenge was to transform data so that it worked. In that case, I think if the API schema was made explicit through tooling then it might have been even easier to get things working (which I guess maybe you could get through Clojure spec?)

        1. 1

          Yeah, spec is a good option for cases where you have a known API you’re working towards. The nice thing with spec is that you can retain the interactive workflow. I really liked this example of using it to derive the solution.