I've been using Clojure for a little while and want to create some projects that are bigger and more complicated than toys. I've been using Java for the past few years and have become accustomed to what IDEs do for me -- compile lots of classes, package them up in jars, create batch files for users to start them with.
When I look at examples of development in Clojure they seem to be along the lines of load files into the REPL, see how they work, edit the file, reload, repeat. Nary a class or jar being generated anywhere. In Stuart Halloway's terrific "Programming Clojure" I couldn't find a single example of ":gen-class", for example. The Clojure IDEs that I have used (ClojureBox and the enclojure NetBeans plugin) seem to promote that same work flow.
Is this intentional? Are the tools too immature or do I just not "get it"?
I'd like to hear some work flow examples from folks who have created some non-trivial programs to be used by regular users (not other devs) if possible.
Thanks for sharing your opinions.
What is a REPL? A Clojure REPL (standing for Read-Eval-Print Loop) is a programming environment which enables the programmer to interact with a running Clojure program and modify it, by evaluating one code expression at a time.
NightCode. Nightcode is a simple IDE for Clojure and ClojureScript. Nightcode is an IDE that bundles a smart editor, the Leiningen and Boot build tools and a home screen with quick access to the Clojure cheatsheet and REPL.
So a ClojureScript REPL consists of two parts: the first part is written in Clojure, it handles the REPL UI, and takes care of compiling ClojureScript to JavaScript. This JavaScript code then gets handed over to the second part, the JavaScript environment, which evaluates the code and hands back the result.
I think there are really 2 questions here:
A) how to deploy (and build and manage dependencies). All I can say to that is look at other projects with similar goals/domains and copy them.
B) Workflow:
My work-flow is like this:
open a file and write some high level wishful thinking declarations
start writing some functions to support it
2.5 copy the function definitions to REPL as I create them
3.5 copy these to the REPL
iterate between the two buffers building the tests up to an example and the program toward an end goal. These eventually become similar activities and I know I’m done.
wrap the secondary file up in deftest
Now when I come back in a month, I can just run my tests and be happy! Saving your REPL buffers can provide some value with little effort. That’s just what works for me at present, and I’m happy to be educated to better approaches.
As for selection of IDE vs REPL - most IDEs have plugins which have REPLs so I'm not sure its a one or the other choice - really its just about which text editor you are productive in, and how you want to manage your project structure. There aren't any 'do it this way' structures pre-made AFAIK so at this point it is easier to look at specific projects (like Clojure itself, or penumbra or compojure or any of the libraries listed on the main site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With