Scala in the Enterprise

8
Scala in the Enterprise

Transcript of Scala in the Enterprise

Page 1: Scala in the Enterprise

Scala in the Enterprise

Page 2: Scala in the Enterprise

Intro

• Eric Pederson– [email protected] / @ericacm– Background in Java, Groovy, Javascript, PHP, etc.

• Consulting at NYSE– One Scala app in production, one in QA– Contract finished 1Q11

Page 3: Scala in the Enterprise

Platform

• JDK 1.6• Scala 2.8– Started development in March– 2.8 was bundled with Intellij IDEA

• Using lots of Java libs– Spring, Hibernate, CXF, Mule, ApacheMQ– Bouncycastle, OpenSAML, Velocity, etc, etc.

• Only Scala lib currently in use is ScalaTest

Page 4: Scala in the Enterprise

What’s been working well

• Improved productivity• Concise code• Java interop• Type inferencing• REPL (mvn scala:console)• Collections API– Especially higher ordered fns (map/filter/etc)

• Lambdas / Closures– Prevents proliferation of classes

Page 5: Scala in the Enterprise

What’s been working well

• Mixins / trait stacking– trait UserIdentifierCmd extends ApiKeyCmd {..}– trait RoleIdCmd extends ApiKeyCmd {..}– object cmd extends UserIdentifierCmd with RoleIdCmd {..}

• For comprehenions / expressions• Case classes / pattern matching• Actors• Type aliases• Structural (duck) typing• Import aliases

Page 6: Scala in the Enterprise

Complaints

• Eclipse support is weak• Lack of type inferencing in IDEA• Collections are not serializable• Cannot write classfile annotations in Scala• Would like Groovy style .? null short circuiting

Page 7: Scala in the Enterprise

Complaints

• Someone needs to write a “FP in Scala” book– Plenty of literature using Haskell– Blog posts here and there on advanced Scala FP– scalaz is looking promising in this area– Something like “Learn you a Haskell for Great

Good” plus an in-depth discussion on scalaz.

Page 8: Scala in the Enterprise

Currently looking at

• Lift “Box” or similar– Options don’t include failure info– scalaz Validation

• http://applicative-errors-scala.googlecode.com/svn/artifacts/0.6/html/index.html

– http://www.milessabin.com/misc/Chain.scala• Camel

– To replace Mule– Scala DSL, Akka integration

• Scalate / SSP• scala-time• scalaz