Scala Labs at the J-Fall conference was the first in a series of public events in which we want to show the power and fun of Scala to a broad audience of developers.
Before I tell you about our experience at the JFall, I would like to explain how Scala Labs got started. This relatively new upcoming language on the Java Virtual Machine has been drawing more and more attention and many of our developers have started playing with over the last couple of months. In August some of us decided to organize an internal technology day, so all of our developers could get a better understanding of this new language and discover its merits. Because everyone was very enthousiastic about the entire day we figured that it would be a nice to organize something similar outside of Xebia as well. The exercises from that day became the basis of the Scala Labs exercises that we used at the JFall.
(more...)
Filed under Scala | No Comments »
Besides organizing a Scala workshop at the J-Fall meeting we also presented five technical posters to serve as discussion points for anyone interested (or just walking by). Unlike traditional meeting sessions we could interact directly, somewhat similar to open space sessions.
(more...)
Filed under Architecture, Domain Driven Design, Frameworks, GIT, Java, Scala, fitnesse | 1 Comment »
Last week me and some of my colleagues had the pleasure of being on the receiving end of an excellent training given by Jonas Bonér. The topic was his new pet project: the Akka framework. Perhaps you've played around with Scala lately, and also have taken the first steps in using its Actor library. Simply stated, an Actor is a unit of execution that (usually asynchronously) processes messages and encapsulate their state. An actor does not expose its state, and messages are processed sequentially. The Actor model has been around for quite some time, but today the best-known Actor implementation is Erlang.
The Actor model has been implemented in the standard Scala library by Philipp Haller (for the interested reader, a solid reference is for instance this article explaining how actors in Scala work). In most Actor examples written in Scala, it is not uncommon to find only EchoActors, PingPongActors, and FibonacciSolvingActors. Nice examples, but perhaps you might wonder if they are of any use in enterprise Scala at all. Next to this, if you're interested in concurrent, message passing processing models, STM's, NoSQL data stores, and occasionally wonder what the future in enterprise computing might bring, than Akka might be just the framework you're looking for. This blog is intended to provide a brief introduction into one feature of this framework: Akka's supervisor Actors. It is mostly based on the knowledge extracted from Jonas during the training, and I hope to whet your appetite for it.
Tags: akka, Scala
Filed under Akka, Scala | 10 Comments »
In my efforts to teach myself Scala, I tried solving a problem I've tackled in various languages, 6510 assembly code (didn't get far...), pl/sql, Java (with and without Drools) and Groovy among them. Usually I get bogged down in some detail of the language so I never get to reap any actual benefits of my efforts in daily life. The plus side of this never ending task is that by now I don't have to spend effort on defining a problem but instead can start coding right away.
So this story is about how to parse text in Scala and is part of THE software package that will automagically generate a menu for a week and the shopping list for that menu together with whatever else my family will need that week and send it to www.albert.nl and have the groceries delivered to my door.
(more...)
Filed under Scala | 6 Comments »
Aliens sending messages, Water flowing over a map and finding the hidden Welcome message in a String... Yes, Google Code Jam has returned for the 2009 edition! I participated in the Qualification Round and managed to solve all but 1 input set....
(more...)
Tags: Functional Programming, Google, google code jam, Scala
Filed under Functional Programming, General, Java, Scala | 4 Comments »
Earlier this week I ran into a missing feature in the Scala xml library and I ended up adding this feature myself, which turned out to be pretty simple.
I was trying to extract the text contents of an element in a piece of XML using the handy \ and \\ methods on scala.xml.NodeSeq. These methods allow you to extract sub-elements from an XML node in a way very similar to XPath, something like this:
val xml = <a><b><c>text</c></b></a> val c1 = xml \ "b" \ "c" val c2 = xml \\ "c" val text = c2.text
The problem I ran into occurred when I tried to use these methods to extract an element when one of its attributes had a certain value.
I have read about implementing the bowling game XP-style many years ago in Robert Martin's book 'Agile Software Development'. The episode can be found online as well.
Recently he has recently been learning Clojure and attempted to implement the bowling game in Clojure.
It is a nice exercise, and although I like Clojure, I do not regard myself capable in any way to repeat such an attempt. Apart from that Stuart Halloway, author of the excellent 'Programming in Clojure' book, has already done this in a much better way than I ever could. I'm slightly more familiar with Scala, so I thought it would be a nice exercise to try some functional bowling using that. My Scala knowledge is in a deplorable state, stuck at pre-beginner level, so I run the risk of making a complete fool of myself. However I'll take the chance and at least try to learn from the experience.
Tags: Functional Programming, Scala
Filed under Functional Programming, Scala | 7 Comments »
The path on the road to learning Scala usually involves using the REPL. this is a very handy way of trying out functions you write easily and quickly, without having to set up an entire IDE environment. Scala's latests stable release Scala 2.7.5. Scala 2.8 will be out in a couple of months, as things stand now. This new release will contain a number of enhancements and new features, and if you can't wait to try this out, you should check out and use the trunk. I've previously blogged about starting with Scala, and also hinted at trying this out. In this blog, I'll show some more concrete examples of the and a few neat things that you can do if you're willing to take this step.
(more...)
Tags: Scala
Filed under Scala | 1 Comment »
I recently started reading Stuart Halloway's book 'Programming in Clojure'. I don't think I will be writing much enterprise applications in that language in the near future, but it never hurts to broaden the mind, and it's a very good read. In his book, he demonstrates some of the advantages of functional programming by taking an example from the Apache commons library: StringUtils.indexOfAny. He has also written a blog about it.
In this blog post, we'll compare the original function in Java, the Clojure version and a Scala implementation.
(more...)
Tags: funtional programming, Scala
Filed under Functional Programming, Scala | 15 Comments »
Scala has become more and more popular over the recent months/years. Its hybrid nature of being an imperative as well as functional language attracts a crowd from the Java world as well as functional fundamentalists coming from the world where statements like x=x+1 are looked at with the utter disbelief. It has been stated that Scala is 'Java as it should have been', but there are also numerous complaints about the language and its features (like not being side effect free, overly complex, too much of everything, too much abstraction, having a weird syntax, etc). The latter might actually be a proof of its popularity, since people seem to be actually using the language instead of just looking at it briefly and stopping, tired but happy, after having written hello world with it.
In this blog post, I'll give you some (hopefully) useful tips how to best start if you want to learn this language, which is one of the candidates become 'our next big language' and surpass Java in this respect.
(more...)
Tags: Scala
Filed under Scala | 9 Comments »