SlideShare a Scribd company logo
1 of 26
Escala el Everest con Scala http://slidesha.re/nRVC7x
Soy … Gustavo Arjones gustavo@socialmetrix.com @arjones CTO – Socialmetrix Vivo en BA desde 2007 Interés: Sistemasdistribuídos SOA Databases Text Mining / NLP Big Data Social Media Data Visualization
“If I were to pick a language to use today other than Java, it would be Scala” James Gosling
Madurez … Professional Services / Training
Porque me gusta? JVM / Java Interop Type inference MuyConciso REPL Lib de Collections Promuevebuenasprácticas Functional + OO Pattern Matching Case Class Implicit conversions Traits Some/None/Option
JVM / Java Interop
Type Inference valcountryByLanguage : Map[String, List[String]] = Map( 	"es"->List("ar","es", "mx"),  	"pt" -> List("br","pt"),  	"en" -> List("uk","us") ) valcountryByLanguage = Map( 	"es"->List("ar","es", "mx"),  	"pt" -> List("br","pt"),  	"en" -> List("uk","us") ) countryByLanguage: scala.collection.immutable.Map[String,List[String]]
MuyConciso def +(v:Int) = v+1 objA==objB No esnecesario: () ; return .
REPL (Equiv. Ruby IRB)
Collections
Collections
Buzz de los lenguajes
Procesando Delicious
https://gist.github.com/1123656
Promuevebuenaspracticas                                      … sin limitarte! Remueve Boilerplate  Inmutabilidad Uso de funciones No side-effect Muchos helpers yconstructores Share-nothing Listopara Multi-core
Functional programming cat FILE | grep"@jugar.com.ar" | wc valplaces = List("Buenos Aires", "Bogota", "DF", "Sao Paulo", "New York") places.filter((p:String) => p.startsWith("B")) places.filter(p => p.startsWith("B")) places.filter(_.startsWith("B")) valmyFunc = (p:String) => p.startsWith("B") places.filter(myFilter) def myFilter(p:String) = p.startsWith("B") places.filter(myFilter)
Pattern Matching case classPerson(valname: String, valage: Int) valppl = List(Person("John", 25), Person("Paul", 27), Person("George", 22), Person("Ringo", 22)) ppl.foreach {     _ match { case Person("John", age) => println("John is " + age) case Person(name, 22) => println(name + " is 22") case _ => println("Don't know")     }   }
Implicit conversions Conversión de tipos Adicionarcomportamiento en clasescerradas Extender el lenguaje
Implicit conversions class RichInt(i: Int) { def times(f: => Unit) = { for (x <- 0 to i) f     }   } new RichInt (5).times { println("hi!") } implicit defintToRichInt(i: Int) = new RichInt(i)   5.times { println("nice!") }
traits – Interfaces con anabólicos trait NoNullAccessMap[K, V] extends java.util.Map[K, V] { abstract override def get(key: Object): V = { valvalue = super.get(key) assert(value != null, "No value found " + key) return value     }   } trait NoOverwriteMap[K, V] extends java.util.Map[K, V] { abstract override def put(key: K, value: V): V = { assert(!containsKey(key), "Could not set " + key  			 + " to " + value + ": it is already set to " + get(key)) return super.put(key, value)     }   }
traits – Interfaces con anabólicos class StrictMap[K, V] extends HashMap[K, V] with NoNullAccessMap[K, V] with NoOverwriteMap[K, V] valstateForCity = new HashMap[String, String]()  with NoNullAccessMap[String, String]  with NoOverwriteMap[String, String]
Option //previous approach: doesnt compile! val name = getPerson("person123").name //.get will throw a RuntimeException if it is null here val name2 = getPerson("person123").get.name //get the value, or use a default val name3 = getPerson("person123").getOrElse("Name unknown") //in some cases (not this one), pattern matching is nice val name4 = getPerson("person123") match {     case Some(name) => name     case None => "Name Unknown” }
Take away No es Java oScala, puedenconvivir! AprenderScala me hacemejordesarrollador Java Empezá con pequeñosproyectosparaprobar, ganáconfianza La sintaxisparececompleja, después se despeja
Pordóndeempezar How we (mostly) moved from Java to Scala http://bit.ly/rlw2Cx Scala for Java Refugees http://bit.ly/qmHTpm Simply Scala http://www.simplyscala.com Typesafe Stack http://bit.ly/qmcP0A An introduction to Scala for Java Programmers http://slidesha.re/oGvttM Pragmatic Real-World Scala http://slidesha.re/nfF0xK Tools & Libraries http://bit.ly/nple9Z
Trabajamos con estastecnologías Sumate a nuestroequipo! gustavo@socialmetrix.com
Gracias / Obrigado ;)

More Related Content

Similar to Jugar Introduccion a Scala

Spark with Elasticsearch
Spark with ElasticsearchSpark with Elasticsearch
Spark with ElasticsearchHolden Karau
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)jeffz
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Jonas Bonér
 
Pragmatic Real-World Scala
Pragmatic Real-World ScalaPragmatic Real-World Scala
Pragmatic Real-World Scalaparag978978
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
BCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java DevelopersBCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java DevelopersMiles Sabin
 
An Introduction to Scala for Java Developers
An Introduction to Scala for Java DevelopersAn Introduction to Scala for Java Developers
An Introduction to Scala for Java DevelopersMiles Sabin
 
Beginning Scala Svcc 2009
Beginning Scala Svcc 2009Beginning Scala Svcc 2009
Beginning Scala Svcc 2009David Pollak
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005Tugdual Grall
 
Intro to Scala.js - Scala UG Cologne
Intro to Scala.js - Scala UG CologneIntro to Scala.js - Scala UG Cologne
Intro to Scala.js - Scala UG CologneMarius Soutier
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CAlexis Gallagher
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoMatt Stine
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin Vasil Remeniuk
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
Scala for Java Programmers
Scala for Java ProgrammersScala for Java Programmers
Scala for Java ProgrammersEric Pederson
 

Similar to Jugar Introduccion a Scala (20)

Scala introduction
Scala introductionScala introduction
Scala introduction
 
Einführung in TypeScript
Einführung in TypeScriptEinführung in TypeScript
Einführung in TypeScript
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
 
Spark with Elasticsearch
Spark with ElasticsearchSpark with Elasticsearch
Spark with Elasticsearch
 
Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)Why Java Sucks and C# Rocks (Final)
Why Java Sucks and C# Rocks (Final)
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)
 
Pragmatic Real-World Scala
Pragmatic Real-World ScalaPragmatic Real-World Scala
Pragmatic Real-World Scala
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
BCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java DevelopersBCS SPA 2010 - An Introduction to Scala for Java Developers
BCS SPA 2010 - An Introduction to Scala for Java Developers
 
An Introduction to Scala for Java Developers
An Introduction to Scala for Java DevelopersAn Introduction to Scala for Java Developers
An Introduction to Scala for Java Developers
 
C to perl binding
C to perl bindingC to perl binding
C to perl binding
 
Beginning Scala Svcc 2009
Beginning Scala Svcc 2009Beginning Scala Svcc 2009
Beginning Scala Svcc 2009
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
Scala introduction
Scala introductionScala introduction
Scala introduction
 
Intro to Scala.js - Scala UG Cologne
Intro to Scala.js - Scala UG CologneIntro to Scala.js - Scala UG Cologne
Intro to Scala.js - Scala UG Cologne
 
Swift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-CSwift, functional programming, and the future of Objective-C
Swift, functional programming, and the future of Objective-C
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to Go
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Scala for Java Programmers
Scala for Java ProgrammersScala for Java Programmers
Scala for Java Programmers
 

More from Socialmetrix

The Ultimate Guide to using Social Media Media Analytics
The Ultimate Guide to using Social Media Media AnalyticsThe Ultimate Guide to using Social Media Media Analytics
The Ultimate Guide to using Social Media Media AnalyticsSocialmetrix
 
Social Media is no longer something relevant just for the area of Marketing. ...
Social Media is no longer something relevant just for the area of Marketing. ...Social Media is no longer something relevant just for the area of Marketing. ...
Social Media is no longer something relevant just for the area of Marketing. ...Socialmetrix
 
How to Create a Successful Social Media Campaign
How to Create a Successful Social Media CampaignHow to Create a Successful Social Media Campaign
How to Create a Successful Social Media CampaignSocialmetrix
 
Introducción a Apache Spark a través de un caso de uso cotidiano
Introducción a Apache Spark a través de un caso de uso cotidianoIntroducción a Apache Spark a través de un caso de uso cotidiano
Introducción a Apache Spark a través de un caso de uso cotidianoSocialmetrix
 
Construyendo una Infraestructura de Big Data rentable y escalable (la evoluci...
Construyendo una Infraestructura de Big Data rentable y escalable (la evoluci...Construyendo una Infraestructura de Big Data rentable y escalable (la evoluci...
Construyendo una Infraestructura de Big Data rentable y escalable (la evoluci...Socialmetrix
 
Social media brasil 2014 - O Marketing e as Redes Sociais em tempos de conver...
Social media brasil 2014 - O Marketing e as Redes Sociais em tempos de conver...Social media brasil 2014 - O Marketing e as Redes Sociais em tempos de conver...
Social media brasil 2014 - O Marketing e as Redes Sociais em tempos de conver...Socialmetrix
 
14º Encontro Locaweb - Evolução das Plataformas para Métricas Sociais
14º Encontro Locaweb - Evolução das Plataformas para Métricas Sociais14º Encontro Locaweb - Evolução das Plataformas para Métricas Sociais
14º Encontro Locaweb - Evolução das Plataformas para Métricas SociaisSocialmetrix
 
Endeavor – métricas em mídias sociais
Endeavor – métricas em mídias sociaisEndeavor – métricas em mídias sociais
Endeavor – métricas em mídias sociaisSocialmetrix
 
MongoDB, RabbitMQ y Applicaciones en Nube
MongoDB, RabbitMQ y Applicaciones en NubeMongoDB, RabbitMQ y Applicaciones en Nube
MongoDB, RabbitMQ y Applicaciones en NubeSocialmetrix
 

More from Socialmetrix (11)

The Ultimate Guide to using Social Media Media Analytics
The Ultimate Guide to using Social Media Media AnalyticsThe Ultimate Guide to using Social Media Media Analytics
The Ultimate Guide to using Social Media Media Analytics
 
Social Media is no longer something relevant just for the area of Marketing. ...
Social Media is no longer something relevant just for the area of Marketing. ...Social Media is no longer something relevant just for the area of Marketing. ...
Social Media is no longer something relevant just for the area of Marketing. ...
 
How to Create a Successful Social Media Campaign
How to Create a Successful Social Media CampaignHow to Create a Successful Social Media Campaign
How to Create a Successful Social Media Campaign
 
Introducción a Apache Spark a través de un caso de uso cotidiano
Introducción a Apache Spark a través de un caso de uso cotidianoIntroducción a Apache Spark a través de un caso de uso cotidiano
Introducción a Apache Spark a través de un caso de uso cotidiano
 
Construyendo una Infraestructura de Big Data rentable y escalable (la evoluci...
Construyendo una Infraestructura de Big Data rentable y escalable (la evoluci...Construyendo una Infraestructura de Big Data rentable y escalable (la evoluci...
Construyendo una Infraestructura de Big Data rentable y escalable (la evoluci...
 
Social media brasil 2014 - O Marketing e as Redes Sociais em tempos de conver...
Social media brasil 2014 - O Marketing e as Redes Sociais em tempos de conver...Social media brasil 2014 - O Marketing e as Redes Sociais em tempos de conver...
Social media brasil 2014 - O Marketing e as Redes Sociais em tempos de conver...
 
14º Encontro Locaweb - Evolução das Plataformas para Métricas Sociais
14º Encontro Locaweb - Evolução das Plataformas para Métricas Sociais14º Encontro Locaweb - Evolução das Plataformas para Métricas Sociais
14º Encontro Locaweb - Evolução das Plataformas para Métricas Sociais
 
Call2Social
Call2SocialCall2Social
Call2Social
 
Redis
RedisRedis
Redis
 
Endeavor – métricas em mídias sociais
Endeavor – métricas em mídias sociaisEndeavor – métricas em mídias sociais
Endeavor – métricas em mídias sociais
 
MongoDB, RabbitMQ y Applicaciones en Nube
MongoDB, RabbitMQ y Applicaciones en NubeMongoDB, RabbitMQ y Applicaciones en Nube
MongoDB, RabbitMQ y Applicaciones en Nube
 

Recently uploaded

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 

Recently uploaded (20)

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 

Jugar Introduccion a Scala

  • 1. Escala el Everest con Scala http://slidesha.re/nRVC7x
  • 2. Soy … Gustavo Arjones gustavo@socialmetrix.com @arjones CTO – Socialmetrix Vivo en BA desde 2007 Interés: Sistemasdistribuídos SOA Databases Text Mining / NLP Big Data Social Media Data Visualization
  • 3. “If I were to pick a language to use today other than Java, it would be Scala” James Gosling
  • 4. Madurez … Professional Services / Training
  • 5. Porque me gusta? JVM / Java Interop Type inference MuyConciso REPL Lib de Collections Promuevebuenasprácticas Functional + OO Pattern Matching Case Class Implicit conversions Traits Some/None/Option
  • 6. JVM / Java Interop
  • 7. Type Inference valcountryByLanguage : Map[String, List[String]] = Map( "es"->List("ar","es", "mx"), "pt" -> List("br","pt"), "en" -> List("uk","us") ) valcountryByLanguage = Map( "es"->List("ar","es", "mx"), "pt" -> List("br","pt"), "en" -> List("uk","us") ) countryByLanguage: scala.collection.immutable.Map[String,List[String]]
  • 8. MuyConciso def +(v:Int) = v+1 objA==objB No esnecesario: () ; return .
  • 12. Buzz de los lenguajes
  • 15. Promuevebuenaspracticas … sin limitarte! Remueve Boilerplate Inmutabilidad Uso de funciones No side-effect Muchos helpers yconstructores Share-nothing Listopara Multi-core
  • 16. Functional programming cat FILE | grep"@jugar.com.ar" | wc valplaces = List("Buenos Aires", "Bogota", "DF", "Sao Paulo", "New York") places.filter((p:String) => p.startsWith("B")) places.filter(p => p.startsWith("B")) places.filter(_.startsWith("B")) valmyFunc = (p:String) => p.startsWith("B") places.filter(myFilter) def myFilter(p:String) = p.startsWith("B") places.filter(myFilter)
  • 17. Pattern Matching case classPerson(valname: String, valage: Int) valppl = List(Person("John", 25), Person("Paul", 27), Person("George", 22), Person("Ringo", 22)) ppl.foreach { _ match { case Person("John", age) => println("John is " + age) case Person(name, 22) => println(name + " is 22") case _ => println("Don't know") } }
  • 18. Implicit conversions Conversión de tipos Adicionarcomportamiento en clasescerradas Extender el lenguaje
  • 19. Implicit conversions class RichInt(i: Int) { def times(f: => Unit) = { for (x <- 0 to i) f } } new RichInt (5).times { println("hi!") } implicit defintToRichInt(i: Int) = new RichInt(i) 5.times { println("nice!") }
  • 20. traits – Interfaces con anabólicos trait NoNullAccessMap[K, V] extends java.util.Map[K, V] { abstract override def get(key: Object): V = { valvalue = super.get(key) assert(value != null, "No value found " + key) return value } } trait NoOverwriteMap[K, V] extends java.util.Map[K, V] { abstract override def put(key: K, value: V): V = { assert(!containsKey(key), "Could not set " + key + " to " + value + ": it is already set to " + get(key)) return super.put(key, value) } }
  • 21. traits – Interfaces con anabólicos class StrictMap[K, V] extends HashMap[K, V] with NoNullAccessMap[K, V] with NoOverwriteMap[K, V] valstateForCity = new HashMap[String, String]() with NoNullAccessMap[String, String] with NoOverwriteMap[String, String]
  • 22. Option //previous approach: doesnt compile! val name = getPerson("person123").name //.get will throw a RuntimeException if it is null here val name2 = getPerson("person123").get.name //get the value, or use a default val name3 = getPerson("person123").getOrElse("Name unknown") //in some cases (not this one), pattern matching is nice val name4 = getPerson("person123") match { case Some(name) => name case None => "Name Unknown” }
  • 23. Take away No es Java oScala, puedenconvivir! AprenderScala me hacemejordesarrollador Java Empezá con pequeñosproyectosparaprobar, ganáconfianza La sintaxisparececompleja, después se despeja
  • 24. Pordóndeempezar How we (mostly) moved from Java to Scala http://bit.ly/rlw2Cx Scala for Java Refugees http://bit.ly/qmHTpm Simply Scala http://www.simplyscala.com Typesafe Stack http://bit.ly/qmcP0A An introduction to Scala for Java Programmers http://slidesha.re/oGvttM Pragmatic Real-World Scala http://slidesha.re/nfF0xK Tools & Libraries http://bit.ly/nple9Z
  • 25. Trabajamos con estastecnologías Sumate a nuestroequipo! gustavo@socialmetrix.com