4. About me
Nguy n Thanh T湛ng - Software Developer t i Septeni畛 畉
Technolgoy
Ng担n ng : C, Java, C#, PHP v畛 Scala cho hi n t i畛 畉
Quan t但m n:畉
Scala, Angularjs, React...
C叩c ki n tr炭c ph n m m畉 畉 畛
Domain Driven Design
Reactive web
Entrepreneurship
5. M t ng担n ng m kh担ng nh h ng n畛 畛 畉 動畛 畉
c叩ch b n ngh挑 v l p tr狸nh, th狸 n坦 kh担ng畉 畛 畉
叩ng h c *畛 畛
Alan Perlis, nh khoa h c m叩y t鱈nh畛
*A language that doesn't affect the way you think about programming, is not worth knowing.
6. Th担ng tin s l c董 動畛
Scala = Scalable Language
c動畛 Martin Odersky t o ra nm 2003畉 t i畉 EPFL, Th y畛
S畛
c d ch ra m達 Java Bytecode v ch y tr棚n JVM動畛 畛 畉
C坦 th t叩i s d ng c叩c th vi n c a Java畛 畛 畛 動 畛 畛
C炭 ph叩p u ti棚n s ng n g n動 畛 畉 畛
H tr l p tr狸nh h ng i t ng l n l p tr狸nh hm畛 畛 畉 動畛 畛 動畛 畉 畉
7. Th担ng tin s l c (2)董 動畛
Scala = Java's speed + Ruby's syntax
H tr t t Realtime/Reactive Web, Distributed System, Big畛 畛 畛
Data v i c叩c th vi n Future (built-in), Actor, Akka, Spark...畛 動 畛
C叩c c担ng ty ang s d ng Scala:畛 畛
Apple
LinkedIn
Twitter
Foursquare
Netflix
Tumblr
...
15. Val vs Var
Val khai b叩o bi n d i d ng Immutable = Read Only畉 動畛 畉
Var khai b叩o bi n d i d ng Mutable = Read + Write畉 動畛 畉
16. Pattern Matching
G n gi ng c u tr炭c switch-case trong ng担n ng畉 畛 畉 畛
kh叩c. Tuy nhi棚n...
Uy n chuy n khi lm vi c v i Option type, Case畛 畛 畛 畛
Class thay ch d湛ng c v i primative type nh畛 畛 動
Java, C...
17. Option type
L container ch a 1 i t ng m trong 坦:畛 畛 動畛
C坦 gi叩 tr ~> Some(object)畛
R ng ~> None畛
L s thay th null trong Java v ng担n ng畛 畉 畛
kh叩c
K t h p c v i Pattern Matching畉 畛 動畛 畛
18. Closure
L c叩ch khai b叩o hm m gi叩 tr tr v c坦 ph畛 畉 畛 畛
thu c vo bi n b棚n ngoi scope (d湛 kh担ng畛 畉
c truy n qua i s c a hm)動畛 畛 畛 畛 畛
19. Lazy val
L c叩ch khai b叩o m k t qu ch t鱈nh to叩n v畉 畉 畛
tr v khi n坦 c g i n畉 畛 動畛 畛 畉
20. Implicit
Tr狸nh bi棚n d ch s t ng t狸m ki m trong ng畛 畉 畛 畛 畉 畛
c nh(context) thnh ph n c khai b叩o畉 畉 動畛
implicit
Implicit c坦 nh ng thnh ph n g m:畛 畉 畛
Implicit Conversion
Implicit Parameters
34. Higher-Order Functions
M t function c坦 th nh n i s l 1 function畛 畛 畉 畛 畛
kh叩c ho c tr v k t qu d i d ng 1 function畉 畉 畛 畉 畉 動畛 畉
35. Function Currying
Trong khoa h c m叩y t鱈nh, currying, ph叩t minh b i Moses Sch旦nfinkel v畛 畛
Gottlob Frege, l k thu t chuy n i m t function m c坦 nhi u i s sang畛 畉 畛 畛 畛 畛 畛 畛
1 function m ch c坦 m t i s duy nh t (c叩c i s kh叩c 達 c quy nh畛 畛 畛 畛 畉 畛 畛 動畛 畛
b i curry). - wikipedia畛
VD:
Tr c:動畛
Sau:
40. Functional Combinators (4)
reduceLeft / reduceRight
G n gi ng fold, nh ng:畉 畛 動
Kh担ng c n kh i t o ban u, d湛ng ch鱈nh ph n t u ti棚n畉 畛 畉 畉 畉 畛 畉
cho vi c ny (n辿m ra Exception n u collection r ng)畛 畉 畛
VD:
fold:
reduce:
41. Functional Combinators (5)
flatten
dn ph ng 1 nested structure畉
flatMap
L s k t h p c a map v flatten畛 畉 畛 畛
42. V:
Self type
Monads
Extractor Objects
Sequence Comprehensions
Package object
c湛ng nhi u i u kh叩c n a畛 畛 畛
43. Ng i n i ti ng n坦i g狸?動畛 畛 畉
N u t担i ph i l a ch n m t ng担n ng s d ng ngy nay ngoi Java, n坦 s l畉 畉 畛 畛 畛 畛 畛 畛 畛 畉
Scala (1)
James Gosling, cha ng担n ng Java畉 畛
T担i c坦 th thnh th t m n坦i r ng n u m t ng i no 坦 a cho t担i cu n畛 畉 畉 畉 畛 動畛 動 畛
Programming in Scala c a Martin Odersky c湛ng Lex Spoon v Bill Venners畛
trong nm 2003 th狸 c坦 l t担i 達 ch a bao gi t o ra Groovy.畉 動 畛 畉 (2)
James Strachan, cha ng担n ng畉 畛 Groovy
(1) If I were to pick a language to use today other than Java, it would be Scala
(2) I can honestly say if someone had shown me the Programming in Scala book by by Martin Odersky, Lex Spoon & Bill Venners back in 2003 Id probably have never created Groovy.