SlideShare a Scribd company logo
Scala for Rubyists
Make your ideas come true
by Michel Perez
www.mrkaspa.com
Ruby :D
FELICIDAD TIPADO DINAMICO GEMS
NO IDE DOCUMENTACION FACIL DE APRENDER
Ruby :(
PERFORMANCE ESCALABILIDAD PROG FUNCIONAL
MANTENIBILIDAD CONCURRENCIA
I <3 Java
- JVM
- Libraries
- Performance
- Escalabilidad
- Mantenibilidad
SCALA CLOJURE
JRUBYGROOVY
6
7
PROS CONS
Primitivas de concurrencia
Desarrollado por Google
Tiempo de compilación
Lenguaje compilado
Lenguaje tipado
Sintaxis old style
Demasiado imperativo
Poco funcional
Inmutabilidad
8
PROS CONS
Primitivas de concurrencia
Erlang
Lenguaje interpretado
Funcional
Muy nuevo
9
PROS CONS
Primitivas de concurrencia
Funcional
JVM
Lenguaje interpretado
Sistema de tipado opcional
LISP
10
PROS CONS
Akka
Funcional
JVM
Tipado
Compilado
Tiempo de compilación
Curva de aprendizaje
Gestión de dependencias
Programacion funcional
FUNCIONES Y MAS FUNCIONES INMUTABILIDAD
CURRYING CLOSURES
LAZY EVALUATION PATTERN MATCHING
CAMBIA LA MANERA EN COMO
PROGRAMAS
Scala Variables?
12
val labels = Set(“")
val labels = Set[String](“”)
var labels = Set[String](“”)
Y los tipos?
Colecciones Inmutables
Syntaxis para generics <?>
NO HAY ; :D
Que es val ?
Scala OOP + FP
13
No es la OOP el demonio?
Un buen programador de scala no usa
side efect
Funciones puras
Usa OOP para abstraer datos
class Rational(x: Int, y: Int) {
def this(x: Int) = this(x, 1)
private def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b)
private val g = gcd(x, y)
def numer = x / g
def denom = y / g
def < (o: Rational) = numer * o.denom < o.numer * denom
def > (o: Rational) = !(this < o)
def +(o: Rational) = {
new Rational(numer * o.denom + denom * o.numer, denom * o.denom)
}
def -(o: Rational) = {
this + (-o)
}
def unary_- = Rational(-numer, denom)
override def toString = {
numer + "/" + denom
}
} Cada cambio de estado genera un
nuevo objeto
Scala OOP
14
Case class -> get, set, constructor auto
Traits son similares a los modulos
en Ruby
Generic clases/traits
Singleton Object
case class SocialNetwork(id: String, name: String)
trait LinkedList[+A] {
def isEmpty: Boolean
def head: A
def tail: LinkedList[A]
def at(index: Int): A
def prepend[B >: A](elem: B): LinkedList[B] =
new Cons(elem, this)
}
object Nil extends LinkedList[Nothing] {
class Cons[A](val head: A, val tail: LinkedList[A]) extends LinkedList[A] {
Scala Functions
15
Toda funciona debe tener un tipo de
retorno(type inference)
Funciones como parámetros
Retorna funciones
Vector.fill(queens.length)("* “)
.updated(col, "X ").mkString
def lambda = (x: Int) => x + 1
val multiplier = (i:Int) => i * 10
def sumComp(a: Int): (Int) => Int = {
def sum(b: Int) = a + b
}
val fun = sumComp(5)
fun(1)
def sumComp(a: Int)(b: Int): Int = {
a + b
}
Currying
Pattern Matching
16
Es un Super Switchval secondElement = List(1,2,3) match {
case x :: y :: xs => y
case _ => 0
}
val foodItem = "porridge"
def goldilocks(expr: Any) = expr match {
case (`foodItem`, _) => "eating"
case ("chair", "Mama") => "sitting"
case ("bed", "Baby") => "sleeping"
case _ => "what?"
}
goldilocks(("porridge", "Papa"))
Compara y extrae al mismo tiempo
Implicits
17
Parametros inyectados en un metodo
o constructor de manera implicita
Sirve para realizar conversiones
automaticas
implicit def implChange(str:String):Int =
new Integer(str)
def sum(a:Int, b:Int):Int = a +b
sum("1", 2)
Monads
18
map, flatMap, filter
for comprehension
def readAsync(): Future[Option[List[String]]] =
Future { readFile() }
def readFile(): Option[List[String]] =
Try { Source.fromURL("/tmp/file.txt").getLines().toList
} toOption
val futSize: Future[Int] =
for {
result <- readAsync()
list <- result
} yield list.size
val futSizeMap: Future[Option[Int]] =
readAsync().map { result: Option[List[String]] =>
result.map((list: List[String]) => list.size)
}
Future, Option, Try, Either
Actors
19
Hilos livianos
Orientados a eventos
class BloodRequester extends Actor {
implicit val executor = context.dispatcher
override def receive: Receive = {
case BloodRequest(request) =>
DonorDAO.findNear(request).map { donors =>
donors.foreach { donor =>
facebookNotifier ! FacebookNotify(donor, request)
}
}
}
}
Se reinician en caso de fallas
Supervisión
ScalaTest
20
Test Unit
trait NeoTest
extends FunSpec
with MustMatchers
with BeforeAndAfterAll
with BeforeAndAfterEach {
override def beforeEach(): Unit = {
NeoDBCleaner.cleanDB()
}
describe("UserDAOs") {
it("creates an user an checks the default group") {
withUser { (user, saved) =>
saved must be(true)
val query = s"""match (a:user {id: "${user.id.getOrElse("")}"})-[c:has_group]->(b:group) return a, b, c"""
val result = Await.result(NeoQuery.executeQuery[UserLogin, Group, HasGroupLogin](query), 2 seconds)
result.length must be(1)
}
}
}
}
Multiples Pardigmas
TDD
BDD
Scala wants U ;)
21
https://www.coursera.org/course/progfun
http://scala-exercises.47deg.com/koans

More Related Content

What's hot

Building microservices with Kotlin
Building microservices with KotlinBuilding microservices with Kotlin
Building microservices with Kotlin
Haim Yadid
 
Introduction to Elm
Introduction to ElmIntroduction to Elm
Introduction to Elm
Rogerio Chaves
 
Introduction to asynchronous DB access using Node.js and MongoDB
Introduction to asynchronous DB access using Node.js and MongoDBIntroduction to asynchronous DB access using Node.js and MongoDB
Introduction to asynchronous DB access using Node.js and MongoDB
Adrien Joly
 
SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.
Ruslan Shevchenko
 
Real cases of indispensability of Oracle SQL analytic functions
Real cases of indispensability of Oracle SQL analytic functionsReal cases of indispensability of Oracle SQL analytic functions
Real cases of indispensability of Oracle SQL analytic functions
Kim Berg Hansen
 
Swift and Kotlin Presentation
Swift and Kotlin PresentationSwift and Kotlin Presentation
Swift and Kotlin PresentationAndrzej Sitek
 
Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java Developers
Michael Galpin
 
Taking Kotlin to production, Seriously
Taking Kotlin to production, SeriouslyTaking Kotlin to production, Seriously
Taking Kotlin to production, Seriously
Haim Yadid
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
fanf42
 
Kotlin For Android - Basics (part 1 of 7)
Kotlin For Android - Basics (part 1 of 7)Kotlin For Android - Basics (part 1 of 7)
Kotlin For Android - Basics (part 1 of 7)
Gesh Markov
 
Intro to Functional Programming in Scala
Intro to Functional Programming in ScalaIntro to Functional Programming in Scala
Intro to Functional Programming in Scala
Shai Yallin
 
Oral presentation v2
Oral presentation v2Oral presentation v2
Oral presentation v2
Yeqi He
 
Kotlin For Android - Constructors and Control Flow (part 2 of 7)
Kotlin For Android - Constructors and Control Flow (part 2 of 7)Kotlin For Android - Constructors and Control Flow (part 2 of 7)
Kotlin For Android - Constructors and Control Flow (part 2 of 7)
Gesh Markov
 
LINQ Inside
LINQ InsideLINQ Inside
LINQ Insidejeffz
 
Incremental Development with Lisp: Building a Game and a Website
Incremental Development with Lisp: Building a Game and a WebsiteIncremental Development with Lisp: Building a Game and a Website
Incremental Development with Lisp: Building a Game and a Website
James Long
 
Alfresco the clojure way
Alfresco the clojure wayAlfresco the clojure way
Alfresco the clojure way
Carlo Sciolla
 
.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#
Bertrand Le Roy
 
Elm: Make Yourself A Happy Front-end Web Developer
Elm: Make Yourself A Happy Front-end Web DeveloperElm: Make Yourself A Happy Front-end Web Developer
Elm: Make Yourself A Happy Front-end Web Developer
Asep Bagja
 
C# Today and Tomorrow
C# Today and TomorrowC# Today and Tomorrow
C# Today and Tomorrow
Bertrand Le Roy
 

What's hot (20)

Building microservices with Kotlin
Building microservices with KotlinBuilding microservices with Kotlin
Building microservices with Kotlin
 
Introduction to Elm
Introduction to ElmIntroduction to Elm
Introduction to Elm
 
Introduction to asynchronous DB access using Node.js and MongoDB
Introduction to asynchronous DB access using Node.js and MongoDBIntroduction to asynchronous DB access using Node.js and MongoDB
Introduction to asynchronous DB access using Node.js and MongoDB
 
SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.SE 20016 - programming languages landscape.
SE 20016 - programming languages landscape.
 
Real cases of indispensability of Oracle SQL analytic functions
Real cases of indispensability of Oracle SQL analytic functionsReal cases of indispensability of Oracle SQL analytic functions
Real cases of indispensability of Oracle SQL analytic functions
 
Swift and Kotlin Presentation
Swift and Kotlin PresentationSwift and Kotlin Presentation
Swift and Kotlin Presentation
 
Introduction to Scala for Java Developers
Introduction to Scala for Java DevelopersIntroduction to Scala for Java Developers
Introduction to Scala for Java Developers
 
Short intro to ECMAScript
Short intro to ECMAScriptShort intro to ECMAScript
Short intro to ECMAScript
 
Taking Kotlin to production, Seriously
Taking Kotlin to production, SeriouslyTaking Kotlin to production, Seriously
Taking Kotlin to production, Seriously
 
A Tour Of Scala
A Tour Of ScalaA Tour Of Scala
A Tour Of Scala
 
Kotlin For Android - Basics (part 1 of 7)
Kotlin For Android - Basics (part 1 of 7)Kotlin For Android - Basics (part 1 of 7)
Kotlin For Android - Basics (part 1 of 7)
 
Intro to Functional Programming in Scala
Intro to Functional Programming in ScalaIntro to Functional Programming in Scala
Intro to Functional Programming in Scala
 
Oral presentation v2
Oral presentation v2Oral presentation v2
Oral presentation v2
 
Kotlin For Android - Constructors and Control Flow (part 2 of 7)
Kotlin For Android - Constructors and Control Flow (part 2 of 7)Kotlin For Android - Constructors and Control Flow (part 2 of 7)
Kotlin For Android - Constructors and Control Flow (part 2 of 7)
 
LINQ Inside
LINQ InsideLINQ Inside
LINQ Inside
 
Incremental Development with Lisp: Building a Game and a Website
Incremental Development with Lisp: Building a Game and a WebsiteIncremental Development with Lisp: Building a Game and a Website
Incremental Development with Lisp: Building a Game and a Website
 
Alfresco the clojure way
Alfresco the clojure wayAlfresco the clojure way
Alfresco the clojure way
 
.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#.NET Foundation, Future of .NET and C#
.NET Foundation, Future of .NET and C#
 
Elm: Make Yourself A Happy Front-end Web Developer
Elm: Make Yourself A Happy Front-end Web DeveloperElm: Make Yourself A Happy Front-end Web Developer
Elm: Make Yourself A Happy Front-end Web Developer
 
C# Today and Tomorrow
C# Today and TomorrowC# Today and Tomorrow
C# Today and Tomorrow
 

Viewers also liked

Adquirir una propiedad en españa en 7 pasos
Adquirir una propiedad en españa en 7 pasosAdquirir una propiedad en españa en 7 pasos
Adquirir una propiedad en españa en 7 pasos
Mariscal Abogados | International Law Firm in Spain
 
Pairform cci formpro
Pairform   cci formproPairform   cci formpro
Pairform cci formpro
Christian Colin
 
Copa menstrual y esponjas vaginales
Copa menstrual y esponjas vaginalesCopa menstrual y esponjas vaginales
Copa menstrual y esponjas vaginales
Tupper Sex Andalucia
 
Servidor web lamp
Servidor web lampServidor web lamp
Servidor web lampyaser6700
 
Niquel
NiquelNiquel
2013 brand id&print
2013 brand id&print2013 brand id&print
2013 brand id&print
Carl H. Bradford III
 
Una modesta proposición
Una modesta proposiciónUna modesta proposición
Una modesta proposición
Shanie Weissman
 
Av technika 4
Av technika 4Av technika 4
Av technika 4olc_user
 
Project Management Diploma with Instructors
Project Management Diploma with InstructorsProject Management Diploma with Instructors
Project Management Diploma with InstructorsCisco
 
9Guia1
9Guia19Guia1
9Guia1
Wilson
 
C2B2 vFabric Hyperic Kickstart
C2B2 vFabric Hyperic KickstartC2B2 vFabric Hyperic Kickstart
C2B2 vFabric Hyperic KickstartC2B2 Consulting
 
Accesus - Catalogo andamio para vias ferroviarias
Accesus - Catalogo andamio para vias ferroviariasAccesus - Catalogo andamio para vias ferroviarias
Accesus - Catalogo andamio para vias ferroviarias
Accesus Plataformas Suspendidas
 
Presentacion corporativa sevenminds agosto2012 (1)
Presentacion corporativa sevenminds agosto2012 (1)Presentacion corporativa sevenminds agosto2012 (1)
Presentacion corporativa sevenminds agosto2012 (1)
Rafael Lopez Rodriguez
 
Principios de Diseño Sustentable (resumen)
Principios de Diseño Sustentable (resumen)Principios de Diseño Sustentable (resumen)
Principios de Diseño Sustentable (resumen)
Celia R. Gastélum
 
Catalogo CTM 2015
Catalogo CTM 2015Catalogo CTM 2015
Catalogo CTM 2015
Jorge Alvarez
 

Viewers also liked (20)

los bracekts
los bracekts los bracekts
los bracekts
 
Adquirir una propiedad en españa en 7 pasos
Adquirir una propiedad en españa en 7 pasosAdquirir una propiedad en españa en 7 pasos
Adquirir una propiedad en españa en 7 pasos
 
Magonia getxo blog
Magonia  getxo blogMagonia  getxo blog
Magonia getxo blog
 
Pairform cci formpro
Pairform   cci formproPairform   cci formpro
Pairform cci formpro
 
Copa menstrual y esponjas vaginales
Copa menstrual y esponjas vaginalesCopa menstrual y esponjas vaginales
Copa menstrual y esponjas vaginales
 
Servidor web lamp
Servidor web lampServidor web lamp
Servidor web lamp
 
Niquel
NiquelNiquel
Niquel
 
Dossier ii torneo once caballeros c.f.
Dossier ii torneo once caballeros c.f.Dossier ii torneo once caballeros c.f.
Dossier ii torneo once caballeros c.f.
 
2013 brand id&print
2013 brand id&print2013 brand id&print
2013 brand id&print
 
Una modesta proposición
Una modesta proposiciónUna modesta proposición
Una modesta proposición
 
Historia parte 2
Historia parte 2Historia parte 2
Historia parte 2
 
Av technika 4
Av technika 4Av technika 4
Av technika 4
 
Project Management Diploma with Instructors
Project Management Diploma with InstructorsProject Management Diploma with Instructors
Project Management Diploma with Instructors
 
9Guia1
9Guia19Guia1
9Guia1
 
C2B2 vFabric Hyperic Kickstart
C2B2 vFabric Hyperic KickstartC2B2 vFabric Hyperic Kickstart
C2B2 vFabric Hyperic Kickstart
 
Tams 2012
Tams 2012Tams 2012
Tams 2012
 
Accesus - Catalogo andamio para vias ferroviarias
Accesus - Catalogo andamio para vias ferroviariasAccesus - Catalogo andamio para vias ferroviarias
Accesus - Catalogo andamio para vias ferroviarias
 
Presentacion corporativa sevenminds agosto2012 (1)
Presentacion corporativa sevenminds agosto2012 (1)Presentacion corporativa sevenminds agosto2012 (1)
Presentacion corporativa sevenminds agosto2012 (1)
 
Principios de Diseño Sustentable (resumen)
Principios de Diseño Sustentable (resumen)Principios de Diseño Sustentable (resumen)
Principios de Diseño Sustentable (resumen)
 
Catalogo CTM 2015
Catalogo CTM 2015Catalogo CTM 2015
Catalogo CTM 2015
 

Similar to Scala for rubyists

Scala in a nutshell by venkat
Scala in a nutshell by venkatScala in a nutshell by venkat
Scala in a nutshell by venkat
Venkateswaran Kandasamy
 
Scala for Java Programmers
Scala for Java ProgrammersScala for Java Programmers
Scala for Java Programmers
Eric Pederson
 
Functional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smartFunctional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smart
Chen Fisher
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scalapramode_ce
 
Introduction to scala
Introduction to scalaIntroduction to scala
Introduction to scala
Michel Perez
 
The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)jeffz
 
Intro to Functional Programming
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional Programming
Andraž Bajt
 
Scala - just good for Java shops?
Scala - just good for Java shops?Scala - just good for Java shops?
Scala - just good for Java shops?
Sarah Mount
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
daewon jeong
 
Kotlin boost yourproductivity
Kotlin boost yourproductivityKotlin boost yourproductivity
Kotlin boost yourproductivity
nklmish
 
Coding in Style
Coding in StyleCoding in Style
Coding in Style
scalaconfjp
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
Abbas Raza
 
20160520 what youneedtoknowaboutlambdas
20160520 what youneedtoknowaboutlambdas20160520 what youneedtoknowaboutlambdas
20160520 what youneedtoknowaboutlambdas
shinolajla
 
Introduction to Asynchronous scala
Introduction to Asynchronous scalaIntroduction to Asynchronous scala
Introduction to Asynchronous scalaStratio
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
Łukasz Bałamut
 
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIModern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Ganesh Samarthyam
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondMario Fusco
 
Светлана Исакова «Язык Kotlin»
Светлана Исакова «Язык Kotlin»Светлана Исакова «Язык Kotlin»
Светлана Исакова «Язык Kotlin»
e-Legion
 
The Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana IsakovaThe Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana Isakova
Vasil Remeniuk
 

Similar to Scala for rubyists (20)

Scala in a nutshell by venkat
Scala in a nutshell by venkatScala in a nutshell by venkat
Scala in a nutshell by venkat
 
Scala for Java Programmers
Scala for Java ProgrammersScala for Java Programmers
Scala for Java Programmers
 
Functional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smartFunctional programming with Ruby - can make you look smart
Functional programming with Ruby - can make you look smart
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
 
Introduction to scala
Introduction to scalaIntroduction to scala
Introduction to scala
 
The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)The Evolution of Async-Programming (SD 2.0, JavaScript)
The Evolution of Async-Programming (SD 2.0, JavaScript)
 
Intro to Functional Programming
Intro to Functional ProgrammingIntro to Functional Programming
Intro to Functional Programming
 
Scala - just good for Java shops?
Scala - just good for Java shops?Scala - just good for Java shops?
Scala - just good for Java shops?
 
Scala is java8.next()
Scala is java8.next()Scala is java8.next()
Scala is java8.next()
 
Kotlin boost yourproductivity
Kotlin boost yourproductivityKotlin boost yourproductivity
Kotlin boost yourproductivity
 
Coding in Style
Coding in StyleCoding in Style
Coding in Style
 
Introduction to clojure
Introduction to clojureIntroduction to clojure
Introduction to clojure
 
20160520 what youneedtoknowaboutlambdas
20160520 what youneedtoknowaboutlambdas20160520 what youneedtoknowaboutlambdas
20160520 what youneedtoknowaboutlambdas
 
Introduction to Asynchronous scala
Introduction to Asynchronous scalaIntroduction to Asynchronous scala
Introduction to Asynchronous scala
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
 
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIModern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
 
FP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyondFP in Java - Project Lambda and beyond
FP in Java - Project Lambda and beyond
 
Светлана Исакова «Язык Kotlin»
Светлана Исакова «Язык Kotlin»Светлана Исакова «Язык Kotlin»
Светлана Исакова «Язык Kotlin»
 
The Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana IsakovaThe Kotlin Programming Language, Svetlana Isakova
The Kotlin Programming Language, Svetlana Isakova
 
Scala ntnu
Scala ntnuScala ntnu
Scala ntnu
 

Recently uploaded

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

Scala for rubyists

  • 1. Scala for Rubyists Make your ideas come true by Michel Perez www.mrkaspa.com
  • 2. Ruby :D FELICIDAD TIPADO DINAMICO GEMS NO IDE DOCUMENTACION FACIL DE APRENDER
  • 3. Ruby :( PERFORMANCE ESCALABILIDAD PROG FUNCIONAL MANTENIBILIDAD CONCURRENCIA
  • 4.
  • 5. I <3 Java - JVM - Libraries - Performance - Escalabilidad - Mantenibilidad SCALA CLOJURE JRUBYGROOVY
  • 6. 6
  • 7. 7 PROS CONS Primitivas de concurrencia Desarrollado por Google Tiempo de compilación Lenguaje compilado Lenguaje tipado Sintaxis old style Demasiado imperativo Poco funcional Inmutabilidad
  • 8. 8 PROS CONS Primitivas de concurrencia Erlang Lenguaje interpretado Funcional Muy nuevo
  • 9. 9 PROS CONS Primitivas de concurrencia Funcional JVM Lenguaje interpretado Sistema de tipado opcional LISP
  • 10. 10 PROS CONS Akka Funcional JVM Tipado Compilado Tiempo de compilación Curva de aprendizaje Gestión de dependencias
  • 11. Programacion funcional FUNCIONES Y MAS FUNCIONES INMUTABILIDAD CURRYING CLOSURES LAZY EVALUATION PATTERN MATCHING CAMBIA LA MANERA EN COMO PROGRAMAS
  • 12. Scala Variables? 12 val labels = Set(“") val labels = Set[String](“”) var labels = Set[String](“”) Y los tipos? Colecciones Inmutables Syntaxis para generics <?> NO HAY ; :D Que es val ?
  • 13. Scala OOP + FP 13 No es la OOP el demonio? Un buen programador de scala no usa side efect Funciones puras Usa OOP para abstraer datos class Rational(x: Int, y: Int) { def this(x: Int) = this(x, 1) private def gcd(a: Int, b: Int): Int = if (b == 0) a else gcd(b, a % b) private val g = gcd(x, y) def numer = x / g def denom = y / g def < (o: Rational) = numer * o.denom < o.numer * denom def > (o: Rational) = !(this < o) def +(o: Rational) = { new Rational(numer * o.denom + denom * o.numer, denom * o.denom) } def -(o: Rational) = { this + (-o) } def unary_- = Rational(-numer, denom) override def toString = { numer + "/" + denom } } Cada cambio de estado genera un nuevo objeto
  • 14. Scala OOP 14 Case class -> get, set, constructor auto Traits son similares a los modulos en Ruby Generic clases/traits Singleton Object case class SocialNetwork(id: String, name: String) trait LinkedList[+A] { def isEmpty: Boolean def head: A def tail: LinkedList[A] def at(index: Int): A def prepend[B >: A](elem: B): LinkedList[B] = new Cons(elem, this) } object Nil extends LinkedList[Nothing] { class Cons[A](val head: A, val tail: LinkedList[A]) extends LinkedList[A] {
  • 15. Scala Functions 15 Toda funciona debe tener un tipo de retorno(type inference) Funciones como parámetros Retorna funciones Vector.fill(queens.length)("* “) .updated(col, "X ").mkString def lambda = (x: Int) => x + 1 val multiplier = (i:Int) => i * 10 def sumComp(a: Int): (Int) => Int = { def sum(b: Int) = a + b } val fun = sumComp(5) fun(1) def sumComp(a: Int)(b: Int): Int = { a + b } Currying
  • 16. Pattern Matching 16 Es un Super Switchval secondElement = List(1,2,3) match { case x :: y :: xs => y case _ => 0 } val foodItem = "porridge" def goldilocks(expr: Any) = expr match { case (`foodItem`, _) => "eating" case ("chair", "Mama") => "sitting" case ("bed", "Baby") => "sleeping" case _ => "what?" } goldilocks(("porridge", "Papa")) Compara y extrae al mismo tiempo
  • 17. Implicits 17 Parametros inyectados en un metodo o constructor de manera implicita Sirve para realizar conversiones automaticas implicit def implChange(str:String):Int = new Integer(str) def sum(a:Int, b:Int):Int = a +b sum("1", 2)
  • 18. Monads 18 map, flatMap, filter for comprehension def readAsync(): Future[Option[List[String]]] = Future { readFile() } def readFile(): Option[List[String]] = Try { Source.fromURL("/tmp/file.txt").getLines().toList } toOption val futSize: Future[Int] = for { result <- readAsync() list <- result } yield list.size val futSizeMap: Future[Option[Int]] = readAsync().map { result: Option[List[String]] => result.map((list: List[String]) => list.size) } Future, Option, Try, Either
  • 19. Actors 19 Hilos livianos Orientados a eventos class BloodRequester extends Actor { implicit val executor = context.dispatcher override def receive: Receive = { case BloodRequest(request) => DonorDAO.findNear(request).map { donors => donors.foreach { donor => facebookNotifier ! FacebookNotify(donor, request) } } } } Se reinician en caso de fallas Supervisión
  • 20. ScalaTest 20 Test Unit trait NeoTest extends FunSpec with MustMatchers with BeforeAndAfterAll with BeforeAndAfterEach { override def beforeEach(): Unit = { NeoDBCleaner.cleanDB() } describe("UserDAOs") { it("creates an user an checks the default group") { withUser { (user, saved) => saved must be(true) val query = s"""match (a:user {id: "${user.id.getOrElse("")}"})-[c:has_group]->(b:group) return a, b, c""" val result = Await.result(NeoQuery.executeQuery[UserLogin, Group, HasGroupLogin](query), 2 seconds) result.length must be(1) } } } } Multiples Pardigmas TDD BDD
  • 21. Scala wants U ;) 21 https://www.coursera.org/course/progfun http://scala-exercises.47deg.com/koans