On Wed, Mar 30, 2011 at 23:11, Alex Miller <[email protected]> wrote:
> At Revelytix, we have a mix of people doing Java, Flex, and Clojure.
> An older product is written in Java and is being enhanced/maintained.
> Some new UI work for that product is being done in Flex.  And we have
> several newer products built in Clojure.  We have about 7 people
> working primarily in Clojure, a few more doing Java/Flex, and a few
> non-devs (ontologists) who are using Groovy for some scripting.
>
> The Clojure codebase has been around for a little over a year and is
> currently ~20kloc of Clojure (tests make up about half of that).  It's
> really hard to say with any precision but my best guess (from having
> written similar code in Java) is that we are getting about a 10x
> reduction in loc vs Java.

I wonder if couting lines of code is really meaningful given how
differently Clojure and Java are written and formatted. I find
counting the number of tokens (or words) is a better -- if still
imperfect -- indication. That said, I have seen some reduction in
overall length and complexity in moving from Java to Clojure. In
particular, the lack of mutability drastically reduces temporal
coupling. Clojure's emphasis on providing features as 'simples' [1]
also helps.

[1] Stuard Halloway "Simplicity Ain't Easy" http://clojure.blip.tv/file/4824610/

I've posted two versions of a simple Swing application to my github
account in Clojure and Java. I've computed line, word and character
counts for both versions (minus comments).  Judge for yourself.

https://github.com/bpsm/poolradwheel.java/tree/master/src/main/java/nom/bpsmithmannschott/poolrad

find src -name "*.java" | xargs cat | sed -e 's,//.*$,,' -e 's,[
]*\*.*$,,' -e 's,^[ ]*$,,' | grep -v -e "^$" | wc

lines 467; words 1559; bytes 16148

https://github.com/bpsm/poolradwheel.clj/blob/master/src/main/clojure/poolradwheel.clj

find src -name "*.clj" | xargs cat | sed -e 's,;.*$,,' -e 's,^[ ]*$,,'
| grep -v -e "^$" | wc

lines 226; words 1014; bytes 9153


Two things worth noting about these rough counts:

- The Clojure documentation strings are being counted.
- The Java implementation uses a kind of type safe enum pattern for
part of the model where the Clojure implemenation just uses integers
and a few helper functions.

Cheers,

// Ben

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to