Introduction to Scala for Java Developers
-
Upload
solix-jj -
Category
Technology
-
view
190 -
download
3
Transcript of Introduction to Scala for Java Developers
![Page 1: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/1.jpg)
~ Scala for the impatient Java Developer ~
Meetup By :
9 MARCH 2016
![Page 2: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/2.jpg)
~ Agenda ~
• Why Scala (imperative Vs. functional programming)
• intro to Scala(Basic)
• Quick Demo: Akka actors
![Page 3: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/3.jpg)
~ Why Scala ~
SCALA JAVA
![Page 4: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/4.jpg)
~ Why Scala ~
SCALA JAVA 8
![Page 5: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/5.jpg)
~ Why Scala ~
• Both JVM based
• You can call Scala from Java and vice versa
• Both are OOP but scala also supports functional Programming
Major similarities with Java:
![Page 6: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/6.jpg)
~ Why Scala ~
• Scala reduces number of lines by using type inference
• Learning curve is steep (syntax looks confusing)
• Lazy evaluation: allows to defer time consuming computation, until absolutely needed
Major differences with Java:
![Page 7: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/7.jpg)
~ Why Scala ~
• Functional as well as Object-Oriented
• Scala is compatible with Java
• Scala is compiled to Java byte-codes
• Therefore, Scala runs on JVM
![Page 8: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/8.jpg)
~ A First Example ~
![Page 9: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/9.jpg)
~ Class Hierarchy ~
![Page 10: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/10.jpg)
~ Interaction with Java ~
![Page 11: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/11.jpg)
~ Everything is an Object ~
Numbers are object: means numbers has methods
Functions are also object: you can pass them everywhere as object!
![Page 12: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/12.jpg)
~ Everything is an Object ~
![Page 13: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/13.jpg)
~ Everything is an Object ~
![Page 14: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/14.jpg)
~ Classes ~
![Page 15: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/15.jpg)
~ Case Class ~
![Page 16: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/16.jpg)
~ Case Class ~
![Page 17: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/17.jpg)
~ Pattern Matching ~
![Page 18: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/18.jpg)
~ Pattern Matching ~
![Page 19: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/19.jpg)
~ Traits ~
![Page 20: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/20.jpg)
~ Genericity ~
![Page 21: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/21.jpg)
~ 10 min Break ~
![Page 22: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/22.jpg)
~ Akka ~
• Name comes from Goddess (native swedes) that represents all wisdom and Beauty in the world.
• Also name of beautiful mountain in Laponia, Sweden
![Page 23: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/23.jpg)
~ Akka ~
“Toolkit and runtime for building highly concurrent distributed message-driven applications on the JVM.”~akka.io
![Page 24: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/24.jpg)
~ Akka actor ~
![Page 25: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/25.jpg)
~ Akka actor ~
![Page 26: Introduction to Scala for Java Developers](https://reader034.fdocuments.us/reader034/viewer/2022051300/58789be71a28ab42588b4911/html5/thumbnails/26.jpg)
~ Akka actor ~
Let’s do a demo!