I often see people trying to call Clojure code from Java and having some trouble doing this. So I decided to write a quick utility to do this (inspired by Rich Hickey’s Lightening Talk), and provide a simple example.
Archive for December, 2012
Tags: clojure, interop, java
Tags: architecture, design, it, software-craftsmanship
People always seem to want to make IT / Enterprise / Software architecture much more complex than it actually is. There are a plethora of frameworks, tools, approaches, methodologies etc. that all claim to offer the solution. I’m sure you’ve seen them. Maybe you might find of them are useful, but in general they distract from the point that architecture is actually really simple.
It is dependency management. No more. No less.
Tags: clisk, clojure, live-coding, namespaces
“There are only two hard things in Computer Science: cache invalidation and naming things (and off-by-one errors)”
Clojure is a great language, and one of the few things I dislike about coding in Clojure are namespaces.
It is not because namespaces are fundamentally a bad idea – in fact namespaces are a great feature and I believe they are fundamentally important if you are trying to manage a code base effectively.
But they are particularly fiddly to get right in Clojure. They cause a lot of unnecessary grief. They are not Simple. This is the story of my battle with the namespace demons to construct a decent namespace for Clisk live-coding.
Implemented some more functionality in Enlight – now we have infinite primitives to play with, starting off with planes:
Still no lighting yet, as you can see. But that should be fairly easy to add once the core primitives and tracing functions are all working nicely.
All the textures are defined using Clisk functions, which has proved to be a very effective way to quickly generate 3D textures (all of the textures in the above scene were simple one-liners).
The scene itself is defined using a Scene Description Language, which is a DSL roughly based on the POVRay format translated into Clojure s-expressions. I’m not entirely happy with this yet, will probably go through a few iterations before I push out a finalised version. Defining a sphere currently looks roughly like this:
[:sphere [1 1 1] :radius 2 :colour [1 0 1]]