New ScalaTest with IntelliJ IDEA

For existing code one can easily create a ScalaTest with Cmd+Shift+T. But for starting with the test the Scala plugin provides no template. I created following template for myself based on the Scala Class template: #if ((${PACKAGE_NAME} && ${PACKAGE_NAME} != “”))package ${PACKAGE_NAME} #end #parse(“File”) import org.scalatest.FunSuite class ${NAME}Suite extends FunSuite { }

Using minBy and maxBy of Scala Collections API

The Scaladoc of minBy and maxBy which were added in Scala 2.9 is quite rudimentary: def minBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A def maxBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A I tried to understand these higher order functions and come up with a use case which makes sense: scala> case class Person(name: String, age: Int) defined class … Continue reading

Scala for the Intrigued

I just gathered the links of all installments of the excellent »Scala for the Intrigued Series« in Pragprog Magazine by Venkat Subramaniam: The Elegance of Scala Sensible Typing and Optional Items Cute Classes and Pure OO Functional Style of Programming Working with Collections Creating Higher Order Functions Pattern Matching XML as First Class Citizen Recursions and Tail … Continue reading

Reading • Applying • Thinking

I like this quote from Donald Knuth. It is sooo true:  It is difficult, if not impossible, for anyone to learn a subject purely by reading about it, without applying the information to specific problems and thereby forcing himself to think about what has been read. Furthermore, we all learn best the things we have … Continue reading