19

Scala is a large and complex language. In my experience, the best way to learn such a language is to read really good code. Are there any open source examples of such code? What can you recommend?

Konstantin Solomatov
  • 10,252
  • 8
  • 58
  • 88

2 Answers2

10
  1. Scalaz. Be aware that it's written in a far more functional style than most Scala code.

  2. Twitter Util (already mentioned in @axel22's answer).

Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
8

The Scala standard library should be pretty idiomatic in most places. The Scala Swing library is another example.

Usually people who write various frameworks know what they are doing and are experts in Scala. Frameworks such as Akka or Play are good examples of this. Twitter's projects are another.

axel22
  • 32,045
  • 9
  • 125
  • 137
  • 1
    In my experience much of the standard library is pretty imperative (presumably for performance reasons). – Travis Brown Jul 06 '12 at 13:05
  • True, stdlib is sometimes very imperative. Nevertheless, there are some idiomatic patterns regarding style being followed there: class and a companion only per a file of a same name, using the cake-pattern to mix functionality together, combinator-style interface (parsers), etc. – axel22 Jul 06 '12 at 14:50
  • 1
    IMO, stdlib and compiler are bad examples, since they aren't typical of what other programmers do in their everyday job. – Konstantin Solomatov Jul 06 '12 at 15:11
  • 1
    And, besides what the others said, it contains lots of code that were written very long ago, and lots of code written by PhD students with not much Scala programming experience. – Daniel C. Sobral Jul 07 '12 at 00:57