And then I realized… Java is Frustrating!


Lately I’ve been slowly learning the Scala language in my spare time. It’s an interesting experience, and it’s incredibly exciting to learn while hearing buzz such as the rumour that Quora is moving to Scala. With other major players using the language, such as Twitter, LinkedIn, and Foursquare (just to repeat @yaaang’s non-exhaustive list), its keeps learning relevant and exciting.

Unfortunately, it has a few drawbacks.

I was introduced to Scala through Mike Nash, a coworker of mine who dove into the language first. While learning, I would regularly poke fun at his occasional Scala-isms while he tried to write Java code. For example:

public class ServiceTest {
    public void testSummation() {
        List<Integer> intsToSum = List(1, 2, 3);  // Uh... that's not Java mike...
        int sum = service.sum(intsToSum);
        assertEquals(6, sum);

        // At least he didn't intsToSum.reduceLeft(_+_) ;P

Even as I slowly slipped into the same habit, I would still tease, but today I realized that the real frustration isn’t the occasional Scala-ism. The biggest pain-point I’ve found so far in learning Scala is having Scala in my personal toolkit, but not having it in our team’s toolkit.

Scala is a JVM language. It would compile into the WAR-file and be indistinguishable to our customer. It’s statically typed (which I like), but still uses type-inference to avoid the verbosity of most static-type languages. It’s extremely expressive, complete with the power of the functional and the object oriented paradigms. It’s all those things, and more, and I can’t use it.

case class ProductFamilyCategoryWithChildren(category : ProductFamilyCategory, families : List[ProductFamily]);
public class ProductFamilyCategoryWithChildren {
    private ProductFamilyCategory category;
    private List<ProductFamily> families;

    public ProductFamilyCategoryWithChildren(ProductFamilyCategory category, List<ProductFamily> families) {
        this.category = category;
        this.families = families;

    public ProductFamilyCategory getCategory() { return category; }
    public List<ProductFamily> getFamilies() { return families; }

That’s 1 line of Scala to 12 of Java. There are 111 characters of Scala to 456 of Java. I stare at both, swallow my pride a little, delete the Scala version, and move on…