Menu
Kevin Peterson
Kevin Peterson

Pattern matching in Java with the Visitor pattern

I once read an essay—I cannot find it now—that talked about how learning a more advanced programming language can improve your coding even in a language that lacks those features because those language features are really ways of thinking, and there’s no reason you cannot think in terms of more powerful abstractions just because you […]

February 11, 2015
Kevin Peterson
Kevin Peterson

I can haz lambda on Java 7?

Superficially, lambda expressions in Java 8 are just syntactic sugar for instances anonymous inner classes. Syntactic sugar should not require classfile changes, so one might expect that code compiled with Java 8 lambdas could run on a Java 7 JRE. It turns out that you can’t do this, and not just because of an automatic […]

April 29, 2013
Kevin Peterson
Kevin Peterson

Not too late to sign up for Odersky’s Scala Coursera class

Just a quick note if you haven’t seen it. Martin Odersky is teaching a Coursera class Functional Programming Principles in Scala. On the backend we’ve been experimenting with how we can use Scala more easily in our 99% Java project, and apparently we’ve been talking about it enough that Matt Baker decided this was a […]

April 02, 2013

Julien Wetterwald

Relaxing visibilities using Javassist

I personally like to restrict the visibility of my classes and members as much as possible. However, package-private classes get quickly annoying when used in an interactive environment such as the Scala interpreter. When we encountered this problem with one of our internal tools, we decided to generate derived versions of our JAR files with […]

October 25, 2010

Eishay Smith

Wealthfront track at the Silicon Valley Code Camp

This year’s Silicon Valley Code Camp was the largest and greatest so far. Like last year, Wealthfront (then kaChing) had few packed presentations. This year we had a full Wealthfront track, focusing on software quality starting with the first line of code through testing to production. As requested, here our our presentations.    A well-typed program […]

October 20, 2010

Julien Wetterwald

Creating TypeLiterals in Scala

In case anyone wondered, here is how one can easily create instances of Google Guice’s TypeLiteral in Scala. Type literals are used for reifying types. def typeLiteralOf[T](implicit m: scala.reflect.Manifest[T]): TypeLiteral[T] = (m match { case m: ClassManifest[T] if m.typeArguments.isEmpty => TypeLiteral.get(m.erasure) case m: ClassManifest[T] => TypeLiteral.get(new ParameterizedTypeImpl(m.erasure, m.typeArguments.map { case n: ClassManifest[_] => typeLiteralOf(n).getType }.toArray)) […]

August 30, 2010