Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Scala Reloaded
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Mac
May 14, 2015
Programming
46
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Scala Reloaded
Updated version of my scala talk
Mac
May 14, 2015
Other Decks in Programming
See All in Programming
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
1.1k
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
290
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
210
SREの越境 / SRE Collaboration
y0hgi
2
310
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.2k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
550
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
New Earth Scene 8
popppiees
4
2.7k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
280
Side Projects
sachag
456
43k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
730
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
440
Transcript
Scala Mac Liaw
[email protected]
twitter:wmacgyver Materials drawn from:Michael Galpin’s SFJUG
Presentation
None
Scala? Statically Typed Language on Java VM Object
Oriented Language Functional Language Scalable Language Concurrency
Smart Type System var name:String = “Powerful the Dark Side
is”;
Smart Type System var name = “Powerful the Dark Side
is”;
Smart Type System var name = “Powerful the Dark Side
is”; def makeList(a:String, b:String):List[String] = { return a :: b :: Nil; }
Smart Type System var name = “Powerful the Dark Side
is”; def makeList(a:String, b:String):List[String] = { return a :: b :: Nil }
Smart Type System var name = “Powerful the Dark Side
is”; def makeList(a:String, b:String):List[String] = { a :: b :: Nil }
Smart Type System var name = “Powerful the Dark Side
is”; def makeList(a:String, b:String):List[String] = a :: b :: Nil
Smart Type System var name = “Powerful the Dark Side
is”; def makeList(a:String, b:String) = a :: b :: Nil
Object Orieted No primitives No int, just Int
No String[], just Array[String] No operators + - * / ++ += are just names for methods
Scala Objects class SimpleGreeter { val greeting = "Hello, world!"
def greet() = println(greeting) } val g = new SimpleGreeter g.greet()
Traits & Mixins trait Friendly { def greet()="Hi" } class
Cat extends Friendly {} class HungryCat extends Friendly { override def greet() = "Meow" } trait HyperGreeter extends Friendly {override def greet() = super.greet() + "!!!!!!!" }
Traits & Mixins trait Friendly { def greet()="Hi" } class
Cat extends Friendly {} class HungryCat extends Friendly { override def greet() = "Meow" } trait HyperGreeter extends Friendly {override def greet() = super.greet() + "!!!!!!!" } var pet = new Cat println(pet.greet()) //print Hi
Traits & Mixins trait Friendly { def greet()="Hi" } class
Cat extends Friendly {} class HungryCat extends Friendly { override def greet() = "Meow" } trait HyperGreeter extends Friendly {override def greet() = super.greet() + "!!!!!!!" } var pet = new HungryCat println(pet.greet()) //print Meow
Traits & Mixins trait Friendly { def greet()="Hi" } class
Cat extends Friendly {} class HungryCat extends Friendly { override def greet() = "Meow" } trait HyperGreeter extends Friendly {override def greet() = super.greet() + "!!!!!!!" } var pet = new HungryCat with HyperGreeter println(pet.greet()) // print Meow!!!!!!!
Domain Specific Language Built-in support for two DSLS
XML Actors
XML DSL import scala.xml._ object XMLSample { def main(args: Array[String])
{ val df = java.text.DateFormat.getDateInstance() val dateString = df.format(new java.util.Date()) def theDate(name: String) = <dateMsg addressedTo={ name }> Hello, { name }! Today is { dateString } </dateMsg>; println(theDate("Mac").toString()) } }
XML DSL <dateMsg addressedTo="Mac"> Hello, Mac! Today is May 13,
2015 </dateMsg>
Actors Actor Model: A Different Way to Implement Concurrency
Actors Actor Model: A Different Way to Implement Concurrency
Each Object is an Actor
Actors Actor Model: A Different Way to Implement Concurrency
Each Object is an Actor Each Actor has a Mailbox
Actors Actor Model: A Different Way to Implement Concurrency
Each Object is an Actor Each Actor has a Mailbox Actors (Asynchronously) Send Messages and Receive them in their Mailbox
Actors Actor Model: A Different Way to Implement Concurrency
Each Object is an Actor Each Actor has a Mailbox Actors (Asynchronously) Send Messages and Receive them in their Mailbox Shares NOTHING!
Why Erlang Is Right? No code changes for Multi-threaded
vs Single-threaded No Mutable State No Locking, thus no DEAD Locks. Let it Crash
Actor Example import akka.actor._ class YodaActor extends Actor { def
receive = { case _ => println("Yoda rules!") } } class VaderActor extends Actor { def receive = { case "luke" => println("No, I'm your father!") case _ => println("Darkside rules!") } }
Actor Example object Main { def main(args: Array[String]) { val
system = ActorSystem("StarWarsSystem") val yodaActor = system.actorOf(Props[YodaActor], name = "yodaactor") val vaderActor = system.actorOf(Props[VaderActor], name = "vaderactor") yodaActor ! "yes?" vaderActor ! "jedi" vaderActor ! "luke" } }