• Save
BRUG - Hello, Scala
Upcoming SlideShare
Loading in...5
×
 

BRUG - Hello, Scala

on

  • 655 views

Introduction to functional programming for the Bristol Ruby User Group

Introduction to functional programming for the Bristol Ruby User Group

Statistics

Views

Total Views
655
Views on SlideShare
652
Embed Views
3

Actions

Likes
0
Downloads
0
Comments
0

3 Embeds 3

http://www.hanrss.com 1
http://www.linkedin.com 1
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Afternoon everyone; welcome to this talk on Lift the web framework for Scala.
  • Before we get started with the presentation here’s a little information about me.** CLICK **I’ve been working on the lift project for around 2.5 years and using it in production for about 3 years. I work on a lot of different aspects of the framework but I am particularly interested in localization and process abstractions within Lift core. I also use Lift during my day job as do most of the other committers so in that sense we are not just making a framework for the sake of it, what we put into lift are real-life abstractions from the field ** CLICK **I am the author of a new book called Lift in Action, available on Manning publications. At the end of this talk I will be giving away a 40% discount for people who are interested in learning more about Lift.** CLICK **CodingScala since the end of 2007 – both with Lift and standalone Scala applications** CLICK **Before I came to the scala community I was working extensively with Ruby, along with Rails. Before that I was coding a lot of Objective-C and Java for desktop applications. ** CLICK **My day job is producing interesting sections of middleware for marketing automation and cross-media marketing for a division of Xerox corporation.** CLICK **
  • ModularityThe degree to which the parts can be separated and recombined.CompositionalityUnderstand the parts, and the connections, and you understand the whole.
  • creating a block (Ruby’s name for a closure) which takes a single parameter and passes it to the built-in puts method.  This block is then passed as an object to the each method of class Array, which calls the block once for each element in series
  • creating a block (Ruby’s name for a closure) which takes a single parameter and passes it to the built-in puts method.  This block is then passed as an object to the each method of class Array, which calls the block once for each element in series

BRUG - Hello, Scala BRUG - Hello, Scala Presentation Transcript

  • Hello, Scala Timothy Perrett BRUG, October 2011 software. done right.
  • About Me Author of Lift in Action Coding Scala since 2007 (its awesome) Background in both dynamic and statically typed languages Manufacturing and marketing automation is my day job http://manning.com/perrett/ software. done right.
  • Scalais…software. done right.
  • A statically typed, hybrid object-functional programming language software. done right.
  • functional programming is... software. done right.
  • …programming with functions software. done right.
  • A program is software. done right.
  • a single, referentially transparent expression software. done right.
  • An expression is software. done right.
  • a combination of sub expressions,using the constructs of a language. It evaluates to a result. software. done right.
  • a referentially transparent expression... software. done right.
  • …is an expression that can be replaced directly by its result without affecting the program operation. i.e. no side-effects software. done right.
  • a side-effect is... software. done right.
  • for example:  I/O  variable mutation throwing exceptions software. done right.
  • a function is... software. done right.
  • a relation between every value of type A to exactly one value of type B. (given f: A => B) software. done right.
  • functional programming gives you… software. done right.
  • modularity and compositionality software. done right.
  • fpis a style, not a language software. done right.
  • and static typing?... software. done right.
  • well, ruby is… software. done right.
  • duck typed… software. done right.
  • …scala is statically typed software. done right.
  • ”…types save you from errors, give you usefulprogram documentation and act as a safety net forrefactoring…" Martin Odersky software. done right.
  • code samples software. done right.
  • nums = [1,2,3,4]nums.select do |n|n % 2 == 0end software. done right.
  • valnums = Seq(1,2,3,4)nums.filter { n =>n % 2 == 0} software. done right.
  • valnums = Seq(1,2,3,4)nums.filter(_ % 2 == 0) software. done right.
  • useful data types software. done right.
  • valfoo = Option("thing")//=>Some(“thing”)val bar = Option(null)//=> None software. done right.
  • foo = … // comes from user inputif foo == nil then // do something with fooend software. done right.
  • // where foo is user inputOption(foo).map(x => …) software. done right.
  • implicit pimps software. done right.
  • class Foo(word: String) { def say = println(word)}implicit def strToFoo(in: String): Foo …“word”.say software. done right.
  • supports DSLs… software. done right.
  • take 2 pills and call me in the morningtake(2.pills).and(call).me(in).the(morning) software. done right.
  • blistering performance software. done right.
  • Performance 60 50 40 30 Scala Ruby (Jruby) Ruby 1.9 20 10 0 Scala Ruby (Jruby) Ruby 1.9source: http://shootout.alioth.debian.org/ software. done right.
  • heaps more awesome  Concurrency abstractions  Parallel data structures  BDD & property testing  Ad-hoc polymorphism  Higher-kinded types  Existential types software. done right.
  • Questions?twitter.com/timperrett Lift in Actiongithub.com/timperrett manning.com/perrett/blog.getintheloop.eu software. done right.