Solid Scala

Solid Scala

Presentation to Semantico, Brighton.

Richard Dallaway

August 23, 2013

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

12 slides
  1. Agenda 1. Benefits of Scala 2. What it looks like

    3. Why we trust it 4. How to start
  2. import org.joda.time.DateTime case class Subscription( owner: String, isTrial: Boolean, expiry:

    DateTime) val nextMonth = new DateTime().plusMonths(1) val sub = new Subscription( "Bob", isTrial = true, nextMonth) sub.owner // “Bob” sub == new Subscription( "Bob", true, nextMonth) // true
  3. val subs = List( Subscription("Anna", true, new DateTime()), ... )

    val trials : List[Subscription] = subs.filter(s => s.isTrial) def expiring(sub: Subscription) : Boolean = daysBetween(now,sub.expiry).getDays < 2 val nagList = subs.filter(expiring) val expiringTrials = subs.filter(expiring).filter(_.isTrial)
  4. case class Sub(name: String, cc: Option[String]) val subs = List(

    Sub("Anna", None), Sub("Bob", Some("1234-5678-9123-4567")) ) def bill(cc: String) : Result = ... val results = subs.flatMap(s => s.cc).map(bill) val results = for { sub <- subs cc <- sub.cc } yield bill(cc) .par
  5. 2003 2006 2009 2008 2011 2004 2005 2010 2007 2012

    2013 2014 1.0 2.0 2.3 2.8 2.7 2.9 2.10 2.11 2.6 2.5 2.4 2.9.3 2.8.2

More Decks by Richard Dallaway

Other Decks in Technology