Resisting Progress

Summarized in an Image


 
 

Why fly when a car will do?

Don’t get me wrong, I drive regularly. Occasionally I even take long trips by the pavement when the tarmac is too pricey. However, there’s a limit. Flying is faster, safer, and more convenient. When cost (both price and time-overhead) allows, I’d prefer to be in the air.
 
In a way, that’s where the comparison breaks down. While Maven is generally faster, safer, and far more convenient than Ant, nobody is charging you exorbitant prices to use it. Both are free, it’s up to you to pick which.
 
Unlike real air travel, Maven also avoids long up-front overhead costs. To fly for real I have to head to the airport early, get through security, sit on my hands for an hour, then jump on the plane and wait another twenty minutes before takeoff. Maven doesn’t have that. I’m running in about a half-dozen lines, and a couple directories.
 
Amusingly enough, I’m still talking about Maven and Ant here. I’ve personally moved on to SBT and I’m loving it. One quick command-line call, and I’ve got my project rolling. I can customize where I want to whatever extent I want because I get to use real code to do so. For me, it’s like moving from the incredible velocity of a jet plane, and strapping myself inside a rocket bound for wherever I want to go.
 
Still, I’m baffled every now and then when I look back down on earth to see someone driving their car because “it’s the way it’s always been done”.

And then I realized… Java is Frustrating!

facebooktwitterdiggstumbleuponredditdelicious


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 {
    @Test
    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…


facebooktwitterdiggstumbleuponredditdelicious