I have looked at scala on and off at times - wrote one 20 line program before - that was it. Friday I wrote my first serious Scala program, and over the weekend I tried doing some performance measurements to see if I could use on a project. I have some code generating dummy data, passing into a dispatcher Actor, which feeds into 20 accumulator actors (for concurrent processing), with results being merged back into buffers to be shipped out to a file (I did not actually ship to a file - just dropped data on the floor). So I got the whole code going in a day or two.

Observations:

(1) Doing easy stuff in Scala was easy. I got a lot done without understanding the powerful and complex type system Scala has. I think there is a big difference between writing most code and library code. My small application however did not do any "fold left" etc stuff - basically a Java programmer writing Scala code.

(2) The entire application was 156 lines (no comments). One line case classes were great compared to a Java class with fields, setters, and getters etc. (I used them for Actor messages.)

(3) Actors made it so much easier to get concurrency into the application. Hardest thing turned out how to do a graceful shutdown after all work completed. (I ended up sending a EOF style message and have it propagate through all the actors to guarantee all work had been completed.) No locks anywhere in sight in my code.

(4) My first attempt code ran 100 times too slow for my needs. I tripled the performance pretty quickly, and am sure I could probably get it to go ten times faster again, but my results were such that with deadlines etc I am facing and risk etc, we will go with C++ instead. The code was also not complete (so had to add a lot more in). Just too risky to convince management (err, which is me actually) to introduce a new unknown language for this particular project. Zero experience on optimizing Scala code available in house, with maybe a hundred man years of C++ optimizing experience on tap.

Alan

--
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