At London Scala Exchange, Martin Odersky said “The Scala way is to design something that’s very general and can be used in lots of ways.” Let’s pick up the challenge with actors - specifically Akka.
At the end of 2009, a delightfully “little” programming language was fully released following a few years of gestation. I wrote back then about the major features of Google’s Go. Nearly two years of intensive Scala, Java and Groovy work later, I felt it was time to revisit Go with one question in mind: with so much new-found enthusiasm for non-Java languages around, what has Go got to offer that might make it stand out from the crowd?
Constructor order Multiple execution of constructor side-effects No longer is-a Colliding namespaces - method names can only be globally distinct No other way to inject collaborators (or resort to setter injection???) Stubbing can be hard work - mocking sometimes preferable
Dispatch is a library for asynchronous HTTP interaction. It provides a Scala vocabulary for Java’s async-http-client. It is apparently popular and crops up as a transitive dependency of several other popular Scala products. So it can’t be all bad. However, a recent project of ours had an unhappy experience with it. Disclaimer I’ll say at the outset that there is an alternative HTTP client of my own. So I’m biased.
A recurring theme amongst Scala enthusiasts is the assertion that blocking is evil. Indeed at a recent conference more than one speaker had a slide on the screen with those words. I’ve been pondering the evil of blocking ever since. Is it always true? is it ever true even? The argument in favour of non-blocking I/O is an easy one: each JVM thread that’s blocked because it’s waiting for I/O cannot get on with something else useful instead.
The new Bee Config API provides an alternative to using java.util.Properties in Scala programs. The API provides a very simple Scala API for loading configuration files. Simplicity is the key! Often, java.util.Properties is still used in Scala applications, but it is often unsatisfactory. This API is broadly similar in intent, but pimped to work well in Scala. Features Config files are like properties files, except they are always Unicode.
Our project moved its middle tier to Scala recently. It had been Java, but with an able team on hand and a lot of work ahead of us, Scala was adopted instead. Not only was the transition to Scala painless, but it also brought an important and serendipitous benefit in our problem space: Scala case classes transform directly into JSON and vice versa. It’s hard to overstate just how much benefit this brought for this application.
A modest set of principles guides today’s expert programmers to produce effective results quickly and reliably. Christopher Diggins has produced an excellent concise summary of these, which is reproduced here. Principles of Good Programming The principles of good programming are closely related to principles of good design and engineering. The following programming principles have helped me over the years become a better programmer, and I believe can help any developer become more efficient and to produce code which is easier to maintain and that has fewer defects.
Can decision-makers realistically steer their development projects from Java to Scala yet, or is it too early? Clearly, such a transition is not without risk. Have the benefits now stacked up to outweigh the risks? An excellent blog post by Jim McBeath discusses the pros and cons in an objective way. This is well worth reading. Paulo Vilella of Accenture added his views: “For small to medium projects, I believe Scala is right now a great alternative to Java for higher productivity and agility, without compromising on performance and compatibility.