introduction to scala for java developers

27
~ Scala for the impatient Java Developer ~ Meetup By : 9 MARCH 2016

Upload: solix-jj

Post on 13-Jan-2017

190 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Introduction to Scala for Java Developers

~ Scala for the impatient Java Developer ~

Meetup By :

9 MARCH 2016

Page 2: Introduction to Scala for Java Developers

~ Agenda ~

• Why Scala (imperative Vs. functional programming)

• intro to Scala(Basic)

• Quick Demo: Akka actors

Page 3: Introduction to Scala for Java Developers

~ Why Scala ~

SCALA JAVA

Page 4: Introduction to Scala for Java Developers

~ Why Scala ~

SCALA JAVA 8

Page 5: Introduction to Scala for Java Developers

~ 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

~ 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

~ 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

~ A First Example ~

Page 9: Introduction to Scala for Java Developers

~ Class Hierarchy ~

Page 10: Introduction to Scala for Java Developers

~ Interaction with Java ~

Page 11: Introduction to Scala for Java Developers

~ 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

~ Everything is an Object ~

Page 13: Introduction to Scala for Java Developers

~ Everything is an Object ~

Page 14: Introduction to Scala for Java Developers

~ Classes ~

Page 15: Introduction to Scala for Java Developers

~ Case Class ~

Page 16: Introduction to Scala for Java Developers

~ Case Class ~

Page 17: Introduction to Scala for Java Developers

~ Pattern Matching ~

Page 18: Introduction to Scala for Java Developers

~ Pattern Matching ~

Page 19: Introduction to Scala for Java Developers

~ Traits ~

Page 20: Introduction to Scala for Java Developers

~ Genericity ~

Page 21: Introduction to Scala for Java Developers

~ 10 min Break ~

Page 22: Introduction to Scala for Java Developers

~ 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

~ 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

~ Akka actor ~

Page 25: Introduction to Scala for Java Developers

~ Akka actor ~

Page 26: Introduction to Scala for Java Developers

~ Akka actor ~

Let’s do a demo!

Page 27: Introduction to Scala for Java Developers

: @5oheyl

Keep in touch:

Contact: [email protected]